The new release of Gemini 2.5 Flash has introduced a new parameter to Google's SDK, as follows:
prompt = "Explain the Occam's Razor concept and provide everyday examples of it"
budget = 1024 # You can set this variable to any value between 0 and 24k
client = genai.Client(api_key="your-api-key")
response = client.models.generate_content(
model="gemini-2.5-flash-preview-04-17",
contents=prompt,
config=types.GenerateContentConfig(
thinking_config=types.ThinkingConfig(
thinking_budget=budget
)
)
)
print(response.text)
As seen in https://ai.google.dev/gemini-api/docs/thinking#set-budget
The new release of Gemini 2.5 Flash has introduced a new parameter to Google's SDK, as follows:
prompt = "Explain the Occam's Razor concept and provide everyday examples of it"
budget = 1024 # You can set this variable to any value between 0 and 24k
client = genai.Client(api_key="your-api-key")
response = client.models.generate_content(
model="gemini-2.5-flash-preview-04-17",
contents=prompt,
config=types.GenerateContentConfig(
thinking_config=types.ThinkingConfig(
thinking_budget=budget
)
)
)
print(response.text)
As seen in https://ai.google.dev/gemini-api/docs/thinking#set-budget