fix(core): resolve Bedrock region templates - #41786
Closed
kitlangton wants to merge 1 commit into
Closed
Conversation
Contributor
Author
Closing in favor of #41816. The replacement keeps Bedrock-specific endpoint normalization in the existing AI SDK-to-native adapter, then performs generic expansion and validation before provider construction, rather than adding Bedrock knowledge to the generic model resolver. |
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
Resolve Bedrock Mantle catalog endpoints containing
${AWS_REGION}from the provider's configuredsettings.region, even whenAWS_REGIONis absent from the process environment.Closes #40075
Before / After
Before: A Bedrock config with
settings.region: "us-west-2"and the catalog URLhttps://bedrock-mantle.${AWS_REGION}.api.aws/openai/v1failed during model resolution whenAWS_REGIONwas unset. The generic unresolved-variable guard raisedUnresolvedProviderVariablesErrorbefore the merged native Mantle route could construct or use its regional endpoint.After: The known Bedrock Mantle
AWS_REGIONplaceholder resolves from configuredsettings.regionfirst. The native Responses/Chat provider receiveshttps://bedrock-mantle.us-west-2.api.aws/openai/v1, with its endpoint and signing region aligned.How
packages/core/src/model-resolver.tsrecognizes only the Bedrock Mantle package and only theAWS_REGIONplaceholder, preferring configured region before the existing environment substitution pass.packages/core/test/model-resolver.test.tscovers the integrated catalog-to-native-provider path with configured region, noAWS_REGION, and the literal catalog template.AWS_REGION is required to resolve the provider endpoint.Scope
Testing
cd packages/core && bun run test test/model-resolver.test.ts test/aisdk-native.test.ts(42 pass)cd packages/core && bun typecheckcd packages/ai && bun typecheckbun turbo typecheck --concurrency=3(33 tasks pass)cd packages/ai && bun run test test/provider/bedrock-mantle.test.ts test/provider/bedrock-converse.test.ts test/provider-package.test.ts(60 pass, 1 pre-existing failure in the unchangedsupports bearer authentication and custom base URLstest, which receives an empty recorded response)cd packages/core && bunx prettier --check src/model-resolver.ts test/model-resolver.test.ts