@ai-sdk/amazon-bedrock
Advanced tools
Comparing version 0.0.33 to 0.0.34
@@ -33,6 +33,7 @@ "use strict"; | ||
// src/bedrock-chat-language-model.ts | ||
var import_provider2 = require("@ai-sdk/provider"); | ||
var import_provider3 = require("@ai-sdk/provider"); | ||
var import_client_bedrock_runtime = require("@aws-sdk/client-bedrock-runtime"); | ||
// src/bedrock-prepare-tools.ts | ||
var import_provider = require("@ai-sdk/provider"); | ||
function prepareTools(mode) { | ||
@@ -43,3 +44,3 @@ var _a; | ||
return { | ||
toolConfiguration: { tools: void 0, toolChoice: void 0 }, | ||
toolConfig: { tools: void 0, toolChoice: void 0 }, | ||
toolWarnings: [] | ||
@@ -68,3 +69,3 @@ }; | ||
return { | ||
toolConfiguration: { tools: bedrockTools, toolChoice: void 0 }, | ||
toolConfig: { tools: bedrockTools, toolChoice: void 0 }, | ||
toolWarnings | ||
@@ -77,3 +78,3 @@ }; | ||
return { | ||
toolConfiguration: { tools: bedrockTools, toolChoice: { auto: {} } }, | ||
toolConfig: { tools: bedrockTools, toolChoice: { auto: {} } }, | ||
toolWarnings | ||
@@ -83,3 +84,3 @@ }; | ||
return { | ||
toolConfiguration: { tools: bedrockTools, toolChoice: { any: {} } }, | ||
toolConfig: { tools: bedrockTools, toolChoice: { any: {} } }, | ||
toolWarnings | ||
@@ -89,3 +90,3 @@ }; | ||
return { | ||
toolConfiguration: { tools: void 0, toolChoice: void 0 }, | ||
toolConfig: { tools: void 0, toolChoice: void 0 }, | ||
toolWarnings | ||
@@ -95,3 +96,3 @@ }; | ||
return { | ||
toolConfiguration: { | ||
toolConfig: { | ||
tools: bedrockTools, | ||
@@ -104,3 +105,5 @@ toolChoice: { tool: { name: toolChoice.toolName } } | ||
const _exhaustiveCheck = type; | ||
throw new Error(`Unsupported tool choice type: ${_exhaustiveCheck}`); | ||
throw new import_provider.UnsupportedFunctionalityError({ | ||
functionality: `Unsupported tool choice type: ${_exhaustiveCheck}` | ||
}); | ||
} | ||
@@ -111,3 +114,3 @@ } | ||
// src/convert-to-bedrock-chat-messages.ts | ||
var import_provider = require("@ai-sdk/provider"); | ||
var import_provider2 = require("@ai-sdk/provider"); | ||
var import_provider_utils = require("@ai-sdk/provider-utils"); | ||
@@ -126,3 +129,3 @@ var generateFileId = (0, import_provider_utils.createIdGenerator)({ prefix: "file", size: 16 }); | ||
if (messages.length > 0) { | ||
throw new import_provider.UnsupportedFunctionalityError({ | ||
throw new import_provider2.UnsupportedFunctionalityError({ | ||
functionality: "Multiple system messages that are separated by user/assistant messages" | ||
@@ -151,3 +154,3 @@ }); | ||
if (part.image instanceof URL) { | ||
throw new import_provider.UnsupportedFunctionalityError({ | ||
throw new import_provider2.UnsupportedFunctionalityError({ | ||
functionality: "Image URLs in user messages" | ||
@@ -168,3 +171,3 @@ }); | ||
if (part.data instanceof URL) { | ||
throw new import_provider.UnsupportedFunctionalityError({ | ||
throw new import_provider2.UnsupportedFunctionalityError({ | ||
functionality: "File URLs in user messages" | ||
@@ -403,7 +406,7 @@ }); | ||
case "regular": { | ||
const { toolConfiguration, toolWarnings } = prepareTools(mode); | ||
const { toolConfig, toolWarnings } = prepareTools(mode); | ||
return { | ||
command: { | ||
...baseArgs, | ||
...((_b = toolConfiguration.tools) == null ? void 0 : _b.length) ? { toolConfiguration } : {} | ||
...((_b = toolConfig.tools) == null ? void 0 : _b.length) ? { toolConfig } : {} | ||
}, | ||
@@ -414,3 +417,3 @@ warnings: [...warnings, ...toolWarnings] | ||
case "object-json": { | ||
throw new import_provider2.UnsupportedFunctionalityError({ | ||
throw new import_provider3.UnsupportedFunctionalityError({ | ||
functionality: "json-mode object generation" | ||
@@ -417,0 +420,0 @@ }); |
# @ai-sdk/amazon-bedrock | ||
## 0.0.34 | ||
### Patch Changes | ||
- b01bbb7: fix (provider/bedrock): tool calling broken w/ sonnet 3.5 | ||
## 0.0.33 | ||
@@ -4,0 +10,0 @@ |
@@ -33,6 +33,7 @@ "use strict"; | ||
// src/bedrock-chat-language-model.ts | ||
var import_provider2 = require("@ai-sdk/provider"); | ||
var import_provider3 = require("@ai-sdk/provider"); | ||
var import_client_bedrock_runtime = require("@aws-sdk/client-bedrock-runtime"); | ||
// src/bedrock-prepare-tools.ts | ||
var import_provider = require("@ai-sdk/provider"); | ||
function prepareTools(mode) { | ||
@@ -43,3 +44,3 @@ var _a; | ||
return { | ||
toolConfiguration: { tools: void 0, toolChoice: void 0 }, | ||
toolConfig: { tools: void 0, toolChoice: void 0 }, | ||
toolWarnings: [] | ||
@@ -68,3 +69,3 @@ }; | ||
return { | ||
toolConfiguration: { tools: bedrockTools, toolChoice: void 0 }, | ||
toolConfig: { tools: bedrockTools, toolChoice: void 0 }, | ||
toolWarnings | ||
@@ -77,3 +78,3 @@ }; | ||
return { | ||
toolConfiguration: { tools: bedrockTools, toolChoice: { auto: {} } }, | ||
toolConfig: { tools: bedrockTools, toolChoice: { auto: {} } }, | ||
toolWarnings | ||
@@ -83,3 +84,3 @@ }; | ||
return { | ||
toolConfiguration: { tools: bedrockTools, toolChoice: { any: {} } }, | ||
toolConfig: { tools: bedrockTools, toolChoice: { any: {} } }, | ||
toolWarnings | ||
@@ -89,3 +90,3 @@ }; | ||
return { | ||
toolConfiguration: { tools: void 0, toolChoice: void 0 }, | ||
toolConfig: { tools: void 0, toolChoice: void 0 }, | ||
toolWarnings | ||
@@ -95,3 +96,3 @@ }; | ||
return { | ||
toolConfiguration: { | ||
toolConfig: { | ||
tools: bedrockTools, | ||
@@ -104,3 +105,5 @@ toolChoice: { tool: { name: toolChoice.toolName } } | ||
const _exhaustiveCheck = type; | ||
throw new Error(`Unsupported tool choice type: ${_exhaustiveCheck}`); | ||
throw new import_provider.UnsupportedFunctionalityError({ | ||
functionality: `Unsupported tool choice type: ${_exhaustiveCheck}` | ||
}); | ||
} | ||
@@ -111,3 +114,3 @@ } | ||
// src/convert-to-bedrock-chat-messages.ts | ||
var import_provider = require("@ai-sdk/provider"); | ||
var import_provider2 = require("@ai-sdk/provider"); | ||
var import_provider_utils = require("@ai-sdk/provider-utils"); | ||
@@ -126,3 +129,3 @@ var generateFileId = (0, import_provider_utils.createIdGenerator)({ prefix: "file", size: 16 }); | ||
if (messages.length > 0) { | ||
throw new import_provider.UnsupportedFunctionalityError({ | ||
throw new import_provider2.UnsupportedFunctionalityError({ | ||
functionality: "Multiple system messages that are separated by user/assistant messages" | ||
@@ -151,3 +154,3 @@ }); | ||
if (part.image instanceof URL) { | ||
throw new import_provider.UnsupportedFunctionalityError({ | ||
throw new import_provider2.UnsupportedFunctionalityError({ | ||
functionality: "Image URLs in user messages" | ||
@@ -168,3 +171,3 @@ }); | ||
if (part.data instanceof URL) { | ||
throw new import_provider.UnsupportedFunctionalityError({ | ||
throw new import_provider2.UnsupportedFunctionalityError({ | ||
functionality: "File URLs in user messages" | ||
@@ -403,7 +406,7 @@ }); | ||
case "regular": { | ||
const { toolConfiguration, toolWarnings } = prepareTools(mode); | ||
const { toolConfig, toolWarnings } = prepareTools(mode); | ||
return { | ||
command: { | ||
...baseArgs, | ||
...((_b = toolConfiguration.tools) == null ? void 0 : _b.length) ? { toolConfiguration } : {} | ||
...((_b = toolConfig.tools) == null ? void 0 : _b.length) ? { toolConfig } : {} | ||
}, | ||
@@ -414,3 +417,3 @@ warnings: [...warnings, ...toolWarnings] | ||
case "object-json": { | ||
throw new import_provider2.UnsupportedFunctionalityError({ | ||
throw new import_provider3.UnsupportedFunctionalityError({ | ||
functionality: "json-mode object generation" | ||
@@ -417,0 +420,0 @@ }); |
{ | ||
"name": "@ai-sdk/amazon-bedrock", | ||
"version": "0.0.33", | ||
"version": "0.0.34", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
167070
2123