POST
/
text-analytics
curl --request POST \
  --url https://api.sarvam.ai/text-analytics \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data 'text=Climate change is a critical global challenge that demands immediate attention. Rising temperatures, extreme weather events, and sea level rise are just a few of the consequences we'\''re already experiencing. Scientists emphasize the urgency of limiting global warming to 1.5°C above pre-industrial levels to avoid the most severe consequences. This requires significant reductions in greenhouse gas emissions across all sectors of society.' \
  --data 'questions=<string>'
{
  "answers": [
    {
      "id": "q001",
      "question": "What is the main topic of this text?",
      "reasoning": "The text consistently discusses the global issue of climate change, its causes, effects, and the urgency of addressing it.",
      "response": "Climate change",
      "utterance": "Climate change is a critical global challenge that demands immediate attention."
    },
    {
      "id": "q002",
      "question": "What is the recommended temperature increase limit?",
      "reasoning": "The text explicitly states the recommended limit for global warming to avoid severe consequences.",
      "response": "1.5°C",
      "utterance": "Scientists emphasize the urgency of limiting global warming to 1.5°C above pre-industrial levels to avoid the most severe consequences."
    },
    {
      "id": "q003",
      "question": "Does the text mention sea level rise as a consequence of climate change?",
      "reasoning": "The text explicitly lists sea level rise as one of the consequences of climate change.",
      "response": "true",
      "utterance": "Rising temperatures, extreme weather events, and sea level rise are just a few of the consequences we're already experiencing."
    }
  ]
}

Headers

api-subscription-key
string
default:

Your unique subscription key for authenticating requests to the Sarvam AI Speech-to-Text API. Here are the steps to get your api key

Body

application/x-www-form-urlencoded
text
string
required

The text content to be analyzed. This should be a non-empty string containing the full text for analysis.

Example:

"Climate change is a critical global challenge that demands immediate attention. Rising temperatures, extreme weather events, and sea level rise are just a few of the consequences we're already experiencing. Scientists emphasize the urgency of limiting global warming to 1.5°C above pre-industrial levels to avoid the most severe consequences. This requires significant reductions in greenhouse gas emissions across all sectors of society."

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.

Response

200
application/json
Successful Response
request_id
string | null
required
answers
object[] | null

List of answers derived from the text analysis. Each answer corresponds to a question from the original request. This field will be null if no valid answers could be generated.