Gandr TTS in a Haystack pipeline.
One pip install, one component, and any Haystack pipeline can speak its answer.
The whole integration
Install, construct, add to the pipeline.
pip install gandr-haystack
from gandr_haystack import GandrTTS
tts = GandrTTS(voice="gandr-mia")
The component fits a standard Haystack pipeline. The key comes from GANDR_API_KEY.
What it needs
What it takes
| One package | pip install gandr-haystack |
| A key | GANDR_API_KEY in the environment |
| Haystack | Any recent version with pipeline components |
| Python | 3.9 or newer |
Speech as a pipeline component
Haystack pipelines are explicit graphs: documents in, answers out. GandrTTS slots in as a component at the end of the graph, so a pipeline that retrieves and answers can speak its result without an extra service.
The component fits a standard Haystack pipeline and reads its key from GANDR_API_KEY. The voice is set at construction.
What the flat stream changes
A retrieval pipeline can answer many queries in a day, and speaking every one of them is a bill on a per-character meter. On a flat stream the pipeline talks as much as the work needs and nothing is counted.
- A component, not a sidecar service
- One stream carries the whole pipeline workload
- No per-character meter on spoken answers
Notes
Where in the pipeline does the TTS component go?
At the end, after the answer is produced. It takes the text and returns audio in place.
Which voice does the component use?
Whatever gandr- voice id you pass at construction, for example GandrTTS(voice="gandr-mia").