kmail.at
← learning

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.

2026-07-04 · 7 min read

$ pip install -U langchain>=1.3.11

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.

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

  1. 1bind_tools is now provider-aware
  2. 2Upgrade langchain to 1.3.11+
  3. 3Re-test tool calls after upgrading

Related commands

← all learning