Skip to content

feat(model-profiles): new fields + Makefile target - #35788

Merged
Mason Daugherty (mdrxy) merged 2 commits into
masterfrom
mdrxy/model-profile-data
Mar 12, 2026
Merged

feat(model-profiles): new fields + Makefile target#35788
Mason Daugherty (mdrxy) merged 2 commits into
masterfrom
mdrxy/model-profile-data

Conversation

@mdrxy

Copy link
Copy Markdown
Member

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.

@github-actions github-actions Bot added internal feature For PRs that implement a new feature; NOT A FEATURE REQUEST integration PR made that is related to a provider partner package integration github_actions Pull requests that update GitHub Actions code model-profiles `langchain-model-profiles` package issues & PRs size: XL 1000+ LOC anthropic `langchain-anthropic` package issues & PRs deepseek `langchain-deepseek` package issues & PRs fireworks `langchain-fireworks` package issues & PRs groq `langchain-groq` package issues & PRs huggingface `langchain-huggingface` package issues & PRs mistralai `langchain-mistralai` package issues & PRs openai `langchain-openai` package issues & PRs perplexity `langchain-perplexity` package issues & PRs xai `langchain-xai` package issues & PRs openrouter `langchain-openrouter` package issues & PRs and removed feature For PRs that implement a new feature; NOT A FEATURE REQUEST labels Mar 12, 2026
@mdrxy
Mason Daugherty (mdrxy) enabled auto-merge (squash) March 12, 2026 13:51
@mdrxy
Mason Daugherty (mdrxy) merged commit 5d9568b into master Mar 12, 2026
225 checks passed
@mdrxy
Mason Daugherty (mdrxy) deleted the mdrxy/model-profile-data branch March 12, 2026 13:56
@codspeed-hq

codspeed-hq Bot commented Mar 12, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 16 untouched benchmarks
⏩ 20 skipped benchmarks1


Comparing mdrxy/model-profile-data (63718fb) with master (f9dbd22)2

Open in CodSpeed

Footnotes

  1. 20 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on master (1891d41) during the generation of this report, so f9dbd22 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Mason Daugherty (mdrxy) added a commit that referenced this pull request Mar 23, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

anthropic `langchain-anthropic` package issues & PRs deepseek `langchain-deepseek` package issues & PRs fireworks `langchain-fireworks` package issues & PRs github_actions Pull requests that update GitHub Actions code groq `langchain-groq` package issues & PRs huggingface `langchain-huggingface` package issues & PRs integration PR made that is related to a provider partner package integration internal mistralai `langchain-mistralai` package issues & PRs model-profiles `langchain-model-profiles` package issues & PRs openai `langchain-openai` package issues & PRs openrouter `langchain-openrouter` package issues & PRs perplexity `langchain-perplexity` package issues & PRs size: XL 1000+ LOC xai `langchain-xai` package issues & PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant