Promise<void>
Connect to a real-time session with your bot. This method sends a web request baseUrl
+ endpoints.connect
and passes the response your transport class.
A server-side connect endpoint will typically:
connect()
asynchronously will resolve when the bot and client signal
that they are ready. See messages and events. If you want to
call connect()
without await
, you can use the onBotReady
callback or
BotReady
event to know when you can interact with the bot.connect()
when the transport is not in a ‘connected’
state will throw an error. You should disconnect from a session
first before attempting to connect again.Promise<RTVIClientConfigOption[]>
Returns a Promise that resolves with the bot’s current configuration.
rtviClient.getConfig
. This property is hydrated with the bot’s config after connect()
is called, and after any updateConfig
request.
Promise<RTVIMessage>
Update the bot’s config. Passing a partial config is fine. Only the individual options that are passed to the updateConfig()
call will be updated. You can omit any services or options within a service that you don’t want to change.
Returns a Promise that resolves with the full updated configuration.
On resolve, will trigger the onConfigUpdate
callback and ConfigUpdated
event.
On reject, will trigger the onMessageError
callback and MessageError
event.
rtviClientConfigOption[]
partial object with the new configurationPromise<unknown>
Describe the shape of available config options for the bot the client is connected to.
Returns a Promise that resolve’s with the bot’s configuration description.
rtviClientConfigOption | undefined
Config helper method that returns configuration options for specified service key.
If connected, this method will first call getConfig
to get the latest config from the bot. If not connected, it will expect a config
array to be passed.
llm
RTVIClientConfigOption[]
to query (vs. using remote config). This
can be useful when working with configuration arrays before connecting to a
bot.Returns new instance (copy) of the service options array.unknown | undefined
Returns configuration option value (unknown) for specified service key and option name. As with getServiceOptionsFromConfig
, this method will first call getConfig
to get the latest config from the bot if connected, or expect a config
array to be passed.
llm
model
RTVIClientConfigOption[]
to query (vs. using remote config). This
can be useful when working with configuration arrays before connecting to a
bot.Returns new instance (copy) of the service options array.Promise<RTVIClientConfigOption[] | undefined>
Config helper method that sets a new value for a service option in the config. Returns new instance of config with updated option(s) for specified service key and option name.
Note: does not update current config, only returns a new object (call updateConfig to apply changes).
llm
getConfig
config.ConfigOption
object…
ConfigOption
objects.
getConfig
to get the latest config from the bot if in ready state. Returns new instance (copy) of the client config.
Promise<RTVIClientConfigOption[]>
Config helper method that sets new values for multiple service options in the config.
Convenience method for calling setServiceOptionInConfig
multiple times.
You can pass an optional config object to update, otherwise calls getConfig
to get the latest config from the bot if in ready state. Returns new instance (copy) of the client config.
Note: does not update current config, only returns a new object (call updateConfig to apply changes).
getConfig
to get the latest
bot configuration.)RTVIMessage
data object to the bot.
See: messages and events.
RTVIMessage
object containing the type of message and data object to
dispatch.Promise<unknown>
Describe the actions implemented by the bot that the client is connected to.
Returns a Promise that resolves with the bot’s actions description.
Promise<RTVIActionResponse>
Dispatch an action message to the bot.
What actions a bot responds to depend on on how your bot has been configured. RTVI defines an actions protocol, but does not define any specific actions. Helper libraries will often install convenience methods that make it less verbose (and more type-safe) to call actions.
Promise<RTVIActionResponse>
.connect()
to test and switch between camera and microphone sources.
MediaDeviceInfo[]
.
MediaDeviceInfo[]
.
micId
, which should map a deviceId
in the list returned from getAllMics()
.
camId
, which should map a deviceId
in the list returned from getAllCams()
.
MediaStreamTrack
objects for both the client and the bot.