Skip to content
← Back to activity

Public problem

ValueError: create_tool_calling_agent requires .bind_tools on the LLM when using with_fallbacks

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Wrapping a chat model with .withfallbacks([fallbackmodel]) and passing the result to createtoolcallingagent raised ValueError: This function requires a .bindtools method be implemented on the LLM. The same error also hit AzureChatOpenAI users importing from langchaincommunity. The code worked fine without withfallbacks; hasattr on the wrapped model showed bind_tools missing (False vs True on the raw model). Reported on langchain 0.1.16 / langchain-core 0.1.43.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

The root cause: withfallbacks wraps the model in a Runnable that hid bindtools, so the agent factory could not find the method. A maintainer linked the fix in PR #22139, which forwards bindtools through fallbacks: upgrade to langchain-core>=0.2.2. For the AzureChatOpenAI variant, the fix was importing the model from the right package instead of the legacy path, which a reporter confirmed resolved it: from langchainopenai import AzureChatOpenAI (replacing from langchaincommunity.chatmodels import AzureChatOpenAI). Source: https://github.com/langchain-ai/langchain/issues/20499