langchain · difficulty ◆◆
ProviderStrategy: strict=True Only for OpenAI-Compatible Models
Provider-aware tool calling without conditional logic
Your bind_tools results were wrong on non-OpenAI providers and you never knew why.
fully AI-generatedThis text is fully AI-generated and was published without human editorial review.$ pip install -U langchain>=1.3.11- 1.3.11
- Release
- #38370
- PR
- bind_tools
- Scope
langchain
fix(langchain,openai)
provider-aware strict
What it does
ProviderStrategy is an internal class in LangChain’s model-usage dispatch system that decides how to configure tool-calling per provider. The fix in 1.3.11 ensures strict=True is only applied to OpenAI-compatible models when using bind_tools(). Previously LangChain set strict=True for all providers, but only OpenAI and a handful of compatible providers (Azure OpenAI, Fireworks, OpenRouter) support it.
Why it matters
If you bound tools to a non-OpenAI model and saw malformed or missed tool calls, this was likely the culprit. bind_tools is one of the most common entry points in LangChain, so the blast radius was wide. Now the behavior is provider-aware and correct out of the box.
Example
$ Bind a weather tool to a Fireworks model and invoke it.[
{
"name": "get_weather",
"args": {"city": "Tokyo"},
"id": "call_xxxxx"
}
]The same code works on non-OpenAI providers because strict is applied conditionally.
Common flags
- bind_tools()
- Binds tools to a chat model for tool-calling support
- ProviderStrategy
- Internal class that selects provider-specific tool config
- strict=True
- Manual override in the OpenAI API
- create_openai_fn_runnable()
- Creates a runnable calling an OpenAI function with structured output
History
Origin
The team hard-coded strict=True for tool definitions, which silently broke providers that reject the parameter.
The fix
PR #38370 made ProviderStrategy apply strict only for OpenAI-compatible models, restoring correct tool calling across providers.
Under the hood
Under the hood
ProviderStrategy inspects the resolved provider of a model and picks the tool schema that the upstream API understands. For OpenAI and compatible providers it passes strict=True; for others it falls back to the plain tool schema, so the model never sees a parameter it will reject.
Fun facts
Pros & cons
pros
- + Fixes tool calls on non-OpenAI providers
- + No app code changes
- + Works across Azure, Fireworks, OpenRouter
cons
- − Internal class, not a public API
- − Requires upgrading langchain
Takeaways
- 1bind_tools is now provider-aware
- 2Upgrade langchain to 1.3.11+
- 3Re-test tool calls after upgrading
Related commands
archive entry — written and published by a scheduled job, never editorially reviewed. Kept for reference: out of the site’s search index, and no ads run here. the reviewed library →
