Commit 648903a6d501

Vincent Demeester <vincent@sbr.pm>
2026-01-14 20:20:52
fix(xmpp-research-bot): correct thinking_level config structure
The thinking_level parameter must be nested inside thinking_config, not passed directly in the config dict. Correct structure: config = { "thinking_config": {"thinking_level": "high"} } Only applies thinking_config to gemini-pro model for deep reasoning. Gemini 3 Flash uses default settings. Error was: pydantic.ValidationError: Extra inputs are not permitted [type=extra_forbidden, input_value='HIGH'] Sources: - https://ai.google.dev/gemini-api/docs/thinking - https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thinking Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 9f8f8c0
Changed files (1)
modules
xmpp-research-bot
modules/xmpp-research-bot/bot.py
@@ -339,14 +339,20 @@ class ResearchBot(slixmpp.ClientXMPP):
         full_prompt = f"{system_prompt}\n\nUser query: {query}"
 
         # Call Gemini API via Vertex AI
+        # For Gemini 3 models, use thinking_config for reasoning depth
+        config = {
+            "max_output_tokens": max_tokens,
+            "temperature": 1.0,
+        }
+
+        # Add thinking config for Pro model (deep reasoning)
+        if model == "gemini-pro":
+            config["thinking_config"] = {"thinking_level": "high"}
+
         response = self.gemini_client.models.generate_content(
             model=model_ids[model],
             contents=full_prompt,
-            config={
-                "max_output_tokens": max_tokens,
-                "temperature": 1.0,
-                "thinking_level": "HIGH",  # Use high thinking level for reasoning
-            }
+            config=config
         )
 
         result = response.text