goRhino - Go API

API Reference for the Rhino Go SDK (pkg.go.dev).


rhino.FrameLength

var FrameLength int

Number of audio samples per frame.


rhino.SampleRate

var SampleRate int

Audio sample rate accepted by Rhino.


rhino.Version

var Version string

Rhino version.


rhino.PvStatus

type PvStatus struct

Status return codes from the Rhino library. Possible values are:

const (
SUCCESS PvStatus = 0
OUT_OF_MEMORY PvStatus = 1
IO_ERROR PvStatus = 2
INVALID_ARGUMENT PvStatus = 3
STOP_ITERATION PvStatus = 4
KEY_ERROR PvStatus = 5
INVALID_STATE PvStatus = 6
RUNTIME_ERROR PvStatus = 7
ACTIVATION_ERROR PvStatus = 8
ACTIVATION_LIMIT_REACHED PvStatus = 9
ACTIVATION_THROTTLED PvStatus = 10
ACTIVATION_REFUSED PvStatus = 11
)

rhino.NewRhino()

func NewRhino(accessKey string, contextPath string) Rhino

Creates a Rhino struct with default parameters, and the given context file.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console (https://console.picovoice.ai/).
  • contextPath string : Absolute path to the Rhino context file (.rhn).

Returns

  • Rhino : An instance of Rhino struct.

rhino.Rhino

type Rhino struct

Struct for the Rhino Speech-to-Intent engine.


rhino.Rhino.AccessKey

var AccessKey string

AccessKey obtained from Picovoice Console (https://console.picovoice.ai/).


rhino.Rhino.ContextInfo

var ContextInfo string

Once initialized, stores the source of the Rhino context in YAML format. Shows the list of intents, which expressions map to those intents, as well as slots and their possible values.


rhino.Rhino.ContextPath

var ContextPath string

Absolute path to the Rhino context file (.rhn).


rhino.Rhino.ModelPath

var ModelPath string

Absolute path to the file containing model parameters.


rhino.Rhino.RequireEndpoint

var RequireEndpoint bool

If set to false, Rhino does not require an endpoint (chunk of silence) before finishing inference.


rhino.Rhino.Sensitivity

var Sensitivity float32

Inference sensitivity. A higher sensitivity value results in fewer misses at the cost of (potentially) increasing the erroneous inference rate. Sensitivity should be a floating-point number within 0 and 1.


rhino.Rhino.Delete()

func (rhino *Rhino) Delete() error

Releases resources acquired by Rhino.

Returns

  • error : Error produced by the Rhino SDK. nil if no error was encountered.

rhino.Rhino.GetInference()

func (rhino *Rhino) GetInference() (inference RhinoInference, err error)

Gets inference results from Rhino. If the spoken command was understood, it includes the specific intent name that was inferred, and (if applicable) slot keys and specific slot values. Should only be called after the process function returns true, otherwise Rhino has not yet reached an inference conclusion.

Returns

  • RhinoInference : Inference result.
  • error : Error produced by the Rhino SDK. nil if no error was encountered.

rhino.Rhino.Init()

func (rhino *Rhino) Init() error

Init function for Rhino. Must be called before attempting process.

Returns

  • error : Error produced by the Rhino SDK. nil if no error was encountered.

rhino.Rhino.Process()

func (rhino *Rhino) Process(pcm []int16) (isFinalized bool, err error)

Process a frame of pcm audio with the speech-to-intent engine.

Parameters

  • pcm []int16 : A frame of audio samples.

Returns

  • bool : Indicates whether Rhino has an inference ready or not.
  • error : Error produced by the Rhino SDK. nil if no error was encountered.

rhino.RhinoError

type RhinoError struct

Custom error type for errors produced from the Rhino Go SDK.


rhino.RhinoError.Error()

func (e *RhinoError) Error() string

Formats the Rhino error into a string.

Returns

  • string : Formatted error string.

rhino.RhinoInference

type RhinoInference struct

A struct containing Rhino inference result data.


rhino.RhinoInference.IsUnderstood

var IsUnderstood bool

Indicates whether Rhino understood what it heard based on the context.


rhino.RhinoInference.Intent

var Intent string

If IsUnderstood, name of intent that was inferred.


rhino.RhinoInference.Slots

var Slots map[string]string

If IsUnderstood, dictionary of slot keys and values that were inferred.


Issue with this doc? Please let us know.