AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

[Langchain-Groq] Bind_tools Ignores A Known Tool_calling=False Model Profile And Sends A Request That Groq Rejects

ChatGroq.bind_tools() does not consult the resolved model profile's tool_calling capability. For models like allam-2-7b that LangChain's own profile marks as tool_calling=False, bind_tools still formats and sends tool definitions to the Groq API, which returns HTTP 400 with "tool calling is not supported with this model".

highConfidence 95%LangchainAffected V1.1.3

Origin Analysis

The bind_tools method bypasses the capability check present in the model profile. ChatGroq resolves the profile via _resolve_model_profile, but bind_tools never inspects the 'tool_calling' flag. It unconditionally binds tools as request kwargs, leading to an invalid API call for models that do not support tool calling.
1. Set up Groq API key and install langchain-groq 1.1.3, groq, etc. 2. Instantiate ChatGroq(model='allam-2-7b', max_tokens=32, max_retries=0). 3. Call .bind_tools([TOOL]) with a valid tool definition. 4. Invoke the bound model with any prompt. Groq returns 400 because the model profile says tool_calling=False but tools were sent.

Fixing Code Block

Edge Case Audit

The monkey patch silently drops tools for unsupported models, which may surprise users who expect an error or explicit indication that tool binding failed. It is globally applied to all ChatGroq instances, but per-call behavior depends on each instance's model profile, so no shared state is modified. If LangChain updates the internal profile representation or bind_tools signature in a future version, the patch may need adjustment; however, using *args/**kwargs helps compatibility. To roll back, restore the original method by reassigning ChatGroq.bind_tools = original_bind_tools. Consider raising ValueError instead of warning if silent ignoring is unacceptable in your application.

Ecosystem Topology