New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ai-sdk/anthropic

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/anthropic - npm Package Compare versions

Comparing version 0.0.51 to 0.0.53

230

./dist/index.js

@@ -134,6 +134,27 @@ "use strict";

const cacheControl = (_c = getCacheControl(part.providerMetadata)) != null ? _c : isLastPart ? getCacheControl(message.providerMetadata) : void 0;
const toolResultContent = part.content != null ? part.content.map((part2) => {
var _a2;
switch (part2.type) {
case "text":
return {
type: "text",
text: part2.text,
cache_control: void 0
};
case "image":
return {
type: "image",
source: {
type: "base64",
media_type: (_a2 = part2.mimeType) != null ? _a2 : "image/jpeg",
data: part2.data
},
cache_control: void 0
};
}
}) : JSON.stringify(part.result);
anthropicContent.push({
type: "tool_result",
tool_use_id: part.toolCallId,
content: JSON.stringify(part.result),
content: toolResultContent,
is_error: part.isError,

@@ -265,2 +286,86 @@ cache_control: cacheControl

// src/anthropic-prepare-tools.ts
function prepareTools(mode) {
var _a;
const tools = ((_a = mode.tools) == null ? void 0 : _a.length) ? mode.tools : void 0;
const toolWarnings = [];
if (tools == null) {
return { tools: void 0, tool_choice: void 0, toolWarnings };
}
const anthropicTools2 = [];
for (const tool of tools) {
switch (tool.type) {
case "function":
anthropicTools2.push({
name: tool.name,
description: tool.description,
input_schema: tool.parameters
});
break;
case "provider-defined":
switch (tool.id) {
case "anthropic.computer_20241022":
anthropicTools2.push({
name: tool.name,
type: "computer_20241022",
display_width_px: tool.args.displayWidthPx,
display_height_px: tool.args.displayHeightPx,
display_number: tool.args.displayNumber
});
break;
case "anthropic.text_editor_20241022":
anthropicTools2.push({
name: tool.name,
type: "text_editor_20241022"
});
break;
case "anthropic.bash_20241022":
anthropicTools2.push({
name: tool.name,
type: "bash_20241022"
});
break;
default:
toolWarnings.push({ type: "unsupported-tool", tool });
break;
}
break;
default:
toolWarnings.push({ type: "unsupported-tool", tool });
break;
}
}
const toolChoice = mode.toolChoice;
if (toolChoice == null) {
return { tools: anthropicTools2, tool_choice: void 0, toolWarnings };
}
const type = toolChoice.type;
switch (type) {
case "auto":
return {
tools: anthropicTools2,
tool_choice: { type: "auto" },
toolWarnings
};
case "required":
return {
tools: anthropicTools2,
tool_choice: { type: "any" },
toolWarnings
};
case "none":
return { tools: void 0, tool_choice: void 0, toolWarnings };
case "tool":
return {
tools: anthropicTools2,
tool_choice: { type: "tool", name: toolChoice.toolName },
toolWarnings
};
default: {
const _exhaustiveCheck = type;
throw new Error(`Unsupported tool choice type: ${_exhaustiveCheck}`);
}
}
}
// src/anthropic-messages-language-model.ts

@@ -341,5 +446,6 @@ var AnthropicMessagesLanguageModel = class {

case "regular": {
const { tools, tool_choice, toolWarnings } = prepareTools(mode);
return {
args: { ...baseArgs, ...prepareToolsAndToolChoice(mode) },
warnings
args: { ...baseArgs, tools, tool_choice },
warnings: [...warnings, ...toolWarnings]
};

@@ -431,3 +537,4 @@ }

}
} : void 0
} : void 0,
request: { body: JSON.stringify(args) }
};

@@ -437,6 +544,7 @@ }

