Skip to content

feat: support AnthropicMessages API flavor for Bedrock-hosted Claude#93

Merged
ionut-mihalache-uipath merged 1 commit into
mainfrom
feat/anthropic-messages-api-flavor
Jun 16, 2026
Merged

feat: support AnthropicMessages API flavor for Bedrock-hosted Claude#93
ionut-mihalache-uipath merged 1 commit into
mainfrom
feat/anthropic-messages-api-flavor

Conversation

@ionut-mihalache-uipath

@ionut-mihalache-uipath ionut-mihalache-uipath commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

What & why

Adds support for the AnthropicMessages API flavor that the discovery endpoint now exposes (e.g. anthropic.claude-sonnet-4-6, returned as vendor=AwsBedrock, apiFlavor=AnthropicMessages). Previously such a model fell through the factory's AWSBEDROCK branch to UiPathChatBedrockConverse, and the gateway rejects the Bedrock-invoke body for this flavor with HTTP 400.

The gateway contract (verified live against alpha) for this flavor is:

  • URL: the awsbedrock passthrough route (.../vendor/awsbedrock/model/{model}/completions) — driven by discovery's hosting vendor
  • Header: X-UiPath-LlmGateway-ApiFlavor: AnthropicMessages
  • Body: the native Anthropic Messages wire format (model in body, no anthropic_version) — i.e. the native Anthropic SDK, not AnthropicBedrock

Changes (affects both packages → versioned together)

core (uipath-llm-client)

  • ApiFlavor.ANTHROPIC_MESSAGES = "AnthropicMessages" (value is the discovery string verbatim — it's forwarded as the flavor header)
  • API_FLAVOR_TO_VENDOR_TYPE[ANTHROPIC_MESSAGES] = AWSBEDROCK (resolves the vendor when discovery omits it)

langchain (uipath-langchain-client)

  • UiPathChatAnthropic gains an explicit api_flavor input. When ANTHROPIC_MESSAGES, it uses the native Anthropic/AsyncAnthropic SDK while keeping vendor_type=awsbedrock for URL routing. Vendor-derived defaults are unchanged (awsbedrockinvoke + AnthropicBedrock).
  • get_chat_model routes AnthropicMessages within the AWSBEDROCK branch to that client.

versioning — bumped core + langchain to 1.14.0, updated both CHANGELOGs and the uipath-llm-client>=1.14.0 floor (per CONTRIBUTING/CLAUDE.md rules for a core+langchain change).

Tests

  • test_api_config.py: enum value + vendor mapping
  • test_factory_function.py::TestFactoryAnthropicMessagesRouting: routing with and without a discovered vendor
  • test_unit.py::TestAnthropicMessagesFlavor: flavor/api_config + native-SDK selection
  • test_unit.py::TestVendorDerivedDefaultsUnchanged: regression guard for the existing Bedrock-invoke path

18 new/affected unit tests pass; ruff check and pyright clean on changed files. Validated end-to-end by running a low-code agent on anthropic.claude-sonnet-4-6 (completes successfully).

Notes for reviewers

  • This feature requires the EnabledNewLlmClients path (the legacy factory raises Unknown apiFlavor).
  • Pre-existing TestFactoryFunction parametrized cases for claude-haiku-4-5@20251001 / gemini-embedding-001 may fail locally if the tenant catalog lacks those names — unrelated to this change.

🤖 Generated with Claude Code

Add ApiFlavor.ANTHROPIC_MESSAGES and route discovery's
apiFlavor=AnthropicMessages (vendor AwsBedrock) to UiPathChatAnthropic
using the native Anthropic SDK (model-in-body wire format) over the
Bedrock passthrough URL. The gateway rejects the AnthropicBedrock
(Bedrock-invoke) body for this flavor with HTTP 400; the native body is
required.

- constants: new ApiFlavor.ANTHROPIC_MESSAGES + API_FLAVOR_TO_VENDOR_TYPE mapping
- UiPathChatAnthropic: explicit api_flavor input selects native Anthropic SDK
  for AnthropicMessages; vendor-derived defaults (awsbedrock -> invoke) unchanged
- factory: route AnthropicMessages within the AWSBEDROCK branch
- tests: constants, factory routing, client flavor/SDK selection + regression guard
- bump core + langchain to 1.14.0

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread src/uipath/llm_client/clients/litellm/client.py
@ionut-mihalache-uipath ionut-mihalache-uipath merged commit cc7a3bf into main Jun 16, 2026
11 checks passed
@ionut-mihalache-uipath ionut-mihalache-uipath deleted the feat/anthropic-messages-api-flavor branch June 16, 2026 08:05
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.

2 participants