- LLM message context modificiation
- Direct text-to-speech output
- Multi-lingual workflows
- Custom convenience functions
Using a helper
Helpers must be imported, defined and registered to you voice client. Here is an example using the included LLM helper:Registering a helper
Registering a helper provides it with a reference to your voice client. Helpers must be registered in order to use event and action dispatch / resolution.voiceClient.registerHelper(service, helper);
Service targeted by the helper as part of your voice client constructor
services map.
An exception is thrown if no matching service can be found.Note: targeting services is required for scenarios where a pipeline contains multiple declarations of the same service type. For example, your pipeline may have two or more LLM services registered.A helper subclass instance of
VoiceClientHelper.Retrieving a helper
The voice client holds a reference to all registered helpers. This can be useful if you do not want to hold / pass a reference across your codebase:Unregistering a helper
A service in your pipeline can currently have reference to a single helper to avoid conflicting action dispatch. You can unregister a helper from a service like so:Unregistering helpers will not delete any references in your own code. Any subsequent attempts to use an unregistered helper against the service name will raise an exception.If you register a new helper with the same service name and use a previous helper instance, you may encounter errors.
How are helper messages handled?
TheVoiceClientHelper base class requires that a helper define a handleMessage method.
Any RTVI messages received from the transport that does not match native voice client message types are passed through to your client’s registered helpers:
Writing helpers
Creating your own helper classes can be useful when you want to create reusable code that targets a specific service (or series of services.) The abstractVoiceClientHelper class is intentionally lightweight to provide as much flexibility to the developer as needed.
A typical helper definition will likely include:
- A constructor
- Callback methods
- Event and message types