Skip to content

Add Claude Opus 5.5 to Langfun's LLM registry (Anthropic + Vertex AI) - #772

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_986200894
Open

copybara-service[bot] wants to merge 1 commit into
mainfrom
test_986200894

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Sep 22, 2026

Copy link
Copy Markdown

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 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.

@copybara-service
copybara-service Bot force-pushed the test_986200894 branch 4 times, most recently from 7c7d419 to e002569 Compare September 23, 2026 04:32
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant