sarvam-mcp
Version:
An MCP server exposing Sarvam AI tools and a documentation retriever.
139 lines (112 loc) • 4.06 kB
Markdown
Given an audio file of a call between two parties and a list of questions, This API analyzes the content and returns the transcript, along with responses to the questions. Each response is supported by reasoning and exact phrases extracted from the transcript.
⚠️ Important: Please use Batch API Notebook for call recordings more than 30 seconds.
Duration Guidelines:
Files under 30 seconds: Use this direct API endpoint
Files over 30 seconds: Use our Batch API (required)
Resources:
Interactive Demo: Try Call Analytics Playground
Batch API Documentation: View Notebook
Headers
api-subscription-key
string
Required
Request
This endpoint expects a multipart form containing a file.
file
file
Required
The audio file to be analyzed. Must be passed as a form input if using multipart/form-data. Supported formats are WAV (.wav) and MP3 (.mp3). Optimal sample rate is 16kHz. Multi-channel audio will be merged to mono. File size must be less than 10MB and audio duration must not exceed 600 seconds (10 minutes).
questions
string
Required
List of questions to be answered based on the call content. Each question should be a valid JSON object with the following structure: {id: string, text: string, description: string (optional), type: string, properties: object}. The type field must be one of: boolean, enum, short answer, long answer, or number. For enum type questions, include an ‘options’ list in the properties.
hotwords
string
Optional
Optional comma-separated string of keywords specific to your domain. These keywords will be preserved as-is in the transcript.
model
enum
Optional
Model to be used for converting speech to text in target language
Allowed values:
saaras:v1
saaras:v2
saaras:turbo
saaras:flash
Response
Successful Response
transcript
string
Full transcript of the call generated by Sarvam’s inhouse speech-to-text model.
request_id
string
Optional
file_name
string
Optional
Unique identifier for the analyzed audio file.
answers
list of objects
Optional
List of answers to predefined questions, derived from the call analysis. It can be null if no valid answers were generated.
Show 5 properties
duration_in_seconds
double
Optional
Duration of the analyzed call in seconds.
language_code
enum
Optional
This will return the BCP-47 code of language spoken in the input. If multiple languages are detected, this will return language code of most predominant spoken language. If no language is detected, this will be null
Show 11 enum values
diarized_transcript
object
Optional
Diarized transcript of the provided speech
Show 1 properties
Errors
400
Analytics Call Request Bad Request Error
403
Analytics Call Request Forbidden Error
422
Analytics Call Request Unprocessable Entity Error
429
Analytics Call Request Too Many Requests Error
500
Analytics Call Request Internal Server Error
503
Analytics Call Request Service Unavailable Error
POST
/call-analytics
curl -X POST https://api.sarvam.ai/call-analytics \
-H "api-subscription-key: <apiSubscriptionKey>" \
-H "Content-Type: multipart/form-data" \
-F file=@<file1> \
-F questions="questions"
{
"transcript": "Agent: Thank you for calling customer support. How may I assist you today?\nCustomer: Hi, I'm having issues with my internet connection. It keeps cutting out.\nAgent: I'm sorry to hear that. Let's troubleshoot this issue...",
"request_id": "request_id",
"file_name": "call_20230901_123456.mp3",
"answers": [
{
"id": "q001",
"question": "What was the main issue discussed in the call?",
"reasoning": "The customer repeatedly mentioned issues with their internet connection.",
"response": "INTERNET_ISSUES",
"utterance": "My internet keeps cutting out every few minutes. It's really frustrating."
}
],
"duration_in_seconds": 180.5,
"language_code": "hi-IN",
"diarized_transcript": {
"entries": [
{
"transcript": "transcript",
"start_time_seconds": 1.1,
"end_time_seconds": 1.1,
"speaker_id": "speaker_id"
}
]
}
}