@ai-sdk/anthropic 3.0.89 → 3.0.90
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 +6 -0
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +6 -4
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +6 -4
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/anthropic-messages-language-model.ts +12 -3
package/dist/internal/index.js
CHANGED
|
@@ -4453,6 +4453,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4453
4453
|
"bash_code_execution"
|
|
4454
4454
|
].includes(part.name)) {
|
|
4455
4455
|
const providerToolName = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? "code_execution" : part.name;
|
|
4456
|
+
const providerToolInputType = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? part.name : part.name === "code_execution" ? "programmatic-tool-call" : void 0;
|
|
4456
4457
|
const customToolName = toolNameMapping.toCustomToolName(providerToolName);
|
|
4457
4458
|
const finalInput = part.input != null && typeof part.input === "object" && Object.keys(part.input).length > 0 ? JSON.stringify(part.input) : "";
|
|
4458
4459
|
contentBlocks[value.index] = {
|
|
@@ -4466,8 +4467,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4466
4467
|
// tool was not explicitly provided. We therefore bypass the general validation by marking the
|
|
4467
4468
|
// tool as dynamic.
|
|
4468
4469
|
...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
4469
|
-
firstDelta:
|
|
4470
|
-
providerToolName
|
|
4470
|
+
firstDelta: finalInput.length === 0,
|
|
4471
|
+
providerToolName,
|
|
4472
|
+
providerToolInputType
|
|
4471
4473
|
};
|
|
4472
4474
|
controller.enqueue({
|
|
4473
4475
|
type: "tool-input-start",
|
|
@@ -4907,8 +4909,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4907
4909
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
|
|
4908
4910
|
return;
|
|
4909
4911
|
}
|
|
4910
|
-
if (contentBlock.firstDelta && contentBlock.
|
|
4911
|
-
delta = `{"type": "
|
|
4912
|
+
if (contentBlock.firstDelta && contentBlock.providerToolInputType != null) {
|
|
4913
|
+
delta = `{"type": "${contentBlock.providerToolInputType}",${delta.substring(1)}`;
|
|
4912
4914
|
}
|
|
4913
4915
|
controller.enqueue({
|
|
4914
4916
|
type: "tool-input-delta",
|