Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.praison.ai/llms.txt

Use this file to discover all available pages before exploring further.

speech

Method
This is a method of the AudioAgent class in the audio_agent module.
Convert text to speech.

Signature

def speech(text: str, output: Optional[str], voice: Optional[str], speed: Optional[float], response_format: Optional[str], model: Optional[str]) -> Any

Parameters

text
str
required
Text to convert to speech
output
Optional
Path to save audio file (optional)
voice
Optional
Voice to use (e.g., “alloy”, “echo”, “fable”)
speed
Optional
Speech speed (0.25 to 4.0)
response_format
Optional
Audio format (mp3, opus, aac, flac, wav)
model
Optional
Override model for this call **kwargs: Additional provider-specific parameters

Returns

Returns
Any
Audio response object with stream_to_file() method

Usage

agent = AudioAgent(llm="openai/tts-1")
    agent.speech("Hello world!", output="hello.mp3")

Uses

  • speech
  • response.stream_to_file
  • Path

Used By

Source

View on GitHub

praisonaiagents/agent/audio_agent.py at line 213