Skip to content

claude: accept custom Messages-API MS in managed-config validation - #348

Open
andy-xu-db wants to merge 2 commits into
mainfrom
claude/accept-messages-api-ms
Open

claude: accept custom Messages-API MS in managed-config validation#348
andy-xu-db wants to merge 2 commits into
mainfrom
claude/accept-messages-api-ms

Conversation

@andy-xu-db

Copy link
Copy Markdown
Collaborator

Summary

Makes ucode's managed-config validation accept custom Model Serving endpoints that expose the Anthropic Messages API (anthropic/v1/messages), without requiring the admin to hand-type them into custom_models.

Why

Today, Claude discovery in ucode is name-based:

  • discover_claude_models hits /ai-gateway/anthropic/v1/models, keeping ids matching databricks-claude-<family>-*.
  • discover_model_services lists UC system.ai.claude-* ids.

A custom Model Serving endpoint whose name carries neither substring falls through both. When an admin pins such an endpoint in a managed config, validate_manifest rejects it as "not available on this workspace" — unless they manually add it to custom_models. Codex/Gemini already solve this with API-type-based discovery (discover_endpoints_with_api_type); this adds the Claude analog.

What changed

  • databricks.py: discover_anthropic_messages_models() — a one-line wrapper around the existing discover_endpoints_with_api_type(..., "anthropic/v1/messages"), mirroring discover_codex_models (openai/v1/responses).
  • managed_setup.py: _known_models() now reads state["anthropic_messages_models"] so validate_manifest treats those ids as known/routable.
  • managed_wizard.py: _with_claude_inventory() (the ucode apply validation path) best-effort fetches discover_anthropic_messages_models and stashes it on state, so a hand-edited manifest pinning a custom MS validates instead of being rejected.

Testing

  • test_databricks.py: discover_anthropic_messages_models returns only anthropic/v1/messages endpoints (filters out openai/v1/responses).
  • test_managed_setup.py: a custom MS id is accepted when state["anthropic_messages_models"] carries it.
  • test_managed_wizard.py: apply publishes a manifest pinning a custom MS (re-fetch surfaces it).
  • Broader suite (803 tests across test_agent_claude, test_managed_setup, test_managed_wizard, test_databricks, test_cli) passes.

This pull request and its description were written by Isaac.

Add discover_anthropic_messages_models (mirroring discover_codex_models)
for anthropic/v1/messages endpoints, wire it into _known_models so
validate_manifest accepts them, and extend _with_claude_inventory so
`ucode apply` re-fetches them for a hand-edited manifest. Custom Model
Serving exposing the Messages API is now validated without the
custom_models escape hatch.

Co-authored-by: Isaac
Remove the discover_anthropic_messages_models docstring and collapse
multi-line signatures to satisfy ruff format (CI failure on #348).

Co-authored-by: Isaac
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