#explain in detail all the client events of the conversationala ai agent

1 messages · Page 1 of 1 (latest)

viral widgetBOT
#
AI-generated Answer for borja_08472

The Conversational AI SDK provides several optional callbacks that can be registered when starting a session with the startSession method. These callbacks allow you to handle various events during the conversation. Here are the details of each client event:

  1. onConnect: This handler is called when the conversation's websocket connection is successfully established. It allows you to perform any setup or initialization tasks once the connection is ready.

  2. onDisconnect: This handler is triggered when the websocket connection is closed. You can use this to clean up resources or notify users that the session has ended.

  3. onMessage: This event is fired when a new text message is received. The messages can be tentative or final transcriptions of the user's voice or replies produced by the language model. This is primarily used for handling conversation transcription.

  4. onError: This handler is called when an error occurs during the session. It allows you to manage errors gracefully and provide feedback to the user.

  5. onStatusChange: This event is triggered whenever the connection status changes. The possible statuses are connected, connecting, and disconnected. This can be useful for updating the user interface to reflect the current connection state.

  6. onModeChange: This handler is called when the agent's mode changes, such as switching from speaking to listening or vice versa. It helps in managing the flow of the conversation and updating the UI accordingly.

These callbacks provide a comprehensive way to manage and respond to different events during a conversation session with the AI agent.

honest geyser
#

i mean like interrupt, audio, etc