Commit Graph

233 Commits

Author SHA1 Message Date
ccurme
c59e8e1cff feat(anthropic): support opus 4.7 features (#36847) 2026-04-17 09:37:02 -04:00
langchain-model-profile-bot[bot]
fd685fb779 chore(model-profiles): refresh model profile data (#36482)
Automated refresh of model profile data for all in-monorepo partner
integrations via `langchain-profiles refresh`.

🤖 Generated by the `refresh_model_profiles` workflow.

Co-authored-by: mdrxy <61371264+mdrxy@users.noreply.github.com>
2026-04-03 23:42:16 -04:00
vladpostoaca-stripe
fe2f105ce7 feat(anthropic): support adaptive thinking mode (#36293)
Thank you!
2026-03-28 20:53:55 -04:00
Mason Daugherty
2f64d80cc6 fix(core,model-profiles): add missing ModelProfile fields, warn on schema drift (#36129)
PR #35788 added 7 new fields to the `langchain-profiles` CLI output
(`name`, `status`, `release_date`, `last_updated`, `open_weights`,
`attachment`, `temperature`) but didn't update `ModelProfile` in
`langchain-core`. Partner packages like `langchain-aws` that set
`extra="forbid"` on their Pydantic models hit `extra_forbidden`
validation errors when Pydantic encountered undeclared TypedDict keys at
construction time. This adds the missing fields, makes `ModelProfile`
forward-compatible, provides a base-class hook so partners can stop
duplicating model-profile validator boilerplate, migrates all in-repo
partners to the new hook, and adds runtime + CI-time warnings for schema
drift.

## Changes

### `langchain-core`
- Add `__pydantic_config__ = ConfigDict(extra="allow")` to
`ModelProfile` so unknown profile keys pass Pydantic validation even on
models with `extra="forbid"` — forward-compatibility for when the CLI
schema evolves ahead of core
- Declare the 7 missing fields on `ModelProfile`: `name`, `status`,
`release_date`, `last_updated`, `open_weights` (metadata) and
`attachment`, `temperature` (capabilities)
- Add `_warn_unknown_profile_keys()` in `model_profile.py` — emits a
`UserWarning` when a profile dict contains keys not in `ModelProfile`,
suggesting a core upgrade. Wrapped in a bare `except` so introspection
failures never crash model construction
- Add `BaseChatModel._resolve_model_profile()` hook that returns `None`
by default. Partners can override this single method instead of
redefining the full `_set_model_profile` validator — the base validator
calls it automatically
- Add `BaseChatModel._check_profile_keys` as a separate
`model_validator` that calls `_warn_unknown_profile_keys`. Uses a
distinct method name so partner overrides of `_set_model_profile` don't
inadvertently suppress the check

### `langchain-profiles` CLI
- Add `_warn_undeclared_profile_keys()` to the CLI (`cli.py`), called
after merging augmentations in `refresh()` — warns at profile-generation
time (not just runtime) when emitted keys aren't declared in
`ModelProfile`. Gracefully skips if `langchain-core` isn't installed
- Add guard test
`test_model_data_to_profile_keys_subset_of_model_profile` in
model-profiles — feeds a fully-populated model dict to
`_model_data_to_profile()` and asserts every emitted key exists in
`ModelProfile.__annotations__`. CI fails before any release if someone
adds a CLI field without updating the TypedDict

### Partner packages
- Migrate all 10 in-repo partners to the `_resolve_model_profile()`
hook, replacing duplicated `@model_validator` / `_set_model_profile`
overrides: anthropic, deepseek, fireworks, groq, huggingface, mistralai,
openai (base + azure), openrouter, perplexity, xai
- Anthropic retains custom logic (context-1m beta → `max_input_tokens`
override); all others reduce to a one-liner
- Add `pr_lint.yml` scope for the new `model-profiles` package
2026-03-23 00:44:27 -04:00
ccurme
999cd85ba0 release(anthropic): 1.4 (#36018) 2026-03-17 14:38: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
langchain-model-profile-bot[bot]
69a7b9c808 chore(model-profiles): refresh model profile data (#35959)
Automated refresh of model profile data for all in-monorepo partner
integrations via `langchain-profiles refresh`.

🤖 Generated by the `refresh_model_profiles` workflow.

Co-authored-by: mdrxy <61371264+mdrxy@users.noreply.github.com>
2026-03-16 10:52:07 -04:00
ccurme
50febb79e8 release(anthropic): 1.3.5 (#35873) 2026-03-13 23:09:42 -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
Mason Daugherty
5d9568b5f5 feat(model-profiles): new fields + Makefile target (#35788)
Extract additional fields from models.dev into `_model_data_to_profile`:
`name`, `status`, `release_date`, `last_updated`, `open_weights`,
`attachment`, `temperature`

Move the model profile refresh logic from an inline bash script in the
GitHub Actions workflow into a `make refresh-profiles` target in
`libs/model-profiles/Makefile`. This makes it runnable locally with a
single command and keeps the provider map in one place instead of
duplicated between CI and developer docs.
2026-03-12 13:56:25 +00: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
Roli Bosch
fb31c91076 fix(anthropic): drop forced tool_choice when thinking is enabled (#35544) 2026-03-04 21:09:48 -05:00
ccurme
4ffb584ddf release(anthropic): 1.3.4 (#35418) 2026-02-24 08:51:01 -05:00
ccurme
cdb9742511 fix(anthropic): filter out common OpenAI Responses block types (#35417) 2026-02-24 08:45:54 -05:00
ccurme
00538ff5fc revert: add ChatAnthropicBedrockWrapper (#35371) 2026-02-20 15:58:35 -05:00
NITIN Madan
63f3669e12 feat(anthropic): add ChatAnthropicBedrock wrapper (#35091) 2026-02-20 13:06:12 -05:00
Mason Daugherty
70192690b1 fix(model-profiles): sort generated profiles by model ID for stable diffs (#35344)
- Sort model profiles alphabetically by model ID (the top-level
`_PROFILES` dictionary keys, e.g. `claude-3-5-haiku-20241022`,
`gpt-4o-mini`) before writing `_profiles.py`, so that regenerating
profiles only shows actual data changes in diffs — not random reordering
from the models.dev API response order
- Regenerate all 10 partner profile files with the new sorted ordering
2026-02-19 23:11:22 -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
Mason Daugherty
82ae4fb6fa chore: bump model profiles (#35294) 2026-02-17 20:22:07 -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
Mason Daugherty
4ca586b322 feat(model-profiles): add text_inputs and text_outputs (#35084)
- Add `text_inputs` and `text_outputs` fields to `ModelProfile`
- Regenerate `_profiles.py` for all providers

## Why

models.dev data includes `'text'` as both an input and output modality,
but we didn't capture it.

models.dev broadly contains models without text input (Whisper/ASR) and
without text output (image generators, TTS).

Without this, downstream consumers can't filter on model text support
(e.g. preventing users from passing text input to an audio-only model).

---

We'd need to also run for Google, AWS and cut releases for all to
propagate
2026-02-09 14:50:09 -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
19b0923461 chore(anthropic): update model profiles (#35039) 2026-02-05 19:19:08 -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
Viktor Taranenko
470160cf81 fix(anthropic): prevent crash with cache_control and empty message content (#34025) 2025-12-12 17:32:11 -05:00
Mason Daugherty
57ff48e62e docs(anthropic): clean up docstrings (#34317)
migration to docs
2025-12-12 11:30:34 -05:00
Mason Daugherty
13dd115d1d docs(anthropic): nit comments (#34314) 2025-12-12 10:33:23 -05:00
Mason Daugherty
2cff369cdc feat(anthropic): accept TypedDict for built-in tool types (#34279)
Widen `bind_tools` to accept `TypedDict` via `Mapping` so that users may
import and use Anthropic's built-in tool types:

```python
import subprocess

from anthropic.types.beta import BetaToolBash20250124Param
from langchain.tools import tool

tool_spec = BetaToolBash20250124Param(
    name="bash",
    type="bash_20250124",
    strict=True,
)

@tool(extras={"provider_tool_definition": tool_spec})
def bash(*, command: str, restart: bool = False, **kw):
    """Execute a bash command."""
    if restart:
        return "Bash session restarted"
    try:
        result = subprocess.run(
            command,
            shell=True,
            capture_output=True,
            text=True,
            timeout=30,
        )
        return result.stdout + result.stderr
    except Exception as e:
        return f"Error: {e}"

# Bind bash tool to your model
```

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2025-12-12 10:29:12 -05:00
Mason Daugherty
d6b5f05f33 refactor(anthropic): comments and _BUILTIN_TOOL_PREFIXES (#34305) 2025-12-11 16:57:22 -05:00
Mason Daugherty
5eec11e2db docs(anthropic): fix line number highlighting (#34303) 2025-12-11 16:12:01 -05:00
Mason Daugherty
3b7abdff96 feat(anthropic): auto-apply mcp beta header (#34301)
and update docstring example
2025-12-11 15:49:32 -05:00
Mason Daugherty
4aebfbad59 docs(anthropic): use named betas param in docstring example (#34300) 2025-12-11 15:48:13 -05:00
Mason Daugherty
ae1f03fbe0 docs(anthropic): cleanup nits (#34299) 2025-12-11 15:17:56 -05:00
ccurme
69dd39c461 fix(anthropic): ignore null values of caller on tool_use blocks (#34286) 2025-12-10 13:13:02 -05:00
ccurme
5350967ddc feat(anthropic): support mcp_toolset in bind_tools (#34284) 2025-12-10 14:39:35 +00:00
Mason Daugherty
7542278997 feat(core,anthropic): extras on BaseTool (#34120) 2025-12-10 09:37:14 -05:00
Mason Daugherty
2faed37ff1 feat(anthropic): document and test fine grained tool streaming (#34118)
https://platform.claude.com/docs/en/agents-and-tools/tool-use/fine-grained-tool-streaming
2025-12-08 15:34:56 -05:00
Mason Daugherty
91d5ca275d feat(anthropic): use model profile for max output tokens (#34163)
Need(?) to adjust tests to also pull from model profile? currently
hardcoded
2025-12-08 15:31:16 -05:00
Mason Daugherty
dcb670f395 feat(anthropic): auto append relevant beta headers for computer use (#34117)
in addition to documenting it


https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool
2025-12-08 15:25:36 -05:00
Mason Daugherty
8a5f46322b feat(anthropic): tool search support (#34119) 2025-12-08 10:46:37 -05:00
Mason Daugherty
4a42158e6c feat(anthropic): add effort support (#34116) 2025-12-05 13:44:42 -05:00
Mason Daugherty
b7091d391d feat(anthropic): auto append relevant beta headers (#34113) 2025-12-01 12:20:41 -05:00