How to adjust the model’s thinking level with reasoning_effort

The reasoning_effort parameter controls how much effort the model puts into reasoning and planning its response.

  • Higher effort → more thoughtful, step-by-step, or structured answers
  • Lower effort → faster, simpler replies

Allowed values:

ValueBehavior
"low"Quick, simple replies
"medium"Balanced depth and speed (good default choice)
"high"More detailed reasoning and structured answers

💡 Tips:

  • Use "low" when you want short, direct responses.
  • Use "high" for tasks like explanations, problem solving, reasoning.
  • "medium" works well for most everyday interactions.

Note:

  • Setting higher reasoning effort may increase response time slightly, since the model is thinking more.
1# Install SarvamAI
2!pip install -Uqq sarvamai
3from sarvamai import SarvamAI
1# Initialize the SarvamAI client with your API key
2client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")
1# Example 1: Using default reasoning_effort (not specified) — balanced response
2response = client.chat.completions(
3 messages=[
4 {"role": "system", "content": "You are a helpful assistant."},
5 {"role": "user", "content": "Summarize the story of the Ramayana."}
6 ]
7 # reasoning_effort not specified → defaults internally (balanced)
8)
1# Example 2: Using reasoning_effort = "high" — more detailed, thoughtful response
2response = client.chat.completions(
3 messages=[
4 {"role": "system", "content": "You are a helpful assistant."},
5 {"role": "user", "content": "Summarize the story of the Ramayana."}
6 ],
7 reasoning_effort="high"
8)
1# Receive assistant's reply as output.
2print(response.choices[0].message.content)