Spaces:
Running
Running
Pulastya B commited on
Commit ·
8cbfaa1
1
Parent(s): 9a765c3
fix: Remove Gemini tool calling - use text-only mode
Browse files- Gemini SDK has incompatible tool schema vs OpenAI/Groq
- Use existing self.gemini_model (no tools parameter)
- Tool execution handled by orchestrator, not Gemini
- Fixes: ValueError Unknown field for Tool: name
- Production-stable approach for multi-provider orchestration
- src/orchestrator.py +4 -14
src/orchestrator.py
CHANGED
|
@@ -1314,22 +1314,12 @@ You are a DOER. Complete workflows based on user intent."""
|
|
| 1314 |
# Prepare tools once
|
| 1315 |
tools_to_use = self._compress_tools_registry()
|
| 1316 |
|
| 1317 |
-
# For Gemini,
|
|
|
|
|
|
|
| 1318 |
gemini_chat = None
|
| 1319 |
if self.provider == "gemini":
|
| 1320 |
-
|
| 1321 |
-
gemini_tools = self._convert_to_gemini_tools(tools_to_use)
|
| 1322 |
-
|
| 1323 |
-
# Create a NEW model instance with tools configured
|
| 1324 |
-
# This is the correct way for Gemini API - tools are part of model config
|
| 1325 |
-
gemini_model_with_tools = genai.GenerativeModel(
|
| 1326 |
-
self.model,
|
| 1327 |
-
generation_config={"temperature": 0.1},
|
| 1328 |
-
tools=gemini_tools
|
| 1329 |
-
)
|
| 1330 |
-
|
| 1331 |
-
# Start chat with the tool-configured model (no extra parameters)
|
| 1332 |
-
gemini_chat = gemini_model_with_tools.start_chat(history=[])
|
| 1333 |
|
| 1334 |
while iteration < max_iterations:
|
| 1335 |
iteration += 1
|
|
|
|
| 1314 |
# Prepare tools once
|
| 1315 |
tools_to_use = self._compress_tools_registry()
|
| 1316 |
|
| 1317 |
+
# For Gemini, use the existing model without tools (text-only mode)
|
| 1318 |
+
# Gemini tool schema is incompatible with OpenAI/Groq format
|
| 1319 |
+
# Tool execution is handled by our orchestrator, not by Gemini itself
|
| 1320 |
gemini_chat = None
|
| 1321 |
if self.provider == "gemini":
|
| 1322 |
+
gemini_chat = self.gemini_model.start_chat(history=[])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1323 |
|
| 1324 |
while iteration < max_iterations:
|
| 1325 |
iteration += 1
|