|
Pipecat C++ Client SDK 1.0.0
Connect native apps to Pipecat bots
|
#include <pipecat/client.h>
Public Member Functions | |
Connection | |
| virtual void | on_transport_state_changed (TransportState) |
| The connection state changed. | |
| virtual void | on_connected () |
| The client connected. The bot isn't ready yet, see on_bot_ready(). | |
| virtual void | on_disconnected () |
| The client disconnected. | |
| virtual void | on_error (const rtvi::ErrorData &) |
Bot and participants | |
| virtual void | on_bot_started (const nlohmann::json &) |
The bot was started. response is what the start endpoint answered. | |
| virtual void | on_bot_connected (const Participant &) |
| The bot joined the session. | |
| virtual void | on_bot_ready (const rtvi::BotReadyData &) |
| The bot is ready to talk. | |
| virtual void | on_bot_disconnected (const Participant &) |
| The bot left the session. | |
| virtual void | on_participant_joined (const Participant &) |
| Someone other than the bot joined the session. | |
| virtual void | on_participant_left (const Participant &) |
| Someone other than the bot left the session. | |
Messages | |
| virtual void | on_server_message (const nlohmann::json &) |
| The bot sent an app-defined message. | |
| virtual void | on_message_error (const rtvi::ErrorData &) |
| The bot couldn't handle a message from the client. | |
| virtual void | on_metrics (const rtvi::MetricsData &) |
| The bot sent performance metrics. | |
| virtual void | on_unhandled_message (const rtvi::Message &) |
Speaking | |
| virtual void | on_user_started_speaking () |
| The user started speaking. | |
| virtual void | on_user_stopped_speaking () |
| The user stopped speaking. | |
| virtual void | on_bot_started_speaking () |
| The bot started speaking. | |
| virtual void | on_bot_stopped_speaking () |
| The bot stopped speaking. | |
| virtual void | on_bot_interrupted () |
| virtual void | on_user_mute_started () |
| virtual void | on_user_mute_stopped () |
| The bot stopped ignoring user audio. | |
Transcription and output | |
| virtual void | on_user_transcript (const rtvi::TranscriptData &) |
| What the user said. It can arrive several times, until it's final. | |
| virtual void | on_user_llm_text (const rtvi::UserLLMTextData &) |
| User text was sent to the bot's LLM. | |
| virtual void | on_bot_output (const rtvi::BotOutputData &) |
| What the bot says or outputs. | |
LLM | |
| virtual void | on_bot_llm_started () |
| The bot's LLM started responding. | |
| virtual void | on_bot_llm_stopped () |
| The bot's LLM finished responding. | |
| virtual void | on_bot_llm_text (const rtvi::BotLLMTextData &) |
| Text from the bot's LLM, as it streams. | |
| virtual void | on_bot_llm_search_response (const rtvi::BotLLMSearchResponseData &) |
| Search results used by the bot's LLM. | |
Function calls | |
| virtual void | on_llm_function_call_started (const rtvi::LLMFunctionCallStartedData &) |
| The bot's LLM started a function call. | |
| virtual void | on_llm_function_call_in_progress (const rtvi::LLMFunctionCallInProgressData &, FunctionCallResultCallback) |
| virtual void | on_llm_function_call_stopped (const rtvi::LLMFunctionCallStoppedData &) |
| A function call finished or was cancelled. | |
Text-to-speech | |
| virtual void | on_bot_tts_started () |
| The bot's text-to-speech started. | |
| virtual void | on_bot_tts_stopped () |
| The bot's text-to-speech stopped. | |
| virtual void | on_bot_tts_text (const rtvi::BotTTSTextData &) |
| Text the bot is speaking. | |
Receives events from the client. Override the ones you need.
Callbacks run one at a time and in order, on the client's own thread. You can call any client method from them, including disconnect(). Keep them short, because other events wait while one runs. Callbacks must not throw, and must not destroy the client.
|
inlinevirtual |
The bot was interrupted, e.g. because the user spoke over it. Drop any bot audio you haven't played yet.
|
inlinevirtual |
Something went wrong in the bot or the client, e.g. the bot sent an invalid message.
|
inlinevirtual |
The bot's LLM called a function. If your app runs it, call respond with the result. For slow work, call it later, e.g. from another thread, so other events don't wait. Calls to functions the bot runs itself also arrive here: don't call respond for them.
|
inlinevirtual |
The bot sent a message the client doesn't handle, e.g. a newer type of message.
|
inlinevirtual |
The bot started ignoring user audio, e.g. while it speaks. Keep sending audio as usual.