Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e4ecf49
fix(bedrock): report event-stream checksum errors in the codec's words
cunninghamcard-bit Oct 20, 2026
469c540
fix(bedrock): name unsupported file parts as the AI SDK does
cunninghamcard-bit Oct 20, 2026
38bc4a3
fix(bedrock): keep the usage object as sent in raw usage
cunninghamcard-bit Oct 20, 2026
cb6aab1
fix(bedrock): generate an id for an empty toolUseId in doGenerate
cunninghamcard-bit Oct 20, 2026
4a3354c
fix(bedrock): warn rejected sampling parameters as temperature, topK,…
cunninghamcard-bit Oct 20, 2026
866ce15
fix(bedrock): name the model in the Nova 2 high reasoning warning
cunninghamcard-bit Oct 20, 2026
9abb06e
fix(bedrock): look up the default transport per request
cunninghamcard-bit Oct 20, 2026
c9a7f83
test: port the upstream Amazon Bedrock tests
cunninghamcard-bit Oct 20, 2026
9915ab4
test(bedrock): mark the old tests that cover upstream cases
cunninghamcard-bit Oct 20, 2026
6ed9377
Merge master into fix/amazon-bedrock-errors-warnings-usage-and-transp…
cunninghamcard-bit Oct 24, 2026
328982c
Merge fix/amazon-bedrock-errors-warnings-usage-and-transport-match-th…
cunninghamcard-bit Oct 24, 2026
eeef8ba
Merge master into fix/amazon-bedrock-errors-warnings-usage-and-transp…
cunninghamcard-bit Oct 25, 2026
ba5f040
test(amazon-bedrock): check the prelude checksum error text
cunninghamcard-bit Oct 25, 2026
464c39e
test(amazon-bedrock): non-chat models use the default transport per r…
cunninghamcard-bit Oct 25, 2026
6077be3
test(bedrock): map amazon-bedrock-error.ts to bedrock/mod.rs in layou…
cunninghamcard-bit Oct 25, 2026
c0df121
Merge remote-tracking branch 'origin/fix/amazon-bedrock-errors-warnin…
cunninghamcard-bit Oct 25, 2026
89dd25d
Merge remote-tracking branch 'origin/master' into fix/amazon-bedrock-…
cunninghamcard-bit Oct 25, 2026
fccdd4e
Merge branch 'fix/amazon-bedrock-errors-warnings-usage-and-transport-…
cunninghamcard-bit Oct 25, 2026
5a4bbf7
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
cunninghamcard-bit Oct 25, 2026
8a9ddcf
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
cunninghamcard-bit Oct 25, 2026
a39a040
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
cunninghamcard-bit Oct 25, 2026
3886dd1
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
claude Oct 25, 2026
2c9c68b
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
cunninghamcard-bit Oct 27, 2026
c4df21a
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
cunninghamcard-bit Oct 27, 2026
a87e956
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
cunninghamcard-bit Oct 27, 2026
756d591
Merge remote-tracking branch 'origin/master' into test/port-the-upstr…
cunninghamcard-bit Oct 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
275 changes: 275 additions & 0 deletions aimux-providers/layout.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2165,3 +2165,278 @@ reason = "the native Decisions API; upstream decides through the Responses model
rust = "openai/responses/tool_args.rs"
status = "aimux"
reason = "the provider tool argument schemas of tool/*.ts, validated in one place"

[bedrock]
package = "@ai-sdk/amazon-bedrock"
# amazon-bedrock-chat-language-model-event-stream.test.ts and amazon-bedrock-usage-raw.test.ts
# have no source file of their own name; every case in them is ported, so they need no
# exclusions.

[[bedrock.files]]
upstream = "src/amazon-bedrock-anthropic-model-support.ts"
rust = "bedrock/convert.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/amazon-bedrock-api-types.ts"
rust = "bedrock/types.rs"
status = "mapped"

[bedrock.files.tests]
sub-feature = [
{ case = "createAmazonBedrockCachePoint › should return default cache point when no TTL is provided", issue = 275, reason = "no createAmazonBedrockCachePoint builder; a cache point is passed verbatim through providerOptions.amazonBedrock.cachePoint" },
{ case = "createAmazonBedrockCachePoint › should create cache point with 5m TTL", issue = 275, reason = "no createAmazonBedrockCachePoint builder; a cache point is passed verbatim through providerOptions.amazonBedrock.cachePoint" },
{ case = "createAmazonBedrockCachePoint › should create cache point with 1h TTL", issue = 275, reason = "no createAmazonBedrockCachePoint builder; a cache point is passed verbatim through providerOptions.amazonBedrock.cachePoint" },
]

[[bedrock.files]]
upstream = "src/amazon-bedrock-chat-language-model-options.ts"
rust = "bedrock/convert.rs"
status = "mapped"

[bedrock.files.tests]
ts-only = [
{ case = "amazonBedrockLanguageModelChatOptions › type inference › infers AmazonBedrockLanguageModelChatOptions type correctly", reason = "checks a TypeScript type annotation; the Rust options are untyped JSON validated when the request is built" },
]

