@ai-sdk/amazon-bedrock 4.0.143 → 4.0.145
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 +15 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -2
- package/dist/index.mjs.map +1 -1
- package/dist/mantle/index.js +1 -1
- package/dist/mantle/index.mjs +1 -1
- package/package.json +6 -6
- package/src/bedrock-chat-language-model.ts +5 -3
- package/src/bedrock-prepare-tools.ts +8 -0
package/dist/index.mjs
CHANGED
|
@@ -313,6 +313,13 @@ async function prepareTools({
|
|
|
313
313
|
const filteredFunctionTools = (toolChoice == null ? void 0 : toolChoice.type) === "tool" ? functionTools.filter((t) => t.name === toolChoice.toolName) : functionTools;
|
|
314
314
|
const supportsStrictOnTools = supportsStrictTools(modelId);
|
|
315
315
|
for (const tool of filteredFunctionTools) {
|
|
316
|
+
if (!supportsStrictOnTools && tool.strict != null) {
|
|
317
|
+
toolWarnings.push({
|
|
318
|
+
type: "unsupported",
|
|
319
|
+
feature: "strict",
|
|
320
|
+
details: `Tool '${tool.name}' has strict: ${tool.strict}, but strict mode is not supported by this model on Amazon Bedrock. The strict property will be ignored.`
|
|
321
|
+
});
|
|
322
|
+
}
|
|
316
323
|
bedrockTools.push({
|
|
317
324
|
toolSpec: {
|
|
318
325
|
name: tool.name,
|
|
@@ -933,7 +940,7 @@ var BedrockChatLanguageModel = class {
|
|
|
933
940
|
const isThinkingEnabled = ((_b = bedrockOptions.reasoningConfig) == null ? void 0 : _b.type) === "enabled" || ((_c = bedrockOptions.reasoningConfig) == null ? void 0 : _c.type) === "adaptive";
|
|
934
941
|
const { supportsStructuredOutput: modelSupportsStructuredOutput } = getModelCapabilities(this.modelId);
|
|
935
942
|
const useNativeStructuredOutput = isAnthropicModel && supportsNativeStructuredOutput(this.modelId) && (modelSupportsStructuredOutput || isThinkingEnabled) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null;
|
|
936
|
-
const useJsonInstructionForStructuredOutput = isAnthropicModel && (this.modelId
|
|
943
|
+
const useJsonInstructionForStructuredOutput = isAnthropicModel && !supportsStrictTools(this.modelId) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && tools != null && tools.length > 0;
|
|
937
944
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useNativeStructuredOutput && !useJsonInstructionForStructuredOutput ? {
|
|
938
945
|
type: "function",
|
|
939
946
|
name: "json",
|
|
@@ -2183,7 +2190,7 @@ import {
|
|
|
2183
2190
|
import { AwsV4Signer } from "aws4fetch";
|
|
2184
2191
|
|
|
2185
2192
|
// src/version.ts
|
|
2186
|
-
var VERSION = true ? "4.0.
|
|
2193
|
+
var VERSION = true ? "4.0.145" : "0.0.0-test";
|
|
2187
2194
|
|
|
2188
2195
|
// src/bedrock-sigv4-fetch.ts
|
|
2189
2196
|
function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
|