Commit Graph

200 Commits

Author SHA1 Message Date
Radhakrishnan Pachyappan
a07356f839 fix(anthropic): add advisor_ prefix to builtin tool recognition (#38686) 2026-07-09 22:18:52 -04:00
langchain-oss-model-profiles[bot]
83386b56e1 chore(model-profiles): refresh model profile data (#38689)
Automated refresh of model profile data for all in-monorepo partner
integrations via `langchain-profiles refresh`.

🤖 Generated by the [`refresh_model_profiles`
workflow](https://github.com/langchain-ai/langchain/blob/master/.github/workflows/refresh_model_profiles.yml).


## Summary of changes

**0 added · 10 removed · 12 changed** across 2 provider(s).

<details>
<summary>anthropic</summary>

** 10 removed**
- `claude-3-5-sonnet-20240620`
- `claude-3-5-sonnet-20241022`
- `claude-3-7-sonnet-20250219`
- `claude-3-haiku-20240307`
- `claude-3-opus-20240229`
- `claude-3-sonnet-20240229`
- `claude-opus-4-0`
- `claude-opus-4-20250514`
- `claude-sonnet-4-0`
- `claude-sonnet-4-20250514`

**✏️ 10 changed**
- `claude-fable-5`: release date `2026-06-09` → `2026-06-07`
- `claude-opus-4-1`: status unset → `deprecated`
- `claude-opus-4-1-20250805`: status unset → `deprecated`
- `claude-opus-4-5-20251101`: release date `2025-11-01` → `2025-11-24`
- `claude-opus-4-6`: release date `2026-02-05` → `2026-02-04`
- `claude-opus-4-7`: release date `2026-04-16` → `2026-04-14`
- `claude-sonnet-4-5`: max input tokens 200,000 → 1,000,000
- `claude-sonnet-4-5-20250929`: max input tokens 200,000 → 1,000,000
- `claude-sonnet-4-6`: max output tokens 64,000 → 128,000
- `claude-sonnet-5`: release date `2026-06-30` → `2026-06-29`

</details>

<details>
<summary>openrouter</summary>

**✏️ 2 changed**
- `openai/gpt-oss-20b`: display name `gpt-oss-20b` → `GPT OSS 20B`
- `z-ai/glm-5.2`: max input tokens 1,024,000 → 1,048,576; max output
tokens 128,000 → 131,072

</details>

---------

Co-authored-by: mdrxy <61371264+mdrxy@users.noreply.github.com>
Co-authored-by: Mason Daugherty <github@mdrxy.com>
2026-07-06 10:09:28 -04:00
langchain-oss-model-profiles[bot]
8146596e0a chore(model-profiles): refresh model profile data (#38663)
Automated refresh of model profile data for all in-monorepo partner
integrations via `langchain-profiles refresh`.

🤖 Generated by the `refresh_model_profiles` workflow.


## Summary of changes

**35 added · 8 removed · 33 changed** across 6 provider(s).

### anthropic

** 1 added**
- `claude-sonnet-5` — 1,000,000 ctx, 128,000 out, text+image+pdf in,
reasoning, tools

** 2 removed**
- `claude-3-5-haiku-20241022`
- `claude-3-5-haiku-latest`

### fireworks-ai

** 1 added**
- `accounts/fireworks/routers/glm-5p2-fast` — 1,048,575 ctx, 131,072
out, reasoning, tools

**✏️ 1 changed**
- `accounts/fireworks/models/glm-5p2`: max input tokens 1,048,576 →
1,048,575

### groq

**✏️ 1 changed**
- `openai/gpt-oss-safeguard-20b`: last updated `2025-10-29` →
`2026-06-29`

### huggingface

** 26 added**
- `MiniMaxAI/MiniMax-M2` — 204,800 ctx, 128,000 out, reasoning, tools
- `MiniMaxAI/MiniMax-M3` — 524,288 ctx, 128,000 out, text+image in,
reasoning, tools
- `Qwen/Qwen3-235B-A22B` — 40,960 ctx, 16,384 out, reasoning, tools
- `Qwen/Qwen3-32B` — 131,072 ctx, 16,384 out, reasoning, tools
- `Qwen/Qwen3-Coder-30B-A3B-Instruct` — 262,144 ctx, 65,536 out, tools
- `Qwen/Qwen3.5-122B-A10B` — 262,144 ctx, 65,536 out, text+image in,
reasoning, tools
- `Qwen/Qwen3.5-27B` — 262,144 ctx, 65,536 out, text+image in,
reasoning, tools
- `Qwen/Qwen3.5-35B-A3B` — 262,144 ctx, 65,536 out, text+image in,
reasoning, tools
- `Qwen/Qwen3.5-9B` — 262,144 ctx, 65,536 out, text+image in, reasoning,
tools
- `Qwen/Qwen3.6-27B` — 262,144 ctx, 65,536 out, text+image in,
reasoning, tools
- `Qwen/Qwen3.6-35B-A3B` — 262,144 ctx, 65,536 out, text+image in,
reasoning, tools
- `XiaomiMiMo/MiMo-V2.5-Pro` — 1,048,576 ctx, 131,072 out, reasoning,
tools
- `deepseek-ai/DeepSeek-R1` — 64,000 ctx, 32,768 out, reasoning, tools
- `deepseek-ai/DeepSeek-V4-Flash` — 1,048,576 ctx, 384,000 out,
reasoning, tools
- `google/gemma-4-26B-A4B-it` — 262,144 ctx, 32,768 out, text+image in,
reasoning, tools
- `google/gemma-4-31B-it` — 262,144 ctx, 32,768 out, text+image in,
reasoning, tools
- `meta-llama/Llama-3.3-70B-Instruct` — 131,072 ctx, 4,096 out, tools
- `moonshotai/Kimi-K2.7-Code` — 262,144 ctx, 262,144 out, text+image in,
reasoning, tools
- `openai/gpt-oss-120b` — 131,072 ctx, 32,768 out, reasoning, tools
- `stepfun-ai/Step-3.5-Flash` — 262,144 ctx, 256,000 out, reasoning,
tools
- `stepfun-ai/Step-3.7-Flash` — 262,144 ctx, 256,000 out, text+image in,
reasoning, tools
- `zai-org/GLM-4.5` — 131,072 ctx, 98,304 out, reasoning, tools
- `zai-org/GLM-4.5-Air` — 131,072 ctx, 98,304 out, reasoning, tools
- `zai-org/GLM-4.5V` — 65,536 ctx, 16,384 out, text+image in, reasoning,
tools
- `zai-org/GLM-4.6` — 204,800 ctx, 131,072 out, reasoning, tools
- …and 1 more

### mistral

**✏️ 1 changed**
- `mistral-medium-latest`: last updated `2025-08-12` → `2026-04-29`;
added open weights; added reasoning; release date `2025-08-12` →
`2026-04-29`; added structured output

### openrouter

** 7 added**
- `anthropic/claude-fable-5` — 1,000,000 ctx, 128,000 out,
text+image+pdf in, reasoning, tools
- `anthropic/claude-sonnet-5` — 1,000,000 ctx, 128,000 out,
text+image+pdf in, reasoning, tools
- `google/gemini-3.1-flash-lite-image` — 65,536 ctx, 66,000 out,
text+image in, reasoning
- `poolside/laguna-xs-2.1` — 262,144 ctx, 32,768 out, reasoning, tools
- `poolside/laguna-xs-2.1:free` — 262,144 ctx, 32,768 out, reasoning,
tools
- `sakana/fugu-ultra` — 1,000,000 ctx, 128,000 out, text+image in,
reasoning, tools
- `z-ai/glm-5v-turbo` — 202,752 ctx, 131,072 out, text+image+video in,
reasoning, tools

** 6 removed**
- `anthropic/claude-opus-4.6-fast`
- `essentialai/rnj-1-instruct`
- `microsoft/phi-4-mini-instruct`
- `nex-agi/nex-n2-pro:free`
- `openrouter/owl-alpha`
- `prime-intellect/intellect-3`

**✏️ 30 changed**
- `arcee-ai/trinity-large-thinking`: removed structured output
- `deepseek/deepseek-v4-flash`: max input tokens 1,000,000 → 1,048,576;
max output tokens 65,536 → 16,384
- `google/gemini-2.5-flash-image`: max output tokens 8,192 → 32,768
- `google/gemini-3.1-flash-image`: max input tokens 65,536 → 131,072;
max output tokens 65,536 → 32,768
- `google/gemma-4-26b-a4b-it:free`: added structured output
- `minimax/minimax-m2`: max input tokens 196,608 → 204,800; max output
tokens 196,608 → 131,072
- `minimax/minimax-m2.1`: max input tokens 196,608 → 204,800; max output
tokens 196,608 → 131,072; removed structured output
- `minimax/minimax-m2.7`: max output tokens 131,072 → 196,608
- `moonshotai/kimi-k2`: max output tokens 32,768 → 100,352
- `moonshotai/kimi-k2-0905`: max output tokens 262,144 → 100,352
- `moonshotai/kimi-k2-thinking`: max output tokens 262,144 → 100,352
- `moonshotai/kimi-k2.5`: max output tokens 262,144 → 256,000
- `moonshotai/kimi-k2.6`: max output tokens 65,535 → 262,144
- `moonshotai/kimi-k2.7-code`: max output tokens 262,144 → 16,384
- `nvidia/nemotron-3-super-120b-a12b`: max output tokens 262,144 →
16,384
- `openai/gpt-oss-120b`: max output tokens 32,768 → 131,072; display
name `gpt-oss-120b` → `GPT OSS 120B`
- `qwen/qwen3-235b-a22b-thinking-2507`: max input tokens 262,144 →
131,072; removed structured output
- `qwen/qwen3-30b-a3b-thinking-2507`: max input tokens 131,072 → 81,920;
max output tokens 131,072 → 32,768; removed structured output
- `qwen/qwen3-8b`: max input tokens 40,960 → 131,072; removed structured
output
- `qwen/qwen3.5-35b-a3b`: max output tokens 262,144 → 81,920
- `qwen/qwen3.5-397b-a17b`: max output tokens 65,536 → 64,000
- `stepfun/step-3.5-flash`: max output tokens 16,384 → 65,536
- `thedrummer/rocinante-12b`: removed structured output; removed tool
calling
- `x-ai/grok-4.3`: added PDF input
- `xiaomi/mimo-v2.5`: max input tokens 1,048,576 → 32,000
- …and 5 more

---------

Co-authored-by: mdrxy <61371264+mdrxy@users.noreply.github.com>
Co-authored-by: Mason Daugherty <github@mdrxy.com>
2026-07-04 20:08:45 -04:00
Mason Daugherty
e7a9a9a728 fix(anthropic): ignore LangSmith requests in VCR cassettes (#38547)
Anthropic integration tests can run with LangSmith tracing enabled in
scheduled CI, which sends LangSmith API requests while VCR cassettes are
active. Ignore LangSmith ingest endpoints in the Anthropic VCR config so
cassette playback only matches Anthropic traffic.

## Changes
- Add `api.smith.langchain.com` to the Anthropic VCR `ignore_hosts`
configuration while preserving any hosts from the shared base config.
- Keep existing Anthropic cassette serialization, request redaction, and
response redaction behavior unchanged.
2026-06-29 11:15:48 -04:00
Christian Bromann
bfc65cc04f fix(anthropic): keep initial text on content_block_start (#38442)
## Summary
- Fix `ChatAnthropic._make_message_chunk_from_anthropic_event` dropping
the first text chunk of an assistant turn when Anthropic carries the
opening text on the `content_block_start` event rather than a following
`text_delta`. This most often hits the assistant turn right after a tool
result.
- The dropped content streams to clients but never reaches the
aggregated `AIMessage`, so anything reading message history back (e.g. a
checkpointer) sees a truncated message (`Here's the answer.` → `'s the
answer.`). Reported via Pylon 25478 (Zip), whose `<canvaspreview>`
parser broke because the dropped chunk was the opening `<can` tag.
- Add a `content_block_start` branch for `text` and `thinking` blocks:
emit non-empty start-event content on both the string
(`coerce_content_to_string=True`) and structured content paths; empty
starts still emit no chunk (preserving prior behavior) and update
`block_start_event` so following deltas resolve against the current
block.

---------

Co-authored-by: Mason Daugherty <mason@langchain.dev>
Co-authored-by: Mason Daugherty <github@mdrxy.com>
2026-06-26 17:17:00 -04:00
Mason Daugherty
6dd45c90f6 hotfix(anthropic): regenerate cassette (#38376) 2026-06-22 18:52:53 -04:00
Mason Daugherty
8837163917 fix(core,partners): rename package version trace metadata (#38110)
Package-version trace metadata now uses the LangChain-owned
`metadata["lc_versions"]` convention instead of the user-owned
`metadata["versions"]` key. Metadata merging is narrowed so only
`lc_versions` accumulates nested package-version entries, while generic
nested metadata keeps normal last-writer-wins behavior.

## Changes
- Renamed `BaseLanguageModel._add_version()` trace metadata from
`versions` to `lc_versions`, including docstrings and the non-dict
replacement warning.
- Scoped `_merge_metadata_dicts()` nested-map accumulation to only
`lc_versions`; duplicate package entries remain last-writer-wins and
`lc_versions` mappings are copied defensively.
- Preserved user-owned `metadata["versions"]` semantics by keeping it
out of package-version tracking and generic nested metadata merging.
- Updated runnable snapshots and partner package metadata assertions
across Anthropic, DeepSeek, Fireworks, Groq, Hugging Face, MistralAI,
Ollama, OpenAI, OpenRouter, Perplexity, and xAI to expect `lc_versions`.

## Testing
- Added/adjusted core tests for `lc_versions` accumulation, duplicate
package overwrite behavior, non-dict `lc_versions` replacement,
defensive copying, and `metadata["versions"]` last-writer-wins behavior.
- Ran focused core and partner metadata tests plus Ruff checks for
changed areas.
2026-06-12 14:26:32 -04:00
Nick Hollon
dcaf7795a3 fix(langchain,anthropic): confine file-search results and tighten anthropic allowed_prefixes (#38106) 2026-06-12 12:47:23 -04:00
Mason Daugherty
948f6cc58c feat(core,partners): add package version tracking to tracing metadata (#35295)
Following on the heels of #35293

TODO:
- Packages outside of this repo (e.g. LiteLLM, Nvidia, Google, AWS)

---

## Summary

Surface partner package versions in `metadata.versions` on LangSmith
traces. Mirrors the JS SDK's `_addVersion()` pattern
([langchainjs#10106](https://github.com/langchain-ai/langchainjs/pull/10106)).

Each model constructor records its package version via `_add_version()`
on `BaseLanguageModel`. The version dict accumulates through the class
hierarchy — `langchain-core` is added in
`BaseLanguageModel.model_post_init`, `langchain-openai` in
`BaseChatOpenAI._set_openai_chat_version`, and each leaf partner in its
uniquely-named `model_validator`. Traces end up with:

```json
{
  "metadata": {
    "versions": {
      "langchain-core": "1.4.5",
      "langchain-openai": "1.3.0",
      "langchain-xai": "1.2.2"
    }
  }
}
```

### Changes

- `BaseLanguageModel._add_version(pkg, version)` — appends to
`self.metadata["versions"]`; accepts any `Mapping` type; emits a warning
if a non-mapping value is found and replaced
- `BaseLanguageModel.model_post_init` — adds `langchain-core` version;
calls `super()` for MRO safety
- `_merge_metadata_dicts` — one-level-deep (non-recursive) merge for
nested dict metadata keys
- `CallbackManager.add_metadata` — uses `_merge_metadata_dicts` instead
of flat `dict.update()` so nested metadata dicts (like `versions`)
coexist rather than clobber
- `merge_configs` — uses `_merge_metadata_dicts` for config merging

**Partners:**
- Each now calls `self._add_version("langchain-<pkg>", __version__)`

### Design decisions

- **Constructor-based, not `_get_ls_params`-based** — versions flow
through `self.metadata` (local metadata on traces), not through
`LangSmithParams`. This matches JS and makes child-class version
inheritance automatic (no merge/clobber issues).
- **`versions` is local (non-inheritable) metadata** — `self.metadata`
is passed to `CallbackManager.configure` as `local_metadata`
(`add_metadata(..., inherit=False)`), so `versions` is attached **once
per chat-model run** and is **not** propagated to child runs or
duplicated onto every streaming chunk. This is intentionally the
opposite of the inheritable-per-chunk metadata that #36588 was reducing
for performance — `versions` does not regress that path.
- **`add_metadata` deep-merge is a correctness fix, not just for
versions** — previously `add_metadata`/`merge_configs` did a flat
top-level `dict.update`/spread, so any nested metadata dict baked into a
config (e.g. via `.with_config({"metadata": {...}})`) would be wholly
replaced when a caller also passed `metadata`. `_merge_metadata_dicts`
merges one level deep so user-provided `config.metadata.versions` and
model-set `versions` coexist instead of clobbering. The merge runs once
per `configure` (not per chunk), so it is off the streaming hot path.
- **One level deep only** — `_merge_metadata_dicts` is deliberately
*not* a recursive deep merge; values nested more than one level are
last-writer-wins. This covers the `versions` case without the
ambiguity/cost of arbitrary-depth merging.
- **Warn on non-dict `metadata["versions"]`** — if a user sets
`metadata={"versions": "some-string"}`, `_add_version` emits a warning
and replaces the value with the version dict rather than silently
discarding user data or crashing. This is a soft breaking change for
anyone who previously stored non-dict values at this key.

### Follow-ups (tracked separately, out of scope here)

- JS `mergeConfigs` still flat-spreads nested metadata, so
`metadata.versions` can still clobber on the JS side until an equivalent
deep-merge lands.

---

Made by [Open SWE](https://openswe.vercel.app)

---------

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
2026-06-11 02:23:19 -04:00
Mason Daugherty
007ae66405 test(anthropic): make expected warnings explicit (#38044)
Warning-producing test paths now either exercise the intended Anthropic
model branch or explicitly assert expected warnings. That keeps `make
test` output clean while preserving coverage for backwards-compatible
parameters, deprecated `AnthropicLLM`, and standard structured-output
behavior.
2026-06-10 19:45:37 -04:00
Mason Daugherty
f0a78bf0d7 test(anthropic): make tests robust to gateway base URL (#38043)
Anthropic unit tests now pin the expected API base URL where
serialization and initialization assertions depend on it. That keeps
local gateway settings like `ANTHROPIC_BASE_URL` from changing snapshot
output or default URL assertions during development.
2026-06-10 19:39:50 -04:00
Mason Daugherty
f89f4c5afe fix(core): support content block tokens in callbacks (#34739)
Supersedes #34727
Closes #30703

Related:
* langchain-ai/langchain-google#1460
* langchain-ai/langchain-google#1501

Fixing this at the `langchain-core` callback layer instead of
normalizing inside individual provider integrations, so structured
streaming content is preserved consistently.

---

Models are increasingly streaming structured content blocks instead of
plain text tokens. For example, Gemini 3 can stream text as
content-block lists, and Anthropic/tool-use flows can also produce
non-text message content. Today those values already reach
`on_llm_new_token`, but the callback API still advertises `token: str`,
which makes custom callbacks, tracers, and streaming helpers assume
every streamed value is text.

User story: as a LangChain user building a streaming callback for chat
models with tool calls, reasoning/thinking blocks, or provider-specific
structured content, I need `on_llm_new_token` to accept the same content
shape that chat model chunks can actually emit, so my callback can
observe the stream without providers flattening or dropping non-text
data.

Fixing this in `langchain-core` makes the existing runtime behavior
explicit at the shared callback boundary. Normalizing content blocks
inside each provider would duplicate logic, produce inconsistent
behavior across integrations, and in some cases lose required provider
metadata such as Gemini thought signatures.

## Changes

- Update the callback contract so streamed tokens can be either plain
text or structured content blocks
- Carry structured streamed content through tracing and event/log
streaming paths without forcing provider data into text too early
- Keep built-in text-oriented streaming callbacks working by converting
structured tokens only at the display/queue boundary
- Drop the now-incorrect `cast("str", ...)` on streamed content in
`BaseChatModel` so the producer side matches the widened callback
signature instead of asserting a string it doesn't always have (no
runtime change — `cast` is erased)
- Align Anthropic and Mistral content typing with the structured content
shapes already used by chat model messages
- Update callback tests to reflect that not every streamed value is text

## Compatibility

No runtime behavior change: no producer emits anything it wasn't already
emitting, and widening a parameter type is safe for existing callers and
handlers that pass or receive `str`. The one caveat is downstream code
that subclasses a callback handler or tracer and overrides
`on_llm_new_token` with a `token: str` annotation — under strict type
checking that override is now narrower than the base and will be flagged
as incompatible with the supertype. Such code still runs unchanged; the
fix is to widen the annotation to match.
2026-06-10 16:59:08 -04:00
Mason Daugherty
1a5403d848 fix(anthropic): normalize cross-provider tool-call IDs (#37756)
Anthropic's API rejects `tool_use`/`tool_result` IDs that don't match
`^[a-zA-Z0-9_-]+$` with a 400. When a conversation thread is replayed
across providers — e.g. a user switches a running thread from Kimi (via
Fireworks) to Claude — the prior turns carry tool-call IDs minted by the
other provider (Kimi emits `functions.write_todos:0`, whose `.` and `:`
are invalid), and the request fails. Tool-call IDs are now normalized to
an Anthropic-compatible form during request formatting, with the
original `tool_use.id` and its paired `tool_use_id` mapped identically
so they stay linked.
2026-05-28 16:13:57 -04:00
Nick Hollon
da380bccf8 chore(infra): merge v1.4 into master (#37350) 2026-05-11 11:39:25 -07:00
open-swe[bot]
97ac1d34d0 fix(anthropic): guard httpx finalizers (#37064) 2026-04-28 20:59:00 -04:00
Mason Daugherty
7a4594b682 fix(anthropic): restore cache_control on non-direct subclasses (#37057)
Closes #37042

---

`AnthropicPromptCachingMiddleware` was unconditionally setting top-level
`cache_control` in `model_settings` for any `ChatAnthropic` subclass.
That field is direct-Anthropic-API only — `ChatAnthropicBedrock` (which
subclasses `ChatAnthropic` and passed the existing `isinstance` gate)
errored with `cache_control: Extra inputs are not permitted`.
Investigating that surfaced a related regression: PR #35967 also deleted
the block-level `cache_control` injection in `_get_request_payload`,
which silently disabled caching entirely for non-direct subclasses
(Bedrock had been falling back to in-block breakpoints). This restores
both paths.

## Changes
- Add `_is_direct_anthropic_llm_type` predicate that allowlists
`_llm_type == "anthropic-chat"`. Both the middleware's
`_supports_automatic_caching` and the new branch in
`ChatAnthropic._get_request_payload` route through it, so any subclass
that overrides `_llm_type` (Bedrock today, future direct-API variants
tomorrow) is treated as non-direct by default. Replaces the prior
substring-matching denylist on `"bedrock"`/`"vertex"`.
- Restore `_collect_code_execution_tool_ids`,
`_is_code_execution_related_block`, and a new
`_apply_cache_control_to_last_eligible_block` helper in `chat_models`.
For non-direct subclasses, `_get_request_payload` now pops
`cache_control` from kwargs and walks messages newest-to-oldest,
attaching the breakpoint to the last block that isn't
`code_execution`-related (Anthropic forbids breakpoints on those).
- Emit `UserWarning` when `cache_control` is requested but every
candidate block is `code_execution`-related — previously a silent drop.
- `AnthropicPromptCachingMiddleware._apply_caching` now sets the
top-level `cache_control` only when
`_supports_automatic_caching(request.model)`. System-message and
tool-definition breakpoints continue to apply for all `ChatAnthropic`
subclasses, since those are accepted by every transport.
- Note: `ChatAnthropicVertex` does not subclass `ChatAnthropic` (it
lives in `langchain-google-vertexai` and ships its own
`_get_request_payload`), so the chat-models changes here only affect
Bedrock. The middleware-side gate covers Vertex implicitly via the
`isinstance(request.model, ChatAnthropic)` check that already excludes
it.
2026-04-28 16:41:22 -04:00
Nick Hollon
9ce72eba9f feat(core): add content-block-centric streaming (v2) (#36834) 2026-04-24 11:36:17 -04:00
ccurme
c59e8e1cff feat(anthropic): support opus 4.7 features (#36847) 2026-04-17 09:37:02 -04:00
jasiecky
c9f51aef85 fix(core): fixed typos in the documentation (#36459)
Fixes #36458 

Fixed typos in the documentation in the core module.
2026-04-02 11:32:12 -04:00
vladpostoaca-stripe
fe2f105ce7 feat(anthropic): support adaptive thinking mode (#36293)
Thank you!
2026-03-28 20:53:55 -04:00
ccurme
043ef0721a feat(anthropic): AnthropicPromptCachingMiddleware: apply explicit caching to system message and tool definitions (#35969) 2026-03-17 10:58:56 -04:00
ccurme
55711b010b feat(anthropic): delegate cache_control kwarg to anthropic top-level param (#35967) 2026-03-17 10:49:03 -04:00
Jacob Lee
6d6d7191cf fix(anthropic): Ignore general usage cache_creation fields if more specific fields are set (#35845)
Prevent double counting, since the sum of all `input_token_details`
should never exceed `input_tokens`

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2026-03-13 20:21:06 -04:00
Tejas Attarde
d6dbcf6294 perf(.github): set a timeout on get min versions HTTP calls (#35851)
During an automated code review of .github/scripts/get_min_versions.py,
the following issue was identified. Set a timeout on get min versions
HTTP calls. Network calls without a timeout can hang a worker
indefinitely. I kept the patch small and re-ran syntax checks after
applying it.
2026-03-13 17:24:32 -04:00
ccurme
92be5b62b0 fix(anthropic): support eager_input_streaming (#35779) 2026-03-11 23:07:13 -04:00
ccurme
f11a105023 fix(anthropic): move _make_message_chunk_from_anthropic_event to instance method (#35670) 2026-03-08 14:52:07 -04:00
ccurme
7a4cc3ec32 fix(anthropic): update integration test (#35577) 2026-03-05 14:36:03 -05:00
Roli Bosch
fb31c91076 fix(anthropic): drop forced tool_choice when thinking is enabled (#35544) 2026-03-04 21:09:48 -05:00
ccurme
cdb9742511 fix(anthropic): filter out common OpenAI Responses block types (#35417) 2026-02-24 08:45:54 -05:00
ccurme
2fa460d325 fix(anthropic): update integration tests (#35396) 2026-02-22 09:33:21 -05:00
ccurme
00538ff5fc revert: add ChatAnthropicBedrockWrapper (#35371) 2026-02-20 15:58:35 -05:00
Mason Daugherty
ca246ddef2 fix(anthropic): replace retired model IDs in tests and docstrings (#35365)
## Summary

- Replace `claude-3-5-haiku-20241022` and `claude-3-7-sonnet-20250219`
with `claude-haiku-4-5-20251001` and `claude-sonnet-4-5-20250929`
respectively
- Both models were retired by Anthropic on February 19, 2026, causing
all anthropic integration tests to fail
- Updates integration tests, a unit test, and docstring examples in
`langchain-core`

See:
https://platform.claude.com/docs/en/docs/resources/model-deprecations
2026-02-20 13:44:15 -05:00
NITIN Madan
63f3669e12 feat(anthropic): add ChatAnthropicBedrock wrapper (#35091) 2026-02-20 13:06:12 -05:00
ccurme
5362bf5666 fix(anthropic): set max input tokens based on 1m context beta header (#35341) 2026-02-19 21:01:49 -05:00
Mike Lambert
0d13463e7f feat(anthropic): add User-Agent header for Anthropic API calls (#35268) 2026-02-17 15:59:54 -05:00
ccurme
8166e0137d chore(anthropic): add version (#35293) 2026-02-17 15:49:14 -05:00
The Mavik
7f3c10865a fix(anthropic): hoist cache_control from tool_result content sub-blocks to tool_result level (#35126) 2026-02-11 10:55:01 -05:00
ccurme
0493b276e0 fix(anthropic): support effort="max" and remove beta headers (#35141) 2026-02-10 14:46:12 -05:00
ccurme
7c41298355 feat(core): add ContextOverflowError, raise in anthropic and openai (#35099) 2026-02-09 15:15:34 -05:00
Mohan Kumar S
4276d31cb5 fix(anthropic): strip trailing whitespace from final assistant message (#35072) 2026-02-08 11:08:59 -05:00
ccurme
d30e2b88db fix(anthropic): support output_config (#35036) 2026-02-06 11:11:01 -05:00
ccurme
7853b0ffcf release(anthropic): 1.3.2 (#35035) 2026-02-05 16:45:47 -05:00
ccurme
74b3344679 fix(anthropic): support automatic compaction (Opus 4.6) (#35034) 2026-02-05 16:41:25 -05:00
lwtaiyty
578cef9622 fix(anthropic): skip cache_control for code_execution blocks (#34579) 2026-01-05 15:40:59 -05:00
ccurme
5ec0fa69de fix(core): serialization patch (#34455)
- `allowed_objects` kwarg in `load`
- escape lc-ser formatted dicts on `dump`
- fix for jinja2

---------

Co-authored-by: Mason Daugherty <github@mdrxy.com>
2025-12-22 17:33:31 -06:00
Viktor Taranenko
470160cf81 fix(anthropic): prevent crash with cache_control and empty message content (#34025) 2025-12-12 17:32:11 -05:00
ccurme
c3738ea376 chore(anthropic): make test agnostic of python version (#34320) 2025-12-12 18:10:14 +00:00
Christophe Bornet
f5b6eecf72 refactor(standard-tests): improve VCR config (#33968)
Use of the fixture `_base_vcr_config` is deprecated with alternative
function `base_vcr_config()`
This way:
* we don't need to import `_base_vcr_config` seen as unused (which leads
to ruff violations PLC0414 and F811)
* we don't need to make a copy since a new dict is created at each
function invocation

Co-authored-by: Mason Daugherty <mason@langchain.dev>
2025-12-12 10:14:26 -05:00
ccurme
46dbb3967e chore(anthropic): update test_tool_search cassette (#34297) 2025-12-11 10:53:52 -05:00
ccurme
5350967ddc feat(anthropic): support mcp_toolset in bind_tools (#34284) 2025-12-10 14:39:35 +00:00