feat: support AnthropicMessages API flavor for Bedrock-hosted Claude#93
Merged
Merged
Conversation
d866e6a to
93fb9b4
Compare
93fb9b4 to
e0c2a94
Compare
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>
e0c2a94 to
a0dfca7
Compare
cosminacho
reviewed
Jun 16, 2026
cosminacho
approved these changes
Jun 16, 2026
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.
What & why
Adds support for the
AnthropicMessagesAPI flavor that the discovery endpoint now exposes (e.g.anthropic.claude-sonnet-4-6, returned asvendor=AwsBedrock,apiFlavor=AnthropicMessages). Previously such a model fell through the factory'sAWSBEDROCKbranch toUiPathChatBedrockConverse, 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:
awsbedrockpassthrough route (.../vendor/awsbedrock/model/{model}/completions) — driven by discovery's hostingvendorX-UiPath-LlmGateway-ApiFlavor: AnthropicMessagesmodelin body, noanthropic_version) — i.e. the nativeAnthropicSDK, notAnthropicBedrockChanges (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)UiPathChatAnthropicgains an explicitapi_flavorinput. WhenANTHROPIC_MESSAGES, it uses the nativeAnthropic/AsyncAnthropicSDK while keepingvendor_type=awsbedrockfor URL routing. Vendor-derived defaults are unchanged (awsbedrock→invoke+AnthropicBedrock).get_chat_modelroutesAnthropicMessageswithin theAWSBEDROCKbranch to that client.versioning — bumped core + langchain to 1.14.0, updated both CHANGELOGs and the
uipath-llm-client>=1.14.0floor (per CONTRIBUTING/CLAUDE.md rules for a core+langchain change).Tests
test_api_config.py: enum value + vendor mappingtest_factory_function.py::TestFactoryAnthropicMessagesRouting: routing with and without a discovered vendortest_unit.py::TestAnthropicMessagesFlavor: flavor/api_config + native-SDK selectiontest_unit.py::TestVendorDerivedDefaultsUnchanged: regression guard for the existing Bedrock-invoke path18 new/affected unit tests pass;
ruff checkandpyrightclean on changed files. Validated end-to-end by running a low-code agent onanthropic.claude-sonnet-4-6(completes successfully).Notes for reviewers
EnabledNewLlmClientspath (the legacy factory raisesUnknown apiFlavor).TestFactoryFunctionparametrized cases forclaude-haiku-4-5@20251001/gemini-embedding-001may fail locally if the tenant catalog lacks those names — unrelated to this change.🤖 Generated with Claude Code