vueRhino - Vue API

API Reference for the Rhino Vue SDK.


$rhino

Vue mixin for Rhino Speech-to-Intent Engine.


$rhino.init()

async function init(
rhinoFactoryArgs: RhinoWorkerFactoryArgs,
rhinoFactory: RhinoWorkerFactory,
inferenceCallback: (inference: RhinoInference) => void,
contextCallback: (info: string) => void,
readyCallback: () => void,
errorCallback: (error: Error) => void
)

Initializes RhinoWorkerFactory based on arguments RhinoWorkerFactoryArgs and the language-specific worker factory.

Parameters

  • rhinoFactoryArgs RhinoWorkerFactoryArgs : Arguments for RhinoWorkerFactory.
  • rhinoFactory RhinoWorkerFactory: The language-specific worker factory, imported as { RhinoWorkerFactory } from the @picovoice/rhino-web-xx-worker series of packages, where xx is the two-letter language code.
  • inferenceCallback (inference: RhinoInferenceFinalized) => void : A method invoked upon completion of intent inference.
  • contextCallback (string) => void : A method invoked after Rhino has initialized and has context information.
  • readyCallback () => void : A method invoked after Rhino has initialized.
  • errorCallback (Error) => void : A method invoked if an error occurs within RhinoWorkerFactory.

$rhino.start()

function start(): boolean

Method to start processing audio.

Returns

  • boolean: True if successfully started.

$rhino.pause()

function pause(): boolean

Method to stop processing audio.

Returns

  • boolean: True if successfully stopped.

$rhino.pushToTalk()

function pushToTalk(): boolean

Method to put Rhino in an active isTalking state. Rhino must be in a start state before this function can be called.

Returns

  • boolean: True if successfully changed to isTalking state.

RhinoWorkerFactoryArgs

type RhinoWorkerFactoryArgs = {
accessKey: string
context: RhinoContext
requireEndpoint?: boolean
start: boolean
}

Type alias for RhinoWorkerFactory arguments.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • context RhinoContext : The context to instantiate.
  • requireEndpoint boolean : If set to true, Rhino requires an endpoint (chunk of silence) before finishing inference.
  • start boolean : Optional. If set to true, Rhino immediately starts the microphone upon initialization.

RhinoContext

type RhinoContext = {
base64: string
sensitivity?: number
}

Type alias for Rhino context.

Parameters

  • base64 string : Base64 representation of a trained Rhino context (.rhn file).
  • sensitivity number : Optional. Value in range [0,1] that trades off miss rate for false alarm. If not set 0.5 will be used.

RhinoInference

type RhinoInference = {
isFinalized: boolean
isUnderstood?: boolean
intent?: string
slots?: {[key: string]: string}
}

Type alias for the Rhino inference.

Parameters

  • isFinalized: Indicates whether Rhino has concluded an inference.
  • isUnderstood boolean : Indicates whether the intent was understood.
  • intent string : The name of the intent.
  • slots {[string]: string} : Map of the slot variables and values extracted from the utterance.

RhinoVue

interface RhinoVue {
$_ppnWorker_: Worker | null;
$_webVp_: WebVoiceProcessor | null;
init: (
rhinoFactoryArgs: RhinoWorkerFactoryArgs,
rhinoFactory: RhinoWorkerFactory,
inferenceCallback: (inference: RhinoInferencefinalized) => void,
contextCallback: (info: string) => void,
readyCallback: () => void,
errorCallback: (error: Error) => void): void;
start: () => boolean;
pause: () => boolean;
pushToTalk: () => boolean;
delete: () => void;
}

Type alias for Rhino Vue Mixin. Import and extend Vue interface with RhinoVue in order to get types while using typescript.

Parameters

  • $_rhnWorker_ Worker | null : The worker instance of Rhino.
  • $_webVp_ WebVoiceProcessor | null : Web Voice Processor instance to record audio.
  • init $rhino.init : Rhino init function.
  • start $rhino.start : Rhino start function.
  • pause $rhino.pause : Rhino pause function.
  • pushToTalk $rhino.pushToTalk: Rhino pushToTalk function.
  • delete $rhino.delete : Rhino delete function.

Issue with this doc? Please let us know.