Pipecat Integration
Pipecat is an open-source framework for building real-time voice and multimodal AI agents. The Pinch Pipecat plugin allows developers to add real-time voice translation directly into Pipecat pipelines.
Prerequisites
Before using the Pinch Pipecat plugin, ensure you have:
- Python 3.10+
- A Pinch API key
- Pipecat installed
You can generate an API key from the Pinch Developer Portal >
Installation
Install the Pinch Pipecat plugin (installs the required dependencies):
pip install pipecat-plugins-pinch
If you plan to run the Daily transport example:
pip install "pipecat-ai[daily]" python-dotenv
Usage
The following example adds Pinch translation to a Pipecat pipeline.
from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.runner import PipelineRunner
from pipecat.plugins.pinch import PinchTranslatorService, TranslatorOptions
translator = PinchTranslatorService(
options=TranslatorOptions(
source_language="en-US",
target_language="es-ES"
)
)
pipeline = Pipeline([
translator
])
runner = PipelineRunner()
runner.run(pipeline)
This pipeline receives speech in English and outputs translated speech in Spanish.
Running the Example
The git repository includes a working example that demonstrates real-time translation using the Daily transport.
Install required dependencies:
pip install "pipecat-ai[daily]" python-dotenv
Run the example:
python examples/daily_basic.py
Translator Configuration
The TranslatorOptions class allows you to configure translation behavior.
| Option | Description |
|---|---|
source_language | Language of the incoming speech |
target_language | Language to translate into |
voice_type | Output voice mode (e.g. cloned voice) |
Example configuration:
TranslatorOptions(
source_language="en-US",
target_language="fr-FR",
voice_type="clone"
)