[[bedrock.files]]
upstream = "src/amazon-bedrock-chat-language-model.ts"
rust = "bedrock/model.rs"
status = "mapped"

[bedrock.files.tests]
ts-only = [
{ case = "doGenerate › should handle unsupported response format types", reason = "passes responseFormat { type: 'xml' } through a TypeScript `as any`; ResponseFormat is a closed Rust enum (Text, Json)" },
]

[[bedrock.files]]
upstream = "src/amazon-bedrock-embedding-model-options.ts"
rust = "bedrock/embedding.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/amazon-bedrock-embedding-model.ts"
rust = "bedrock/embedding.rs"
status = "mapped"

[bedrock.files.tests]
ts-only = [
{ case = "doEmbed › should return NaN usage for Cohere models when the token count header is absent", reason = "NaN is a JS number; EmbeddingUsage.tokens is a u32" },
]

[[bedrock.files]]
upstream = "src/amazon-bedrock-error.ts"
rust = "bedrock/mod.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/amazon-bedrock-event-stream-decoder.ts"
rust = "bedrock/event_stream.rs"
status = "mapped"

[bedrock.files.tests]
ts-only = [
{ case = "createAmazonBedrockEventStreamDecoder › surfaces processEvent errors", reason = "the TS decoder takes a processEvent callback that can throw; decode_stream yields messages and has no callback" },
]

[[bedrock.files]]
upstream = "src/amazon-bedrock-event-stream-response-handler.ts"
rust = "bedrock/event_stream.rs"
status = "mapped"

[bedrock.files.tests]
ts-only = [
{ case = "createEventSourceResponseHandler › throws EmptyResponseBodyError when response body is null", reason = "a FetchResponse always has a body stream; there is no null body" },
{ case = "createEventSourceResponseHandler › handles schema validation failures", reason = "mocks EventStreamCodec and passes a zod chunk schema to the handler; the Rust handler takes no schema" },
]

[[bedrock.files]]
upstream = "src/amazon-bedrock-image-model-options.ts"
rust = "bedrock/image.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/amazon-bedrock-image-model.ts"
rust = "bedrock/image.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/amazon-bedrock-image-settings.ts"
rust = "bedrock/image.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/amazon-bedrock-prepare-tools.ts"
rust = "bedrock/tools.rs"
status = "mapped"

[bedrock.files.tests]
ts-only = [
{ case = "prepareTools › tool choice › models that reject forced tool use › should pass the forced-tool capability to Anthropic provider tool preparation", reason = "asserts the arguments of a vi.mock spy on the Anthropic prepareTools; there is no seam to observe in Rust" },
]

[[bedrock.files]]
upstream = "src/amazon-bedrock-provider.ts"
rust = "bedrock/mod.rs"
status = "mapped"

[bedrock.files.tests]
sub-feature = [
{ case = "AmazonBedrockProvider › provider methods › should expose anthropicTools", issue = 275, reason = "AmazonBedrockProvider has no tools member (#275 厂商内置工具工厂)" },
]
ts-only = [
{ case = "AmazonBedrockProvider › createAmazonBedrock › should throw error when called with new keyword", reason = "Rust has no `new` on a callable; the provider is a struct" },
]

[[bedrock.files]]
upstream = "src/amazon-bedrock-reasoning-metadata.ts"
rust = "bedrock/model.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/amazon-bedrock-sigv4-fetch.ts"
rust = "bedrock/mod.rs"
status = "mapped"

[bedrock.files.tests]
registered = [
{ case = "createSigV4FetchFunction › should bypass signing for non-POST requests", ref = "AWS SigV4 fetch 也给 GET 请求签名(§9.1 已知差距)", reason = "aimux signs every request that carries no API key, GET included, so that list_models is accepted" },
{ case = "createSigV4FetchFunction › should bypass signing if POST request has no body", ref = "AWS SigV4 fetch 也给 GET 请求签名(§9.1 已知差距)", reason = "aimux signs every request that carries no API key, a bodyless POST included" },
{ case = "createSigV4FetchFunction › should call original fetch if init is undefined", ref = "AWS SigV4 fetch 也给 GET 请求签名(§9.1 已知差距)", reason = "a request with no init is a GET, which upstream forwards unsigned; aimux signs it" },
]
ts-only = [
{ case = "createSigV4FetchFunction › should handle non-string body by stringifying it", reason = "FetchRequest.body is bytes; there is no JS object body for JSON.stringify to coerce" },
{ case = "createApiKeyFetchFunction › should handle empty string API key", reason = "createApiKeyFetchFunction is a TS module export; the Rust provider sends a non-blank key as a header and has no fetch factory to hand an empty key" },
]

[[bedrock.files]]
upstream = "src/amazon-bedrock-stream-error.ts"
rust = "bedrock/model.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/anthropic/amazon-bedrock-anthropic-fetch.ts"
status = "not-applicable"
reason = "Bedrock-Anthropic (InvokeModel with the Anthropic Messages body) is not implemented; alignment doc §5 product choice row \"Bedrock 上的 Anthropic InvokeModel\" (anthropic_aws is Claude Platform on AWS, not this)"

