diff --git a/ollama_agent.py b/ollama_agent.py index 9396208..53c0f77 100644 --- a/ollama_agent.py +++ b/ollama_agent.py @@ -342,7 +342,12 @@ For other questions, just answer normally without tools.""" try: tool = self.tools[tool_call.name] - result = tool.invoke(tool_call.arguments) + + # Per tool senza argomenti, non passare arguments + if tool_call.arguments: + result = tool.invoke(tool_call.arguments) + else: + result = tool.invoke({}) # Converti result in stringa per il modello if result is None: @@ -403,10 +408,8 @@ For other questions, just answer normally without tools.""" # Try to detect intent directly first detected_tool = self._detect_intent(user_content) - print(f"DEBUG: user_content='{user_content}', detected={detected_tool}") if detected_tool: result = self._execute_tool(detected_tool) - print(f"DEBUG: result={result}") # Format result as a clean response response_text = "" @@ -427,7 +430,6 @@ For other questions, just answer normally without tools.""" except Exception as e: response_text = str(result) if not response_text else response_text - print(f"DEBUG: response_text={response_text}") return {"messages": self.messages, "response": response_text} # Loop principale: risposta -> parse tools -> esegui -> ripeti