const { args, warnings } = await this.getArgs(options);
const body = { ...args, stream: true };
const { responseHeaders, value: response } = await (0, import_provider_utils3.postJsonToApi)({
url: `${this.config.baseURL}/messages`,
headers: this.getHeaders(options.headers),
body: { ...args, stream: true },
body,
failedResponseHandler: anthropicFailedResponseHandler,

@@ -584,3 +692,4 @@ successfulResponseHandler: (0, import_provider_utils3.createEventSourceResponseHandler)(

rawResponse: { headers: responseHeaders },
warnings
warnings,
request: { body: JSON.stringify(body) }
};

@@ -681,36 +790,2 @@ }

]);
function prepareToolsAndToolChoice(mode) {
var _a;
const tools = ((_a = mode.tools) == null ? void 0 : _a.length) ? mode.tools : void 0;
if (tools == null) {
return { tools: void 0, tool_choice: void 0 };
}
const mappedTools = tools.map((tool) => ({
name: tool.name,
description: tool.description,
input_schema: tool.parameters
}));
const toolChoice = mode.toolChoice;
if (toolChoice == null) {
return { tools: mappedTools, tool_choice: void 0 };
}
const type = toolChoice.type;
switch (type) {
case "auto":
return { tools: mappedTools, tool_choice: { type: "auto" } };
case "required":
return { tools: mappedTools, tool_choice: { type: "any" } };
case "none":
return { tools: void 0, tool_choice: void 0 };
case "tool":
return {
tools: mappedTools,
tool_choice: { type: "tool", name: toolChoice.toolName }
};
default: {
const _exhaustiveCheck = type;
throw new Error(`Unsupported tool choice type: ${_exhaustiveCheck}`);
}
}
}

@@ -759,2 +834,75 @@ // src/anthropic-facade.ts

var import_provider_utils5 = require("@ai-sdk/provider-utils");
// src/anthropic-tools.ts
var import_zod3 = require("zod");
var Bash20241022Parameters = import_zod3.z.object({
command: import_zod3.z.string(),
restart: import_zod3.z.boolean().optional()
});
function bashTool_20241022(options = {}) {
return {
type: "provider-defined",
id: "anthropic.bash_20241022",
args: {},
parameters: Bash20241022Parameters,
execute: options.execute,
experimental_toToolResultContent: options.experimental_toToolResultContent
};
}
var TextEditor20241022Parameters = import_zod3.z.object({
command: import_zod3.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
path: import_zod3.z.string(),
file_text: import_zod3.z.string().optional(),
insert_line: import_zod3.z.number().int().optional(),
new_str: import_zod3.z.string().optional(),
old_str: import_zod3.z.string().optional(),
view_range: import_zod3.z.array(import_zod3.z.number().int()).optional()
});
function textEditorTool_20241022(options = {}) {
return {
type: "provider-defined",
id: "anthropic.text_editor_20241022",
args: {},
parameters: TextEditor20241022Parameters,
execute: options.execute,
experimental_toToolResultContent: options.experimental_toToolResultContent
};
}
var Computer20241022Parameters = import_zod3.z.object({
action: import_zod3.z.enum([
"key",
"type",
"mouse_move",
"left_click",
"left_click_drag",
"right_click",
"middle_click",
"double_click",
"screenshot",
"cursor_position"
]),
coordinate: import_zod3.z.array(import_zod3.z.number().int()).optional(),
text: import_zod3.z.string().optional()
});
function computerTool_20241022(options) {
return {
type: "provider-defined",
id: "anthropic.computer_20241022",
args: {
displayWidthPx: options.displayWidthPx,
displayHeightPx: options.displayHeightPx,
displayNumber: options.displayNumber
},
parameters: Computer20241022Parameters,
execute: options.execute,
experimental_toToolResultContent: options.experimental_toToolResultContent
};
}
var anthropicTools = {
bash_20241022: bashTool_20241022,
textEditor_20241022: textEditorTool_20241022,
computer_20241022: computerTool_20241022
};
// src/anthropic-provider.ts
function createAnthropic(options = {}) {

@@ -765,2 +913,3 @@ var _a, _b;

"anthropic-version": "2023-06-01",
"anthropic-beta": "computer-use-2024-10-22",
"x-api-key": (0, import_provider_utils5.loadApiKey)({

@@ -793,2 +942,3 @@ apiKey: options.apiKey,

};
provider.tools = anthropicTools;
return provider;

@@ -795,0 +945,0 @@ }

# @ai-sdk/anthropic
## 0.0.53
### Patch Changes
- 3b1b69a: feat (provider/anthropic): add computer use tools
- 3b1b69a: feat: provider-defined tools
- 8c222cd: feat (provider/anthropic): update model ids
- 811a317: feat (ai/core): multi-part tool results (incl. images)
- Updated dependencies [aa98cdb]
- Updated dependencies [1486128]
- Updated dependencies [7b937c5]
- Updated dependencies [3b1b69a]
- Updated dependencies [811a317]
- @ai-sdk/provider-utils@1.0.22
- @ai-sdk/provider@0.0.26
## 0.0.52
### Patch Changes
- b9b0d7b: feat (ai): access raw request body
- Updated dependencies [b9b0d7b]
- @ai-sdk/provider@0.0.25
- @ai-sdk/provider-utils@1.0.21
## 0.0.51

@@ -4,0 +29,0 @@

import { LanguageModelV1, ProviderV1 } from '@ai-sdk/provider';
import { FetchFunction } from '@ai-sdk/provider-utils';
import { z } from 'zod';
type AnthropicMessagesModelId = 'claude-3-5-sonnet-20240620' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | (string & {});
type AnthropicMessagesModelId = 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | (string & {});
interface AnthropicMessagesSettings {

@@ -43,2 +44,190 @@ /**

type ExecuteFunction<PARAMETERS, RESULT> = undefined | ((args: PARAMETERS, options: {
abortSignal?: AbortSignal;
}) => Promise<RESULT>);
type ToolResultContent = Array<{
type: 'text';
text: string;
} | {
type: 'image';
data: string;
mimeType?: string;
}>;
declare const Bash20241022Parameters: z.ZodObject<{
command: z.ZodString;
restart: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
command: string;
restart?: boolean | undefined;
}, {
command: string;
restart?: boolean | undefined;
}>;
/**
* Creates a tool for running a bash command. Must have name "bash".
*
* Image results are supported.
*
* @param execute - The function to execute the tool. Optional.
*/
declare function bashTool_20241022<RESULT>(options?: {
execute?: ExecuteFunction<{
/**
* The bash command to run. Required unless the tool is being restarted.
*/
command: string;
/**
* Specifying true will restart this tool. Otherwise, leave this unspecified.
*/
restart?: boolean;
}, RESULT>;
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
}): {
type: 'provider-defined';
id: 'anthropic.bash_20241022';
args: {};
parameters: typeof Bash20241022Parameters;
execute: ExecuteFunction<z.infer<typeof Bash20241022Parameters>, RESULT>;
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
};
declare const TextEditor20241022Parameters: z.ZodObject<{
command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
path: z.ZodString;
file_text: z.ZodOptional<z.ZodString>;
insert_line: z.ZodOptional<z.ZodNumber>;
new_str: z.ZodOptional<z.ZodString>;
old_str: z.ZodOptional<z.ZodString>;
view_range: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
}, "strip", z.ZodTypeAny, {
path: string;
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
file_text?: string | undefined;
insert_line?: number | undefined;
new_str?: string | undefined;
old_str?: string | undefined;
view_range?: number[] | undefined;
}, {
path: string;
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
file_text?: string | undefined;
insert_line?: number | undefined;
new_str?: string | undefined;
old_str?: string | undefined;
view_range?: number[] | undefined;
}>;
/**
* Creates a tool for editing text. Must have name "str_replace_editor".
*
* Image results are supported.
*
* @param execute - The function to execute the tool. Optional.
*/
declare function textEditorTool_20241022<RESULT>(options?: {
execute?: ExecuteFunction<{
/**
* The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.
*/
command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';
/**
* Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.
*/
path: string;
/**
* Required parameter of `create` command, with the content of the file to be created.
*/
file_text?: string;
/**
* Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.
*/
insert_line?: number;
/**
* Optional parameter of `str_replace` command containing the new string (if not given, no string will be added). Required parameter of `insert` command containing the string to insert.
*/
new_str?: string;
/**
* Required parameter of `str_replace` command containing the string in `path` to replace.
*/
old_str?: string;
/**
* Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.
*/
view_range?: number[];
}, RESULT>;
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
}): {
type: 'provider-defined';
id: 'anthropic.text_editor_20241022';
args: {};
parameters: typeof TextEditor20241022Parameters;
execute: ExecuteFunction<z.infer<typeof TextEditor20241022Parameters>, RESULT>;
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
};
declare const Computer20241022Parameters: z.ZodObject<{
action: z.ZodEnum<["key", "type", "mouse_move", "left_click", "left_click_drag", "right_click", "middle_click", "double_click", "screenshot", "cursor_position"]>;
coordinate: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
text: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
action: "type" | "key" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
text?: string | undefined;
coordinate?: number[] | undefined;
}, {
action: "type" | "key" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
text?: string | undefined;
coordinate?: number[] | undefined;
}>;
/**
* Creates a tool for executing actions on a computer. Must have name "computer".
*
* Image results are supported.
*
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
* @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
* @param execute - The function to execute the tool. Optional.
*/
declare function computerTool_20241022<RESULT>(options: {
displayWidthPx: number;
displayHeightPx: number;
displayNumber?: number;
execute?: ExecuteFunction<{
/**
* The action to perform. The available actions are:
* - `key`: Press a key or key-combination on the keyboard.
* - This supports xdotool's `key` syntax.
* - Examples: "a", "Return", "alt+Tab", "ctrl+s", "Up", "KP_0" (for the numpad 0 key).
* - `type`: Type a string of text on the keyboard.
* - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.
* - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.
* - `left_click`: Click the left mouse button.
* - `left_click_drag`: Click and drag the cursor to a specified (x, y) pixel coordinate on the screen.
* - `right_click`: Click the right mouse button.
* - `middle_click`: Click the middle mouse button.
* - `double_click`: Double-click the left mouse button.
* - `screenshot`: Take a screenshot of the screen.
*/
action: 'key' | 'type' | 'mouse_move' | 'left_click' | 'left_click_drag' | 'right_click' | 'middle_click' | 'double_click' | 'screenshot' | 'cursor_position';
/**
* (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=mouse_move` and `action=left_click_drag`.
*/
coordinate?: number[];
/**
* Required only by `action=type` and `action=key`.
*/
text?: string;
}, RESULT>;
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
}): {
type: 'provider-defined';
id: 'anthropic.computer_20241022';
args: {};
parameters: typeof Computer20241022Parameters;
execute: ExecuteFunction<z.infer<typeof Computer20241022Parameters>, RESULT>;
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
};
declare const anthropicTools: {
bash_20241022: typeof bashTool_20241022;
textEditor_20241022: typeof textEditorTool_20241022;
computer_20241022: typeof computerTool_20241022;
};
interface AnthropicProvider extends ProviderV1 {

@@ -61,2 +250,6 @@ /**

messages(modelId: AnthropicMessagesModelId, settings?: AnthropicMessagesSettings): LanguageModelV1;
/**
Anthropic-specific computer use tool.
*/
tools: typeof anthropicTools;
}

@@ -63,0 +256,0 @@ interface AnthropicProviderSettings {

@@ -134,6 +134,27 @@ "use strict";

const cacheControl = (_c = getCacheControl(part.providerMetadata)) != null ? _c : isLastPart ? getCacheControl(message.providerMetadata) : void 0;
const toolResultContent = part.content != null ? part.content.map((part2) => {
var _a2;
switch (part2.type) {
case "text":
return {
type: "text",
text: part2.text,
cache_control: void 0
};
case "image":
return {
type: "image",
source: {
type: "base64",
media_type: (_a2 = part2.mimeType) != null ? _a2 : "image/jpeg",
data: part2.data
},
cache_control: void 0
};
}
}) : JSON.stringify(part.result);
anthropicContent.push({
type: "tool_result",
tool_use_id: part.toolCallId,
content: JSON.stringify(part.result),
content: toolResultContent,
is_error: part.isError,

@@ -265,2 +286,86 @@ cache_control: cacheControl

// src/anthropic-prepare-tools.ts
function prepareTools(mode) {
var _a;
const tools = ((_a = mode.tools) == null ? void 0 : _a.length) ? mode.tools : void 0;
const toolWarnings = [];
if (tools == null) {
return { tools: void 0, tool_choice: void 0, toolWarnings };
}
const anthropicTools2 = [];
for (const tool of tools) {
switch (tool.type) {
case "function":
anthropicTools2.push({
name: tool.name,
description: tool.description,
input_schema: tool.parameters
});
break;
case "provider-defined":
switch (tool.id) {
case "anthropic.computer_20241022":
anthropicTools2.push({
name: tool.name,
type: "computer_20241022",
display_width_px: tool.args.displayWidthPx,
display_height_px: tool.args.displayHeightPx,
display_number: tool.args.displayNumber
});
break;
case "anthropic.text_editor_20241022":
anthropicTools2.push({
name: tool.name,
type: "text_editor_20241022"
});
break;
case "anthropic.bash_20241022":
anthropicTools2.push({
name: tool.name,
type: "bash_20241022"
});
break;
default:
toolWarnings.push({ type: "unsupported-tool", tool });
break;
}
break;
default:
toolWarnings.push({ type: "unsupported-tool", tool });
break;
}
}
const toolChoice = mode.toolChoice;
if (toolChoice == null) {
return { tools: anthropicTools2, tool_choice: void 0, toolWarnings };
}
const type = toolChoice.type;
switch (type) {
case "auto":
return {
tools: anthropicTools2,
tool_choice: { type: "auto" },
toolWarnings
};
case "required":
return {
tools: anthropicTools2,
tool_choice: { type: "any" },
toolWarnings
};
case "none":
return { tools: void 0, tool_choice: void 0, toolWarnings };
case "tool":
return {
tools: anthropicTools2,
tool_choice: { type: "tool", name: toolChoice.toolName },
toolWarnings
};
default: {
const _exhaustiveCheck = type;
throw new Error(`Unsupported tool choice type: ${_exhaustiveCheck}`);
}
}
}
// src/anthropic-messages-language-model.ts

@@ -341,5 +446,6 @@ var AnthropicMessagesLanguageModel = class {

case "regular": {
const { tools, tool_choice, toolWarnings } = prepareTools(mode);
return {
args: { ...baseArgs, ...prepareToolsAndToolChoice(mode) },
warnings
args: { ...baseArgs, tools, tool_choice },
warnings: [...warnings, ...toolWarnings]
};

@@ -431,3 +537,4 @@ }

}
} : void 0
} : void 0,
request: { body: JSON.stringify(args) }
};

@@ -437,6 +544,7 @@ }

const { args, warnings } = await this.getArgs(options);
const body = { ...args, stream: true };
const { responseHeaders, value: response } = await (0, import_provider_utils3.postJsonToApi)({
url: `${this.config.baseURL}/messages`,
headers: this.getHeaders(options.headers),
body: { ...args, stream: true },
body,
failedResponseHandler: anthropicFailedResponseHandler,

@@ -584,3 +692,4 @@ successfulResponseHandler: (0, import_provider_utils3.createEventSourceResponseHandler)(

rawResponse: { headers: responseHeaders },
warnings
warnings,
request: { body: JSON.stringify(body) }
};

@@ -681,36 +790,2 @@ }

]);
function prepareToolsAndToolChoice(mode) {
var _a;
const tools = ((_a = mode.tools) == null ? void 0 : _a.length) ? mode.tools : void 0;
if (tools == null) {
return { tools: void 0, tool_choice: void 0 };
}
const mappedTools = tools.map((tool) => ({
name: tool.name,
description: tool.description,
input_schema: tool.parameters
}));
const toolChoice = mode.toolChoice;
if (toolChoice == null) {
return { tools: mappedTools, tool_choice: void 0 };
}
const type = toolChoice.type;
switch (type) {
case "auto":
return { tools: mappedTools, tool_choice: { type: "auto" } };
case "required":
return { tools: mappedTools, tool_choice: { type: "any" } };
case "none":
return { tools: void 0, tool_choice: void 0 };
case "tool":
return {
tools: mappedTools,
tool_choice: { type: "tool", name: toolChoice.toolName }
};
default: {
const _exhaustiveCheck = type;
throw new Error(`Unsupported tool choice type: ${_exhaustiveCheck}`);
}
}
}

@@ -759,2 +834,75 @@ // src/anthropic-facade.ts

var import_provider_utils5 = require("@ai-sdk/provider-utils");
// src/anthropic-tools.ts
var import_zod3 = require("zod");
var Bash20241022Parameters = import_zod3.z.object({
command: import_zod3.z.string(),
restart: import_zod3.z.boolean().optional()
});
function bashTool_20241022(options = {}) {
return {
type: "provider-defined",
id: "anthropic.bash_20241022",
args: {},
parameters: Bash20241022Parameters,
execute: options.execute,
experimental_toToolResultContent: options.experimental_toToolResultContent
};
}
var TextEditor20241022Parameters = import_zod3.z.object({
command: import_zod3.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
path: import_zod3.z.string(),
file_text: import_zod3.z.string().optional(),
insert_line: import_zod3.z.number().int().optional(),
new_str: import_zod3.z.string().optional(),
old_str: import_zod3.z.string().optional(),
view_range: import_zod3.z.array(import_zod3.z.number().int()).optional()
});
function textEditorTool_20241022(options = {}) {
return {
type: "provider-defined",
id: "anthropic.text_editor_20241022",
args: {},
parameters: TextEditor20241022Parameters,
execute: options.execute,
experimental_toToolResultContent: options.experimental_toToolResultContent
};
}
var Computer20241022Parameters = import_zod3.z.object({
action: import_zod3.z.enum([
"key",
"type",
"mouse_move",
"left_click",
"left_click_drag",
"right_click",
"middle_click",
"double_click",
"screenshot",
"cursor_position"
]),
coordinate: import_zod3.z.array(import_zod3.z.number().int()).optional(),
text: import_zod3.z.string().optional()
});
function computerTool_20241022(options) {
return {
type: "provider-defined",
id: "anthropic.computer_20241022",
args: {
displayWidthPx: options.displayWidthPx,
displayHeightPx: options.displayHeightPx,
displayNumber: options.displayNumber
},
parameters: Computer20241022Parameters,
execute: options.execute,
experimental_toToolResultContent: options.experimental_toToolResultContent
};
}
var anthropicTools = {
bash_20241022: bashTool_20241022,
textEditor_20241022: textEditorTool_20241022,
computer_20241022: computerTool_20241022
};
// src/anthropic-provider.ts
function createAnthropic(options = {}) {

@@ -765,2 +913,3 @@ var _a, _b;

"anthropic-version": "2023-06-01",
"anthropic-beta": "computer-use-2024-10-22",
"x-api-key": (0, import_provider_utils5.loadApiKey)({

@@ -793,2 +942,3 @@ apiKey: options.apiKey,

};
provider.tools = anthropicTools;
return provider;

@@ -795,0 +945,0 @@ }

6

package.json
{
"name": "@ai-sdk/anthropic",
"version": "0.0.51",
"version": "0.0.53",
"license": "Apache-2.0",

@@ -22,4 +22,4 @@ "sideEffects": false,

"dependencies": {
"@ai-sdk/provider": "0.0.24",
"@ai-sdk/provider-utils": "1.0.20"
"@ai-sdk/provider": "0.0.26",
"@ai-sdk/provider-utils": "1.0.22"
},

@@ -26,0 +26,0 @@ "devDependencies": {

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc