fix(errors): categorize unresolvable Bedrock model id as Deployment#942
Open
cotovanu-cristian wants to merge 1 commit into
Open
fix(errors): categorize unresolvable Bedrock model id as Deployment#942cotovanu-cristian wants to merge 1 commit into
cotovanu-cristian wants to merge 1 commit into
Conversation
A model id with no provider segment (no dot to split provider from model)
cannot be mapped to a known Bedrock provider. langchain_aws then carries the
whole id forward as the "provider" and only fails at invoke time with an
opaque NotImplementedError ("Provider <id> model does not support chat"),
which buckets as an Unknown runtime error.
Validate the model id at UiPathChatBedrock / UiPathChatBedrockConverse
construction and raise a typed AgentStartupError(LLM_INVALID_MODEL) categorized
as Deployment, so a misconfigured model is attributable instead of opaque.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR improves Bedrock model-id validation for the legacy Bedrock chat wrappers so that unresolvable model IDs fail fast at construction time with a Deployment-categorized AgentStartupError(LLM_INVALID_MODEL), instead of surfacing later as an opaque NotImplementedError during invocation.
Changes:
- Added provider-resolution + validation helpers for Bedrock model IDs and raise a Deployment-categorized startup error for unsupported providers.
- Wired model-id validation into
UiPathChatBedrockandUiPathChatBedrockConverseconstructors. - Added pytest coverage asserting invalid IDs raise a Deployment error and valid IDs still construct.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/uipath_langchain/chat/_legacy/bedrock.py |
Adds provider resolution/validation and raises a structured Deployment startup error during Bedrock wrapper initialization. |
tests/chat/test_bedrock.py |
Adds tests ensuring invalid model IDs are categorized as Deployment at construction time. |
Comment on lines
+91
to
+92
| if model_id.startswith("arn"): | ||
| return None |
|
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.


Problem
A Bedrock model id with no provider segment (no dot to split provider from model) cannot be mapped to a known Bedrock provider.
langchain_awsderives the provider from the model id by splitting on.; a bare alias yields the whole alias as the "provider", which is not in the supported set. This only fails deep at invoke time with an opaqueNotImplementedError("Provider model does not support chat"), so it buckets as an Unknown runtime error rather than the deployment misconfiguration it is.Fix
Validate the model id at
UiPathChatBedrock/UiPathChatBedrockConverseconstruction. A_resolve_bedrock_providerhelper mirrors the library's own region-prefix-aware split; if the resolved provider is not a known Bedrock provider, raiseAgentStartupError(LLM_INVALID_MODEL)categorized asDeployment. ARNs (which carry no inline provider) are left forlangchain_awsto validate against an explicitprovider.This fails fast at startup with an attributable, Deployment-categorized error instead of an opaque Unknown at invoke time.
Tests
tests/chat/test_bedrock.py::TestModelResolutionValidation— an unresolvable synthetic model id raises a Deployment-categorizedAgentStartupError(both invoke and converse variants); a known model id still constructs.🤖 Generated with Claude Code