Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 10
S2S: Speech-to-Speech with File Search in a Single API Call#643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
9ac86ea6451bb0c9f94e2fb18356baaac955177bfb2fb81b1113488aa62c433642146550acc8c19d6f58e04c3749cc5cf8f7797d14624f555b9a4e9c1807dfe7de7979eeb99956920b196ea78e714b60efa4e48e96540dcd0b68f6204b30fe67b5abc0e0ac7f4cb66b5f3b1fc762037c63114ead6930414c94e2849f3a32cde14dc28f6d876dc496ce7b7e20fdf30e0375ee81a82d701474e22eFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,236 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Speech-to-Speech (STS) with RAG | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Execute a complete speech-to-speech workflow with knowledge base retrieval. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Endpoint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ```http | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| POST /llm/chain/sts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Flow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ```text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Voice Input → STT (auto language) → RAG (Knowledge Base) → TTS → Voice Output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Input | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - **Voice note**: WhatsApp-compatible audio format (required) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - **Knowledge base IDs**: One or more knowledge bases for RAG (required) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - **Languages**: Input and output languages (optional, defaults to Hindi) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - **Models**: STT, LLM, and TTS model selection (optional, defaults to Sarvam) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You will receive **3 callbacks** to your webhook URL: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1. **STT Callback** (Intermediate): Transcribed text from audio | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2. **LLM Callback** (Intermediate): RAG-enhanced response text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3. **TTS Callback** (Final): Audio output + response text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Each callback includes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Output from that step | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Token usage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Latency information (check timestamps) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Supported Languages | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Primary Indian Languages | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - English, Hindi, Hinglish (code-switching) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Bengali, Kannada, Malayalam, Marathi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Odia, Punjabi, Tamil, Telugu, Gujarati | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Additional Languages (Sarvam Saaras V3) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Assamese, Urdu, Nepali | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Konkani, Kashmiri, Sindhi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Sanskrit, Santali, Manipuri | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Bodo, Maithili, Dogri | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| **Total: 25 languages** with automatic language detection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Available Models | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### STT (Speech-to-Text) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `saaras:v3` - Sarvam Saaras V3 (**default**, fast, auto language detection, optimized for Indian languages) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `gemini-2.5-pro` - Google Gemini 2.5 Pro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| **Note:** Sarvam STT uses automatic language detection. No need to specify input language. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### LLM (RAG) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Any OpenAI Responses-API model that supports `file_search` can be used for the RAG block by passing it inline via `rag.params.model`. Common choices: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `gpt-4o` - OpenAI GPT-4o (**default**, best quality) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `gpt-4o-mini` - OpenAI GPT-4o Mini (faster, lower cost) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `gpt-4.1`, `gpt-4.1-mini` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `gpt-5`, `gpt-5-mini` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `o3`, `o4-mini` (reasoning models) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| The endpoint does not restrict the model list; provider-side validation gates unsupported choices. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### TTS (Text-to-Speech) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `bulbul:v3` - Sarvam Bulbul V3 (**default**, natural Indian voices, MP3 output) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `gemini-2.5-pro-preview-tts` - Google Gemini 2.5 Pro (OGG OPUS output) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Edge Cases & Error Handling | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Empty STT Output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| If speech-to-text returns empty/blank: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Chain fails immediately | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Error message: "STT returned no transcription" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - No subsequent blocks are executed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Audio Size Limit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WhatsApp limit: 16MB | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - TTS providers may fail if output exceeds limit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Error is caught and reported in callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Consider using shorter responses or compression | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Invalid Audio Format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| If input audio format is unsupported: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - STT provider fails with format error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Error reported in callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Supported: MP3, WAV, OGG, OPUS, M4A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Provider Failures | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Each block has independent error handling: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - STT fails → Chain stops, STT error reported | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - LLM fails → Chain stops, RAG error reported | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - TTS fails → Chain stops, TTS error reported | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Example Request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| curl -X POST https://api.kaapi.ai/llm/chain/sts \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -H "Authorization: Bearer YOUR_API_KEY" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -H "Content-Type: application/json" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -d @- <<EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "query": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "type": "audio", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "content": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "format": "base64", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "value": "base64_encoded_audio_data", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "mime_type": "audio/ogg" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "knowledge_base_ids": ["kb_abc123"], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "input_language": "hindi", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "output_language": "english", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "callback_url": "https://your-app.com/webhook" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| **Note:** `stt_model`, `llm_model`, and `tts_model` are optional and will use defaults if not specified. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Example Callbacks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Callback 1: STT Output (Intermediate) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ```json | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "success": true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "data": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "block_index": 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "total_blocks": 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "response": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "provider_response_id": "stt_xyz789", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "provider": "sarvamai-native", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "model": "saarika:v1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "output": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "type": "text", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "content": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "value": "नमस्ते, मुझे अपने अकाउंट के बारे में जानकारी चाहिए" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "usage": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "input_tokens": 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "output_tokens": 12, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "total_tokens": 12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "speech_to_speech": true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "input_language": "hi-IN" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+130
to
+159
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. STT callback example shows incorrect model name. Line 132 shows 📝 Proposed fix "response": {
"provider_response_id": "stt_xyz789",
"provider": "sarvamai-native",
- "model": "saarika:v1",+ "model": "saaras:v3",
"output": {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Callback 2: LLM Output (Intermediate) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ```json | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "success": true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "data": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "block_index": 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "total_blocks": 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "response": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "provider_response_id": "chatcmpl_abc123", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "provider": "openai", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "model": "gpt-4o", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "output": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "type": "text", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "content": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "value": "आपके अकाउंट में कुल बैलेंस ₹5,000 है। पिछले महीने में 3 ट्रांजैक्शन हुए हैं।" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "usage": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "input_tokens": 150, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "output_tokens": 45, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "total_tokens": 195 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "speech_to_speech": true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Callback 3: TTS Output (Final) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ```json | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "success": true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "data": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "response": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "provider_response_id": "tts_def456", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "provider": "sarvamai-native", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "model": "bulbul:v1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "output": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "type": "audio", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "content": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "format": "base64", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "value": "base64_encoded_audio_output", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "mime_type": "audio/ogg" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "usage": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "input_tokens": 15, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "output_tokens": 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "total_tokens": 15 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "speech_to_speech": true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "output_language": "hi-IN" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+191
to
+220
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TTS callback example shows incorrect model version. Line 191 shows 📝 Proposed fix "response": {
"provider_response_id": "tts_def456",
"provider": "sarvamai-native",
- "model": "bulbul:v1",+ "model": "bulbul:v3",
"output": {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Latency Tracking | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Calculate latency from callback timestamps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - **STT latency**: Time from request to first callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - **LLM latency**: Time between first and second callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - **TTS latency**: Time between second and third callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - **Total latency**: Time from request to final callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Best Practices | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1. **Language Consistency**: If not translating, keep input_language = output_language | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2. **Model Selection**: Use Sarvam models for Indian languages (faster, better quality) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3. **Knowledge Base**: Ensure KB is properly indexed and relevant to expected queries | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4. **Error Handling**: Implement retry logic for transient provider failures | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5. **Webhook Security**: Validate webhook signatures and use HTTPS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.