Audio
Voice input and output for agents
Enable voice interaction with AudioAgent for speech-to-text and text-to-speech.
Quick Start
- Create Voice-Enabled Agent
rust use praisonai::{AudioAgent, AudioConfig}; // Configure audio settings let config = AudioConfig::new() .speech_to_text(true) .text_to_speech(true) .voice("alloy"); // Create AudioAgent (specialized agent with audio capabilities) let audio_agent = AudioAgent::new() .name("Voice Assistant") .instructions("You are a helpful voice assistant") .config(config) .build()?; // Process audio input let response = audio_agent.process_audio("path/to/audio.wav").await?; - Text-to-Speech Output
rust use praisonai::{AudioAgent, AudioConfig}; let config = AudioConfig::new() .text_to_speech(true) .voice("nova"); // Choose voice let agent = AudioAgent::new() .name("Speaker") .config(config) .build()?; // Generate speech from text let audio_bytes = agent.speak("Hello, how can I help?").await?;
AudioConfig
| Option | Type | Default | Description |
|---|---|---|---|
speech_to_text | bool | false | Enable voice input |
text_to_speech | bool | false | Enable voice output |
voice | String | alloy | Voice selection |
Available Voices
| Voice | Style |
|---|---|
alloy | Professional, balanced |
nova | Warm, conversational |
echo | Clear, articulate |
onyx | Deep, authoritative |