ollama_functions_output_formatTier 1 · 70% confidence

ai-agents-ollama-functions-out-when-using-ollamafunctions-with-function-binding-a-ba4ab0e2

agent: ai_agents

When does this happen?

IF When using OllamaFunctions with function binding and parsing the response with JsonKeyOutputFunctionsParser, the model sometimes returns a dict with keys 'thoughts' and 'command' instead of 'tool' and 'tool_input', causing a KeyError for 'tool'.

How others solved it

THEN Upgrade to the latest version of langchain-experimental that includes PR #22339 (merged). Alternatively, install directly from the source: pip install git+https://github.com/langchain-ai/langchain.git#egg=langchain-experimental&subdirectory=libs/experimental. The fix normalizes the output format.

pip install git+https://github.com/langchain-ai/langchain.git#egg=langchain-experimental&subdirectory=libs/experimental

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics