@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.mjs
CHANGED
|
@@ -4494,6 +4494,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4494
4494
|
"bash_code_execution"
|
|
4495
4495
|
].includes(part.name)) {
|
|
4496
4496
|
const providerToolName = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? "code_execution" : part.name;
|
|
4497
|
+
const providerToolInputType = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? part.name : part.name === "code_execution" ? "programmatic-tool-call" : void 0;
|
|
4497
4498
|
const customToolName = toolNameMapping.toCustomToolName(providerToolName);
|
|
4498
4499
|
const finalInput = part.input != null && typeof part.input === "object" && Object.keys(part.input).length > 0 ? JSON.stringify(part.input) : "";
|
|
4499
4500
|
contentBlocks[value.index] = {
|
|
@@ -4507,8 +4508,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4507
4508
|
// tool was not explicitly provided. We therefore bypass the general validation by marking the
|
|
4508
4509
|
// tool as dynamic.
|
|
4509
4510
|
...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
4510
|
-
firstDelta:
|
|
4511
|
-
providerToolName
|
|
4511
|
+
firstDelta: finalInput.length === 0,
|
|
4512
|
+
providerToolName,
|
|
4513
|
+
providerToolInputType
|
|
4512
4514
|
};
|
|
4513
4515
|
controller.enqueue({
|
|
4514
4516
|
type: "tool-input-start",
|
|
@@ -4948,8 +4950,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4948
4950
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
|
|
4949
4951
|
return;
|
|
4950
4952
|
}
|
|
4951
|
-
if (contentBlock.firstDelta && contentBlock.
|
|
4952
|
-
delta = `{"type": "
|
|
4953
|
+
if (contentBlock.firstDelta && contentBlock.providerToolInputType != null) {
|
|
4954
|
+
delta = `{"type": "${contentBlock.providerToolInputType}",${delta.substring(1)}`;
|
|
4953
4955
|
}
|
|
4954
4956
|
controller.enqueue({
|
|
4955
4957
|
type: "tool-input-delta",
|