Merge pull request #406 from pipecat-ai/hush/cartesiaDocs

Hush/cartesia docs
This commit is contained in:
Aleix Conchillo Flaqué
2024-08-20 11:17:52 -07:00
committed by GitHub
2 changed files with 9 additions and 17 deletions

View File

@@ -25,14 +25,7 @@ jobs:
id: setup_python id: setup_python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: '3.10' python-version: "3.10"
- name: Cache virtual environment
uses: actions/cache@v3
with:
# We are hashing requirements-dev.txt and requirements-extra.txt which
# contain all dependencies needed to run the tests and examples.
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('linux-py3.10-requirements.txt') }}-${{ hashFiles('dev-requirements.txt') }}
path: .venv
- name: Install system packages - name: Install system packages
run: sudo apt-get install -y portaudio19-dev run: sudo apt-get install -y portaudio19-dev
- name: Setup virtual environment - name: Setup virtual environment
@@ -42,7 +35,7 @@ jobs:
run: | run: |
source .venv/bin/activate source .venv/bin/activate
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r linux-py3.10-requirements.txt -r dev-requirements.txt pip install -r dev-requirements.txt
- name: Test with pytest - name: Test with pytest
run: | run: |
source .venv/bin/activate source .venv/bin/activate

View File

@@ -49,7 +49,7 @@ Your project may or may not need these, so they're made available as optional re
## A simple voice agent running locally ## A simple voice agent running locally
Here is a very basic Pipecat bot that greets a user when they join a real-time session. We'll use [Daily](https://daily.co) for real-time media transport, and [ElevenLabs](https://elevenlabs.io/) for text-to-speech. Here is a very basic Pipecat bot that greets a user when they join a real-time session. We'll use [Daily](https://daily.co) for real-time media transport, and [Cartesia](https://cartesia.ai/) for text-to-speech.
```python ```python
#app.py #app.py
@@ -61,7 +61,7 @@ from pipecat.frames.frames import EndFrame, TextFrame
from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.task import PipelineTask from pipecat.pipeline.task import PipelineTask
from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.runner import PipelineRunner
from pipecat.services.elevenlabs import ElevenLabsTTSService from pipecat.services.cartesia import CartesiaTTSService
from pipecat.transports.services.daily import DailyParams, DailyTransport from pipecat.transports.services.daily import DailyParams, DailyTransport
async def main(): async def main():
@@ -73,11 +73,10 @@ async def main():
bot_name="Bot Name", bot_name="Bot Name",
params=DailyParams(audio_out_enabled=True)) params=DailyParams(audio_out_enabled=True))
# Use Eleven Labs for Text-to-Speech # Use Cartesia for Text-to-Speech
tts = ElevenLabsTTSService( tts = CartesiaTTSService(
aiohttp_session=session, api_key=...,
api_key=..., voice_id=...
voice_id=...,
) )
# Simple pipeline that will process text to speech and output the result # Simple pipeline that will process text to speech and output the result
@@ -94,7 +93,7 @@ async def main():
@transport.event_handler("on_participant_joined") @transport.event_handler("on_participant_joined")
async def on_new_participant_joined(transport, participant): async def on_new_participant_joined(transport, participant):
participant_name = participant["info"]["userName"] or '' participant_name = participant["info"]["userName"] or ''
# Queue a TextFrame that will get spoken by the TTS service (Eleven Labs) # Queue a TextFrame that will get spoken by the TTS service (Cartesia)
await task.queue_frames([TextFrame(f"Hello there, {participant_name}!"), EndFrame()]) await task.queue_frames([TextFrame(f"Hello there, {participant_name}!"), EndFrame()])
# Run the pipeline task # Run the pipeline task