@ai-sdk/amazon-bedrock 4.0.139 → 4.0.140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/index.js +2 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/dist/mantle/index.js +1 -1
- package/dist/mantle/index.mjs +1 -1
- package/package.json +3 -3
- package/src/bedrock-chat-language-model.ts +6 -18
package/dist/index.mjs
CHANGED
|
@@ -18,7 +18,10 @@ import {
|
|
|
18
18
|
postJsonToApi,
|
|
19
19
|
resolve
|
|
20
20
|
} from "@ai-sdk/provider-utils";
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
getModelCapabilities,
|
|
23
|
+
sanitizeJsonSchema
|
|
24
|
+
} from "@ai-sdk/anthropic/internal";
|
|
22
25
|
import { z as z4 } from "zod/v4";
|
|
23
26
|
|
|
24
27
|
// src/bedrock-api-types.ts
|
|
@@ -909,7 +912,7 @@ var BedrockChatLanguageModel = class {
|
|
|
909
912
|
const isAnthropicModel = this.modelId.includes("anthropic");
|
|
910
913
|
const isThinkingEnabled = ((_b = bedrockOptions.reasoningConfig) == null ? void 0 : _b.type) === "enabled" || ((_c = bedrockOptions.reasoningConfig) == null ? void 0 : _c.type) === "adaptive";
|
|
911
914
|
const modelRejectsNativeStructuredOutput = this.modelId.includes("claude-opus-4-7") || this.modelId.includes("claude-opus-4-8") || this.modelId.includes("claude-fable-5") || this.modelId.includes("claude-sonnet-5");
|
|
912
|
-
const modelSupportsStructuredOutput =
|
|
915
|
+
const { supportsStructuredOutput: modelSupportsStructuredOutput } = getModelCapabilities(this.modelId);
|
|
913
916
|
const useNativeStructuredOutput = isAnthropicModel && !modelRejectsNativeStructuredOutput && (modelSupportsStructuredOutput || isThinkingEnabled) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null;
|
|
914
917
|
const useJsonInstructionForStructuredOutput = isAnthropicModel && (this.modelId.includes("claude-opus-4-7") || this.modelId.includes("claude-opus-4-8")) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && tools != null && tools.length > 0;
|
|
915
918
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useNativeStructuredOutput && !useJsonInstructionForStructuredOutput ? {
|
|
@@ -1577,9 +1580,6 @@ var BedrockChatLanguageModel = class {
|
|
|
1577
1580
|
return `${this.config.baseUrl()}/model/${encodeURIComponent(modelId)}`;
|
|
1578
1581
|
}
|
|
1579
1582
|
};
|
|
1580
|
-
function bedrockChatModelSupportsStructuredOutput(modelId) {
|
|
1581
|
-
return modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5") || modelId.includes("claude-sonnet-5") || modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6") || modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5") || modelId.includes("claude-opus-4-1");
|
|
1582
|
-
}
|
|
1583
1583
|
var JsonObjectTextExtractor = class {
|
|
1584
1584
|
constructor() {
|
|
1585
1585
|
this.started = false;
|
|
@@ -2164,7 +2164,7 @@ import {
|
|
|
2164
2164
|
import { AwsV4Signer } from "aws4fetch";
|
|
2165
2165
|
|
|
2166
2166
|
// src/version.ts
|
|
2167
|
-
var VERSION = true ? "4.0.
|
|
2167
|
+
var VERSION = true ? "4.0.140" : "0.0.0-test";
|
|
2168
2168
|
|
|
2169
2169
|
// src/bedrock-sigv4-fetch.ts
|
|
2170
2170
|
function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
|