diff --git a/examples/bot-ready-signalling/README.md b/examples/bot-ready-signalling/README.md new file mode 100644 index 000000000..668b95124 --- /dev/null +++ b/examples/bot-ready-signalling/README.md @@ -0,0 +1,45 @@ +# Bot ready signaling + +A simple Pipecat example demonstrating how to handle signaling between the client and the bot, +ensuring that the bot starts sending audio only when the client is available, +thereby avoiding the risk of cutting off the beginning of the audio. + +## Quick Start + +### First, start the bot server: + +1. Navigate to the server directory: + ```bash + cd server + ``` +2. Create and activate a virtual environment: + ```bash + python3 -m venv venv + source venv/bin/activate # On Windows: venv\Scripts\activate + ``` +3. Install requirements: + ```bash + pip install -r requirements.txt + ``` +4. Copy env.example to .env and configure: + - Add your API keys +5. Start the server: + ```bash + python server.py + ``` + +### Next, connect using the client app: + +For client-side setup, refer to the [JavaScript Guide](client/javascript/README.md). + +## Important Note + +Ensure the bot server is running before using any client implementations. + +## Requirements + +- Python 3.10+ +- Node.js 16+ (for JavaScript) +- Daily API key +- Cartesia API key +- Modern web browser with WebRTC support \ No newline at end of file diff --git a/examples/bot-ready-signalling/server/README.md b/examples/bot-ready-signalling/server/README.md new file mode 100644 index 000000000..0cfa6f14c --- /dev/null +++ b/examples/bot-ready-signalling/server/README.md @@ -0,0 +1,50 @@ +# Bot ready signaling Server + +A FastAPI server that manages bot instances and provide endpoint for Pipecat client connections. + +## Endpoints + +- `POST /connect` - Pipecat client connection endpoint + +## Environment Variables + +Copy `env.example` to `.env` and configure: + +```ini +# Required API Keys +DAILY_API_KEY= # Your Daily API key +CARTESIA_API_KEY= # Your Cartesia API key + +# Optional Configuration +DAILY_API_URL= # Optional: Daily API URL (defaults to https://api.daily.co/v1) +DAILY_SAMPLE_ROOM_URL= # Optional: Fixed room URL for development +HOST= # Optional: Host address (defaults to 0.0.0.0) +FAST_API_PORT= # Optional: Port number (defaults to 7860) +``` + +## Running the Server + +Set up and activate your virtual environment: + +```bash +python3 -m venv venv +source venv/bin/activate # On Windows: venv\Scripts\activate +``` + +Install dependencies: + +```bash +pip install -r requirements.txt +``` + +If you want to use the local version of `pipecat` in this repo rather than the last published version, also run: + +```bash +pip install --editable "../../../[daily,cartesia]" +``` + +Run the server: + +```bash +python server.py +``` diff --git a/examples/bot-ready-signalling/server/env.example b/examples/bot-ready-signalling/server/env.example new file mode 100644 index 000000000..43f083495 --- /dev/null +++ b/examples/bot-ready-signalling/server/env.example @@ -0,0 +1,3 @@ +DAILY_SAMPLE_ROOM_URL=https://yourdomain.daily.co/yourroom # (for joining the bot to the same room repeatedly for local dev) +DAILY_API_KEY= +CARTESIA_API_KEY= \ No newline at end of file diff --git a/examples/bot-ready-signalling/server/requirements.txt b/examples/bot-ready-signalling/server/requirements.txt new file mode 100644 index 000000000..0bcd59302 --- /dev/null +++ b/examples/bot-ready-signalling/server/requirements.txt @@ -0,0 +1,4 @@ +python-dotenv +fastapi[all] +uvicorn +pipecat-ai[daily,cartesia]