Repository navigation
fix(llamaindex): cap anthropic below 2.0 in the bedrock extra - #384
Merged
Merged
Conversation
UiPathChatBedrock fails on every call with "Cannot instantiate typing.Union" on fresh installs of uipath-llamaindex[bedrock]. llama-index-llms-bedrock 0.6.0 pins llama-index-llms-anthropic<0.9, whose 0.8.x calls anthropic.types.MessageParam(...). In anthropic 2.x (released 2026-10-21) MessageParam is a Union and can't be called. Nothing in the chain caps anthropic (llama-index-llms-anthropic only asks for >=0.62.0), so new resolutions pick up 2.x. Cap it at <2.0.0, with the adapter's own floor, until llama-index-llms-bedrock allows a newer llama-index-llms-anthropic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the Bedrock dependency compatibility update.
No open issues 🎉
What changed in this PR
Fixes fresh installations of uipath-llamaindex[bedrock] by excluding Anthropic 2.x, which is incompatible with the legacy UiPathChatBedrock adapter.
Changes:
- Adds
anthropic>=0.62.0, <2.0.0to the Bedrock extra and documents the compatibility constraint. - Bumps the package version to
0.6.3. - Updates lockfile metadata while retaining the locked Anthropic version and lock format.
| File | Description |
|---|---|
packages/uipath-llamaindex/uv.lock |
Synchronizes the package version and Bedrock dependency metadata. |
packages/uipath-llamaindex/pyproject.toml |
Adds the Anthropic constraint and explanation; bumps the release version. |
Review effort: Balanced
radu-mocanu
approved these changes
Nov 10, 2026
radu-mocanu
reviewed
Nov 10, 2026
The rationale lives in the PR description and the previous commit message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.



Summary
UiPathChatBedrock(the legacy Bedrock class, notUiPathChatBedrockConverse) fails on every method withTypeError: Cannot instantiate typing.Unionfor any fresh install ofuipath-llamaindex[bedrock]. This PR capsanthropicbelow 2.0 in thebedrockextra.It affects users as well as CI.
uipath-llamaindex/chat-modelsis red on every LlamaIndex PR, e.g. #383.Root cause
A breaking change in
anthropic2.0 (released 2026-10-21), which nothing in our dependency chain caps:llama-index-llms-anthropic0.8.6 builds messages withanthropic.types.MessageParam(role=..., content=...)inllama_index/llms/anthropic/utils.py(messages_to_anthropic_messages).anthropic2.x,MessageParamisUnion[UserMessageParam, AssistantMessageParam, SystemMessageParam], and aUnioncan't be called. The error is raised while the request is being built, before anything is sent.llama-index-llms-bedrockcapsllama-index-llms-anthropicat<0.9, so the newer adapters (now at 0.12.3) can't be resolved.uipath-llamaindexdidn't constrainanthropic, so it took the newest major version.Why it showed up now
chat-modelsrun: 2026-10-21 12:58 UTC, withanthropic1.17.0.anthropic2.0.0: released the same day at 15:51 UTC.uv.lockpinsanthropic0.84.0. Thechat-modelstestcase resolves without a lock, so it gets the newest version.Evidence
chat-modelson alpha, cloud and staging,UiPathChatBedrockfails all 9 methods in both testcase runs.UiPathOpenAI,UiPathChatBedrockConverseandUiPathVertexpass all 20 checks each.main(a2c92fb), testcase env resolved as CI does, against a non-routable URL:anthropic2.7.0 →Cannot instantiate typing.Unionanthropic1.17.0 → the request is sent (it fails only because the URL is fake)anthropic1.17.0,llama-index-llms-bedrock0.6.0,llama-index-llms-anthropic0.8.6,llama-index-llms-bedrock-converse0.15.5.UiPathChatBedrocksends the request.Change
bedrockextra:anthropic>=0.62.0, <2.0.0. The floor matchesllama-index-llms-anthropic's own requirement.uv.lock: only the new requirement and the version. The lockedanthropicstays at 0.84.0, and the lock format stays atrevision = 3.The cap can be removed once
llama-index-llms-bedrockallowsllama-index-llms-anthropic>=0.9.Checks
mypy,ruff check,ruff format --checkand the package tests (166) pass locally.🤖 Generated with Claude Code