[[bedrock.files]]
upstream = "src/anthropic/amazon-bedrock-anthropic-options.ts"
status = "not-applicable"
reason = "Bedrock-Anthropic (InvokeModel with the Anthropic Messages body) is not implemented; alignment doc §5 product choice row \"Bedrock 上的 Anthropic InvokeModel\" (anthropic_aws is Claude Platform on AWS, not this)"

[[bedrock.files]]
upstream = "src/anthropic/amazon-bedrock-anthropic-provider.ts"
status = "not-applicable"
reason = "Bedrock-Anthropic (InvokeModel with the Anthropic Messages body) is not implemented; alignment doc §5 product choice row \"Bedrock 上的 Anthropic InvokeModel\" (anthropic_aws is Claude Platform on AWS, not this)"

[[bedrock.files]]
upstream = "src/anthropic/index.ts"
status = "not-applicable"
reason = "Bedrock-Anthropic (InvokeModel with the Anthropic Messages body) is not implemented; alignment doc §5 product choice row \"Bedrock 上的 Anthropic InvokeModel\" (anthropic_aws is Claude Platform on AWS, not this)"

[[bedrock.files]]
upstream = "src/convert-amazon-bedrock-usage.ts"
rust = "bedrock/convert.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/convert-to-amazon-bedrock-chat-messages.ts"
rust = "bedrock/convert.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/index.ts"
rust = "bedrock/mod.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/inject-fetch-headers.ts"
status = "not-applicable"
reason = "a test helper of the package (not exported); the ported tests keep a Rust copy in bedrock/tests/support.rs"

[[bedrock.files]]
upstream = "src/mantle/bedrock-mantle-options.ts"
status = "missing"
issue = 275
reason = "Bedrock Mantle is a registry preset (OpenAI-compatible chat), not the full createBedrockMantle provider; #275 \"Bedrock Mantle 改为完整 provider\""

[[bedrock.files]]
upstream = "src/mantle/bedrock-mantle-provider.ts"
status = "missing"
issue = 275
reason = "Bedrock Mantle is a registry preset (OpenAI-compatible chat), not the full createBedrockMantle provider; #275 \"Bedrock Mantle 改为完整 provider\""

[[bedrock.files]]
upstream = "src/mantle/index.ts"
status = "missing"
issue = 275
reason = "Bedrock Mantle is a registry preset (OpenAI-compatible chat), not the full createBedrockMantle provider; #275 \"Bedrock Mantle 改为完整 provider\""

[[bedrock.files]]
upstream = "src/map-amazon-bedrock-finish-reason.ts"
rust = "bedrock/convert.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/normalize-tool-call-id.ts"
rust = "bedrock/convert.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/reranking/amazon-bedrock-reranking-api.ts"
rust = "bedrock/reranking.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/reranking/amazon-bedrock-reranking-model-options.ts"
rust = "bedrock/reranking.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/reranking/amazon-bedrock-reranking-model.ts"
rust = "bedrock/reranking.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/resolve-amazon-bedrock-base-url.ts"
rust = "bedrock/mod.rs"
status = "mapped"

[bedrock.files.tests]

[[bedrock.files]]
upstream = "src/version.ts"
status = "not-applicable"
reason = "VERSION is the package version string; aimux pins it in shared/aisdk_pins.rs, which the user-agent tests read"
2 changes: 1 addition & 1 deletion aimux-providers/src/bedrock/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn convert_prompt_to_bedrock(
convert_prompt(prompt, false)
}

fn convert_prompt(
pub(super) fn convert_prompt(
prompt: &LanguageModelPrompt,
is_mistral: bool,
) -> Result<(Vec<Value>, Vec<Value>), aimux_core::AiMuxError> {
Expand Down
2 changes: 1 addition & 1 deletion aimux-providers/src/bedrock/embedding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use crate::shared::EndpointConfig;
pub struct BedrockEmbeddingModel {
model_id: String,
config: EndpointConfig,
model_family: Option<AmazonBedrockEmbeddingModelFamily>,
pub(super) model_family: Option<AmazonBedrockEmbeddingModelFamily>,
}

impl BedrockEmbeddingModel {
Expand Down
1 change: 1 addition & 0 deletions aimux-providers/src/bedrock/event_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ mod tests {
);
}

/// partial: `surfaces frame decode errors instead of stranding later frames`; full port in src/bedrock/tests/event_stream_decoder.rs.
#[test]
fn corrupt_message_crc_is_rejected() {
let payload = r#"{"delta":{"text":"Hi"}}"#;
Expand Down
3 changes: 3 additions & 0 deletions aimux-providers/src/bedrock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,3 +718,6 @@ impl ProviderDiscovery for AmazonBedrockProvider {
})
}
}

#[cfg(test)]
mod tests;
2 changes: 1 addition & 1 deletion aimux-providers/src/bedrock/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn bedrock_event_stream_response_handler()
pub struct BedrockModel {
model_id: String,
config: EndpointConfig,
model_family: Option<String>,
pub(super) model_family: Option<String>,
}

impl BedrockModel {
Expand Down
Loading
Loading