Files
pipecat/examples/phone-chatbot/bot_definitions.py
Dominic Stewart 1ba037865b Call Transfer demo (#1348)
* Updated code to dial out to an operator, keep track of operator conversation while escalated and then return to conversation when finished

* Removed unnecessary imports

* Updated bot runner code, added call routing file and then updated the call transfer and voicemail detection examples

* Updated the bot files

* Made prompt one level higher in the body and an array

* Updated call transfer examples to work correctly

* Updated gemini voicemail detection example to work

* Added twilio bot support back to the bot_runner

* Moved some state management, participant management and other logic to the helper file.

* Updated comments

* Updated env and requirements file

* Ran the examples and made sure code works. Still need to work on the prompts a bit

* Fixed format issue

* Add support to disable summary in call transfer

* Added support for operator transfer mode

* Updated readme file

* Updated readme based on feedback, and handling of various properties in the json to be more flexible for future examples

* Updated number of endpoints

* Updated readme to remove fly deployment text and replaced with Pipecat Cloud

* Starting to tweak function calls and prompts

* Updated examples to more consistently call the functions and say what they need to say

* Updated examples

* Updated examples

* Updated examples to work correctly

* Add simple bot versions of dialin and dialout

* Refactored the bot runner file to make adding future examples easier

* Based on feedback, removed examples for multiple LLMs and also adjusted voicemail detection code to be simpler

* Made sure to only capture the users transcription once

* Updated readme with latest changes

* Forgot to update the order of examples in one place

* Fixed formatting issue

* Adjusted based on james feedback

* Changed default_mode to default_calltransfer_mode
2025-04-03 09:03:23 +09:00

56 lines
1.7 KiB
Python

# bot_definitions.py
"""Definitions of different bot types for the bot registry."""
from bot_registry import BotRegistry, BotType
from bot_runner_helpers import (
create_call_transfer_settings,
create_simple_dialin_settings,
create_simple_dialout_settings,
)
# Create and configure the bot registry
bot_registry = BotRegistry()
# Register bot types
bot_registry.register(
BotType(
name="call_transfer",
settings_creator=create_call_transfer_settings,
required_settings=["dialin_settings"],
incompatible_with=["simple_dialin", "simple_dialout", "voicemail_detection"],
auto_add_settings={"dialin_settings": {}},
)
)
bot_registry.register(
BotType(
name="simple_dialin",
settings_creator=create_simple_dialin_settings,
required_settings=["dialin_settings"],
incompatible_with=["call_transfer", "simple_dialout", "voicemail_detection"],
auto_add_settings={"dialin_settings": {}},
)
)
bot_registry.register(
BotType(
name="simple_dialout",
settings_creator=create_simple_dialout_settings,
required_settings=["dialout_settings"],
incompatible_with=["call_transfer", "simple_dialin", "voicemail_detection"],
auto_add_settings={"dialout_settings": [{}]},
)
)
bot_registry.register(
BotType(
name="voicemail_detection",
settings_creator=lambda body: body.get(
"voicemail_detection", {}
), # No creator function in original code
required_settings=["dialout_settings"],
incompatible_with=["call_transfer", "simple_dialin", "simple_dialout"],
auto_add_settings={"dialout_settings": [{}]},
)
)