Tavus
- class pipecat.transports.services.tavus.TavusApi(api_key, session)[source]
Bases:
object
A helper class for interacting with the Tavus API (v2).
- Parameters:
api_key (str)
session (ClientSession)
- BASE_URL = 'https://tavusapi.com/v2'
- MOCK_CONVERSATION_ID = 'dev-conversation'
- MOCK_PERSONA_NAME = 'TestTavusTransport'
- async create_conversation(replica_id, persona_id)[source]
- Parameters:
replica_id (str)
persona_id (str)
- Return type:
dict
- async end_conversation(conversation_id)[source]
- Parameters:
conversation_id (str)
- async get_persona_name(persona_id)[source]
- Parameters:
persona_id (str)
- Return type:
str
- class pipecat.transports.services.tavus.TavusCallbacks(*, on_participant_joined, on_participant_left)[source]
Bases:
BaseModel
Callback handlers for the Tavus events.
- Parameters:
on_participant_joined (Callable[[Mapping[str, Any]], Awaitable[None]])
on_participant_left (Callable[[Mapping[str, Any], str], Awaitable[None]])
- on_participant_joined
Called when a participant joins.
- Type:
Callable[[Mapping[str, Any]], Awaitable[None]]
- on_participant_left
Called when a participant leaves.
- Type:
Callable[[Mapping[str, Any], str], Awaitable[None]]
- on_participant_joined: Callable[[Mapping[str, Any]], Awaitable[None]]
- on_participant_left: Callable[[Mapping[str, Any], str], Awaitable[None]]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pipecat.transports.services.tavus.TavusParams(*, camera_in_enabled=False, camera_out_enabled=True, camera_out_is_live=False, camera_out_width=1024, camera_out_height=768, camera_out_bitrate=800000, camera_out_framerate=30, camera_out_color_format='RGB', audio_out_enabled=True, audio_out_sample_rate=None, audio_out_channels=1, audio_out_bitrate=96000, audio_out_10ms_chunks=4, audio_out_mixer=None, audio_out_destinations=<factory>, audio_in_enabled=True, audio_in_sample_rate=None, audio_in_channels=1, audio_in_filter=None, audio_in_stream_on_start=True, audio_in_passthrough=True, video_in_enabled=False, video_out_enabled=False, video_out_is_live=False, video_out_width=1024, video_out_height=768, video_out_bitrate=800000, video_out_framerate=30, video_out_color_format='RGB', video_out_destinations=<factory>, vad_enabled=False, vad_audio_passthrough=False, vad_analyzer=None, turn_analyzer=None, api_url='https://api.daily.co/v1', api_key='', dialin_settings=None, microphone_out_enabled=False, transcription_enabled=False, transcription_settings=DailyTranscriptionSettings(language='en', model='nova-2-general', profanity_filter=True, redact=False, endpointing=True, punctuate=True, includeRawResponse=True, extra={'interim_results': True}))[source]
Bases:
DailyParams
Configuration parameters for the Tavus transport.
- Parameters:
camera_in_enabled (bool)
camera_out_enabled (bool)
camera_out_is_live (bool)
camera_out_width (int)
camera_out_height (int)
camera_out_bitrate (int)
camera_out_framerate (int)
camera_out_color_format (str)
audio_out_enabled (bool)
audio_out_sample_rate (int | None)
audio_out_channels (int)
audio_out_bitrate (int)
audio_out_10ms_chunks (int)
audio_out_mixer (BaseAudioMixer | Mapping[str | None, BaseAudioMixer] | None)
audio_out_destinations (List[str])
audio_in_enabled (bool)
audio_in_sample_rate (int | None)
audio_in_channels (int)
audio_in_filter (BaseAudioFilter | None)
audio_in_stream_on_start (bool)
audio_in_passthrough (bool)
video_in_enabled (bool)
video_out_enabled (bool)
video_out_is_live (bool)
video_out_width (int)
video_out_height (int)
video_out_bitrate (int)
video_out_framerate (int)
video_out_color_format (str)
video_out_destinations (List[str])
vad_enabled (bool)
vad_audio_passthrough (bool)
vad_analyzer (VADAnalyzer | None)
turn_analyzer (BaseTurnAnalyzer | None)
api_url (str)
api_key (str)
dialin_settings (DailyDialinSettings | None)
microphone_out_enabled (bool)
transcription_enabled (bool)
transcription_settings (DailyTranscriptionSettings)
- audio_in_enabled: bool
- audio_out_enabled: bool
- microphone_out_enabled: bool
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pipecat.transports.services.tavus.TavusTransportClient(*, bot_name, params=TavusParams(camera_in_enabled=False, camera_out_enabled=True, camera_out_is_live=False, camera_out_width=1024, camera_out_height=768, camera_out_bitrate=800000, camera_out_framerate=30, camera_out_color_format='RGB', audio_out_enabled=True, audio_out_sample_rate=None, audio_out_channels=1, audio_out_bitrate=96000, audio_out_10ms_chunks=4, audio_out_mixer=None, audio_out_destinations=[], audio_in_enabled=True, audio_in_sample_rate=None, audio_in_channels=1, audio_in_filter=None, audio_in_stream_on_start=True, audio_in_passthrough=True, video_in_enabled=False, video_out_enabled=False, video_out_is_live=False, video_out_width=1024, video_out_height=768, video_out_bitrate=800000, video_out_framerate=30, video_out_color_format='RGB', video_out_destinations=[], vad_enabled=False, vad_audio_passthrough=False, vad_analyzer=None, turn_analyzer=None, api_url='https://api.daily.co/v1', api_key='', dialin_settings=None, microphone_out_enabled=False, transcription_enabled=False, transcription_settings=DailyTranscriptionSettings(language='en', model='nova-2-general', profanity_filter=True, redact=False, endpointing=True, punctuate=True, includeRawResponse=True, extra={'interim_results': True})), callbacks, api_key, replica_id, persona_id='pipecat-stream', session)[source]
Bases:
object
A transport client that integrates a Pipecat Bot with the Tavus platform by managing conversation sessions using the Tavus API.
This client uses TavusApi to interact with the Tavus backend services. When a conversation is started via TavusApi, Tavus provides a roomURL that can be used to connect the Pipecat Bot into the same virtual room where the TavusBot is operating.
- Parameters:
bot_name (str) – The name of the Pipecat bot instance.
params (TavusParams) – Optional parameters for Tavus operation. Defaults to TavusParams().
callbacks (TavusCallbacks) – Callback handlers for Tavus-related events.
api_key (str) – API key for authenticating with Tavus API.
replica_id (str) – ID of the replica to use in the Tavus conversation.
persona_id (str) – ID of the Tavus persona. Defaults to “pipecat-stream”, which signals Tavus to use the TTS voice of the Pipecat bot instead of a Tavus persona voice.
session (aiohttp.ClientSession) – The aiohttp session for making async HTTP requests.
sample_rate – Audio sample rate to be used by the client.
- async setup(setup)[source]
- Parameters:
setup (FrameProcessorSetup)
- async cleanup()[source]
- async get_persona_name()[source]
- Return type:
str
- async start(frame)[source]
- Parameters:
frame (StartFrame)
- async stop()[source]
- async capture_participant_video(participant_id, callback, framerate=30, video_source='camera', color_format='RGB')[source]
- Parameters:
participant_id (str)
callback (Callable)
framerate (int)
video_source (str)
color_format (str)
- async capture_participant_audio(participant_id, callback, audio_source='microphone', sample_rate=16000, callback_interval_ms=20)[source]
- Parameters:
participant_id (str)
callback (Callable)
audio_source (str)
sample_rate (int)
callback_interval_ms (int)
- async send_message(frame)[source]
- Parameters:
frame (TransportMessageFrame | TransportMessageUrgentFrame)
- property out_sample_rate: int
- property in_sample_rate: int
- async send_interrupt_message()[source]
- Return type:
None
- async update_subscriptions(participant_settings=None, profile_settings=None)[source]
- async write_audio_frame(frame)[source]
- Parameters:
frame (OutputAudioRawFrame)
- async register_audio_destination(destination)[source]
- Parameters:
destination (str)
- class pipecat.transports.services.tavus.TavusInputTransport(client, params, **kwargs)[source]
Bases:
BaseInputTransport
- Parameters:
client (TavusTransportClient)
params (TransportParams)
- async setup(setup)[source]
- Parameters:
setup (FrameProcessorSetup)
- async cleanup()[source]
- async start(frame)[source]
- Parameters:
frame (StartFrame)
- async stop(frame)[source]
- Parameters:
frame (EndFrame)
- async cancel(frame)[source]
- Parameters:
frame (CancelFrame)
- async start_capturing_audio(participant)[source]
- class pipecat.transports.services.tavus.TavusOutputTransport(client, params, **kwargs)[source]
Bases:
BaseOutputTransport
- Parameters:
client (TavusTransportClient)
params (TransportParams)
- async setup(setup)[source]
- Parameters:
setup (FrameProcessorSetup)
- async cleanup()[source]
- async start(frame)[source]
- Parameters:
frame (StartFrame)
- async stop(frame)[source]
- Parameters:
frame (EndFrame)
- async cancel(frame)[source]
- Parameters:
frame (CancelFrame)
- async send_message(frame)[source]
- Parameters:
frame (TransportMessageFrame | TransportMessageUrgentFrame)
- async process_frame(frame, direction)[source]
- Parameters:
frame (Frame)
direction (FrameDirection)
- async write_audio_frame(frame)[source]
- Parameters:
frame (OutputAudioRawFrame)
- async register_audio_destination(destination)[source]
- Parameters:
destination (str)
- class pipecat.transports.services.tavus.TavusTransport(bot_name, session, api_key, replica_id, persona_id='pipecat-stream', params=TavusParams(camera_in_enabled=False, camera_out_enabled=True, camera_out_is_live=False, camera_out_width=1024, camera_out_height=768, camera_out_bitrate=800000, camera_out_framerate=30, camera_out_color_format='RGB', audio_out_enabled=True, audio_out_sample_rate=None, audio_out_channels=1, audio_out_bitrate=96000, audio_out_10ms_chunks=4, audio_out_mixer=None, audio_out_destinations=[], audio_in_enabled=True, audio_in_sample_rate=None, audio_in_channels=1, audio_in_filter=None, audio_in_stream_on_start=True, audio_in_passthrough=True, video_in_enabled=False, video_out_enabled=False, video_out_is_live=False, video_out_width=1024, video_out_height=768, video_out_bitrate=800000, video_out_framerate=30, video_out_color_format='RGB', video_out_destinations=[], vad_enabled=False, vad_audio_passthrough=False, vad_analyzer=None, turn_analyzer=None, api_url='https://api.daily.co/v1', api_key='', dialin_settings=None, microphone_out_enabled=False, transcription_enabled=False, transcription_settings=DailyTranscriptionSettings(language='en', model='nova-2-general', profanity_filter=True, redact=False, endpointing=True, punctuate=True, includeRawResponse=True, extra={'interim_results': True})), input_name=None, output_name=None)[source]
Bases:
BaseTransport
Transport implementation for Tavus video calls.
When used, the Pipecat bot joins the same virtual room as the Tavus Avatar and the user. This is achieved by using TavusTransportClient, which initiates the conversation via TavusApi and obtains a room URL that all participants connect to.
- Parameters:
bot_name (str) – The name of the Pipecat bot.
session (aiohttp.ClientSession) – aiohttp session used for async HTTP requests.
api_key (str) – Tavus API key for authentication.
replica_id (str) – ID of the replica model used for voice generation.
persona_id (str) – ID of the Tavus persona. Defaults to “pipecat-stream” to use the Pipecat TTS voice.
params (TavusParams) – Optional Tavus-specific configuration parameters.
input_name (Optional[str]) – Optional name for the input transport.
output_name (Optional[str]) – Optional name for the output transport.
- async update_subscriptions(participant_settings=None, profile_settings=None)[source]
- input()[source]
- Return type:
FrameProcessor
- output()[source]
- Return type:
FrameProcessor