This PR sends gateway metadata information (if present in the client
response) as metadata for the llm invocation.
Requires changes corresponding changes in the ChatModel implementations
(e.g., ChatOpenAI) so gateway metadata is picked up from the gateway
response headers.
---------
Signed-off-by: Eugene Yurtsev <eugene@langchain.dev>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eyurtsev <3205522+eyurtsev@users.noreply.github.com>
This PR fixes the documentation issue reported in #39683: corrects
`capabilites` to `capabilities` in `README.md`.
Fixes#39683
Fixes #
---
Read the full contributing guidelines:
https://docs.langchain.com/oss/python/contributing/overview
> **All contributions must be in English.** See the [language
policy](https://docs.langchain.com/oss/python/contributing/overview#language-policy).
If you paste a large clearly AI generated description here your PR may
be IGNORED or CLOSED!
Thank you for contributing to LangChain! Follow these steps to have your
pull request considered as ready for review.
1. PR title: Should follow the format: TYPE(SCOPE): DESCRIPTION
- Examples:
- fix(anthropic): resolve flag parsing error
- feat(core): add multi-tenant support
- test(openai): update API usage tests
- Allowed TYPE and SCOPE values:
https://github.com/langchain-ai/langchain/blob/master/.github/workflows/pr_lint.yml#L15-L33
2. PR description:
- Write 1-2 sentences that make the change easy to understand: who
benefits, what problem they had, and how this solves it. Prefer a simple
user story over a long summary.
- The `Fixes #xx` line at the top is **required** for external
contributions — update the issue number and keep the keyword. This links
your PR to the approved issue and auto-closes it on merge.
- If there are any breaking changes, please clearly describe them.
- If this PR depends on another PR being merged first, please include
"Depends on #PR_NUMBER" in the description.
## Release note
3. Run `make format`, `make lint` and `make test` from the root of the
package(s) you've modified.
- We will not consider a PR unless these three are passing in CI.
4. How did you verify your code works?
Additional guidelines:
- All external PRs must link to an issue or discussion where a solution
has been approved by a maintainer, and you must be assigned to that
issue. PRs without prior approval will be closed.
- PRs should not touch more than one package unless absolutely
necessary.
- Do not update the `uv.lock` files or add dependencies to
`pyproject.toml` files (even optional ones) unless you have explicit
permission to do so by a maintainer.
## Social handles (optional)
Twitter: @
LinkedIn: https://linkedin.com/in/Fixes#39683
Bumps `langchain-anthropic` from 1.5.5 to 1.5.6, a patch release
containing two fixes since the last release:
- `fix(anthropic):` normalize `tool_search_tool_result` blocks (#39621)
- `fix(anthropic):` correct model profile data for Fable 5, Sonnet 5,
Opus 4.1 (#39604)
fixes#37584
* `tool_search_tool_result` blocks were being passed through unchanged,
which when streamed included a disallowed `index` field (this was
causing 400's with `ProviderToolSearchMiddleware`)
* this adds an additional case in the content block normalization step
to make sure that doesn't get tracked
ref:
https://platform.claude.com/docs/en/api/messages/create#tool_search_tool_result_block_param
Closes#38064, #35259, #38850
`merge_dicts`, `merge_lists`, and `AddableDict` all guessed at merge
semantics for streaming chunks in ways that silently corrupted data
instead of failing loudly:
- `merge_dicts` fell into the `int` branch for differing `bool` values
(since `bool` subclasses `int`) and summed them, turning `True + False`
into `1`. It now raises `TypeError`, consistent with other unmergeable
types.
- `merge_lists` used `"index" in e_left` on untyped list elements; when
an element was a plain `str` containing the literal substring `"index"`,
it then subscripted the string and raised an unrelated `TypeError`. It
now checks `isinstance(e_left, dict)` first.
- `AddableDict.__add__`/`__radd__` silently discarded the left-hand
value on any `TypeError` from `chunk[key] + other[key]`. They now
re-raise a `TypeError` naming the key and both types.
### Release note
`merge_dicts` now raises `TypeError` for differing boolean values at the
same key instead of silently summing them to an `int`; `AddableDict`
addition now raises `TypeError` on type-incompatible keys instead of
silently dropping data; `merge_lists` no longer misidentifies non-dict
elements as index-keyed.
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Fixed `ChatAnthropic` model profiles: `claude-fable-5` and
`claude-sonnet-5` now correctly report structured output support,
`claude-fable-5` reports its reasoning effort levels and default, and
the retired `claude-opus-4-1` entry was removed.
---
Users calling `model.profile` on `ChatAnthropic` get wrong capability
data for three models:
- `claude-fable-5` reported `structured_output: false` and no
reasoning-effort metadata, even though Fable 5 supports structured
outputs and all five effort levels (`low` through `max`, defaulting to
`high`).
- `claude-sonnet-5` reported `structured_output: false` despite
supporting structured outputs.
- `claude-opus-4-1` lingered as a sparse augmentation-only entry (six
fields, no token limits or modalities) after models.dev dropped it —
Anthropic retired the model on 2026-08-05, so the entry is removed
rather than backfilled.
Corrections verified against Anthropic's [structured outputs
compatibility
list](https://platform.claude.com/docs/en/build-with-claude/structured-outputs),
[effort
docs](https://platform.claude.com/docs/en/build-with-claude/effort), and
[deprecation
schedule](https://platform.claude.com/docs/en/about-claude/model-deprecations).
`_profiles.py` regenerated with `langchain-profiles refresh --provider
anthropic`.