Add Claude Opus 5.5 to Langfun's LLM registry (Anthropic + Vertex AI) - #772
Open
copybara-service[bot] wants to merge 1 commit into
Open
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
test_986200894
branch
4 times, most recently
from
September 23, 2026 04:32
7c7d419 to
e002569
Compare
WHY
Claude Opus 5.5 is Anthropic's newest Opus model, generally available since
2026-09-22 on both the direct Anthropic Messages API and Vertex AI. Langfun
exposes no way to select it, so users are stuck on Opus 5 or have to hand-roll
a model class of their own.
WHAT
* `langfun/core/llms/anthropic.py`: a new `SUPPORTED_MODELS` row for the model
id `claude-opus-5-5`, and a new `Claude55Opus` class.
* `langfun/core/llms/vertexai.py`: a new `VertexAIClaude55Opus` class
(`location='global'`) plus the single registry entry that maps
`claude-opus-5-5` to it.
* `langfun/core/llms/__init__.py`: export `Claude55Opus` and
`VertexAIClaude55Opus`.
* Unit tests for both modules, including tests that pin the package-level
exports.
Additive: no existing model row, class, export or test is modified. The
`model` enum is derived from `SUPPORTED_MODELS`, so the new row makes the id
selectable automatically.
HOW
* The registration mirrors the existing Opus 4.8 pattern end to end. The new
row is placed after Opus 5 to keep `SUPPORTED_MODELS` ordered oldest-first.
* Context window (1M input / 128K output), pricing and capabilities are taken
from the vendor's published model spec. Pricing is 0.2 / 4.0 / 20.0 USD per
1M cached-input / input / output tokens, which is lower than every earlier
Opus row -- the 4.5-5 rows carry 0.5 / 5.0 / 25.0 and the Claude 3/4 Opus
rows 1.5 / 15 / 75. The numbers are deliberately not cloned from a sibling
row, and a test pins them so that a future copy-paste regression fails
loudly.
* The explicit `claude-opus-5-5` -> `VertexAIClaude55Opus` registration is
required rather than redundant: auto-registration only covers rows whose
provider is 'VertexAI', and the direct row declares provider='Anthropic', so
without it `lf.LanguageModel.get('claude-opus-5-5')` silently resolves to
the direct-API class. A test pins the resolution.
* No `claude-opus-5-5@latest` alias row is added. Vertex AI publishes Claude
models under explicit versions, and Langfun already strips an `@latest`
suffix before it constructs the request URL, so a separate alias row would be
redundant. This mirrors the existing `VertexAIClaude5Opus` entry, which is
likewise registered without an alias. The consequence, stated plainly, is
that `VertexAIClaude55Opus.model_info` resolves to the Anthropic-direct model
row, exactly as `VertexAIClaude5Opus` does today.
* No request-shaping gate changed. Opus 4.7 and later reject non-default
`temperature`, `top_p` and `top_k`, and Opus 5.5 inherits adaptive thinking,
`display='summarized'` and that existing parameter strip from the
`'claude-opus-5' in model` substring checks, which already match
`claude-opus-5-5`; an explicit clause for the new id would be dead code.
Tests pin the inherited behavior, and the one stale comment that enumerated
"4.7, 4.8 and 5" now names 5.5 and records why no clause was added.
* `rate_limits` on the direct row are carried over from the sibling Opus row
and marked UNVERIFIED in-code: no published document grounds Opus 5.5 quota
yet.
PiperOrigin-RevId: 986200894
copybara-service
Bot
force-pushed
the
test_986200894
branch
from
September 23, 2026 05:37
e002569 to
482f6ee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Claude Opus 5.5 to Langfun's LLM registry (Anthropic + Vertex AI)
WHY
Claude Opus 5.5 is Anthropic's newest Opus model, generally available since
2026-09-22 on both the direct Anthropic Messages API and Vertex AI. Langfun
exposes no way to select it, so users are stuck on Opus 5 or have to hand-roll
a model class of their own.
WHAT
langfun/core/llms/anthropic.py: a newSUPPORTED_MODELSrow for the modelid
claude-opus-5-5, and a newClaude55Opusclass.langfun/core/llms/vertexai.py: a newVertexAIClaude55Opusclass(
location='global') plus the single registry entry that mapsclaude-opus-5-5to it.langfun/core/llms/__init__.py: exportClaude55OpusandVertexAIClaude55Opus.exports.
Additive: no existing model row, class, export or test is modified. The
modelenum is derived fromSUPPORTED_MODELS, so the new row makes the idselectable automatically.
HOW
row is placed after Opus 5 to keep
SUPPORTED_MODELSordered oldest-first.from the vendor's published model spec. Pricing is 0.2 / 4.0 / 20.0 USD per
1M cached-input / input / output tokens, which is lower than every earlier
Opus row -- the 4.5-5 rows carry 0.5 / 5.0 / 25.0 and the Claude 3/4 Opus
rows 1.5 / 15 / 75. The numbers are deliberately not cloned from a sibling
row, and a test pins them so that a future copy-paste regression fails
loudly.
claude-opus-5-5->VertexAIClaude55Opusregistration isrequired rather than redundant: auto-registration only covers rows whose
provider is 'VertexAI', and the direct row declares provider='Anthropic', so
without it
lf.LanguageModel.get('claude-opus-5-5')silently resolves tothe direct-API class. A test pins the resolution.
claude-opus-5-5@latestalias row is added. Vertex AI publishes Claudemodels under explicit versions, and Langfun already strips an
@latestsuffix before it constructs the request URL, so a separate alias row would be
redundant. This mirrors the existing
VertexAIClaude5Opusentry, which islikewise registered without an alias. The consequence, stated plainly, is
that
VertexAIClaude55Opus.model_inforesolves to the Anthropic-direct modelrow, exactly as
VertexAIClaude5Opusdoes today.temperature,top_pandtop_k, and Opus 5.5 inherits adaptive thinking,display='summarized'and that existing parameter strip from the'claude-opus-5' in modelsubstring checks, which already matchclaude-opus-5-5; an explicit clause for the new id would be dead code.Tests pin the inherited behavior, and the one stale comment that enumerated
"4.7, 4.8 and 5" now names 5.5 and records why no clause was added.
rate_limitson the direct row are carried over from the sibling Opus rowand marked UNVERIFIED in-code: no published document grounds Opus 5.5 quota
yet.