Skip to content

Replace the private _amessages check with any-llm's SUPPORTS_MESSAGES_NATIVE #1494

Description

@njbrake

_serves_messages_natively (src/gateway/api/routes/messages.py:95) compares AnyLLM.get_provider_class(provider)._amessages against AnyLLM._amessages. any-llm now exposes this publicly as SUPPORTS_MESSAGES_NATIVE on the provider class, and as ProviderMetadata.messages_native. Follow-up from #1366; the shim's own docstring commits to removing it once the upstream flag lands.

  • Read AnyLLM.get_provider_class(provider).SUPPORTS_MESSAGES_NATIVE. Drop both getattr guards and the shim paragraph at lines 108-114. Keep the empty-selector and unknown-provider fallbacks answering True. Prefer the class attribute over get_provider_metadata(), which builds a Pydantic model per request.
  • Raise the any-llm-sdk[all] floor in pyproject.toml:15 from >=1.27.1 to the release carrying the flag, or an older pin resolves and every Messages request with betas hits AttributeError.

No behavior change. The flag is True for the same five providers the _amessages comparison matches today: anthropic, azureanthropic, vertexaianthropic, meta, otari. The assertions in tests/unit/test_messages_client_betas.py hold as written.

Blocked on mozilla-ai/any-llm#1422 merging and shipping.

Note: this issue was drafted by Claude Opus 5 via back-and-forth with @njbrake. The reasoning and decisions are his; the prose is Claude's.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions