@browserbasehq/stagehand 3.0.8-alpha-088c4cc31dc924bb232a9d5a09ab42cd961c2d36 → 3.0.8-alpha-72ac775a831d6f0f376ceda4426525f93cc21452
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/dist/index.d.ts +1 -1
- package/dist/index.js +191 -186
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { ClientOptions as ClientOptions$1 } from 'openai';
|
|
|
8
8
|
import { Client, ClientOptions as ClientOptions$3 } from '@modelcontextprotocol/sdk/client/index.js';
|
|
9
9
|
import * as ai from 'ai';
|
|
10
10
|
import { ToolSet, ModelMessage, PrepareStepFunction, GenerateTextOnStepFinishCallback, StreamTextOnStepFinishCallback, StreamTextOnErrorCallback, StreamTextOnChunkCallback, StreamTextOnFinishCallback, StepResult, StreamTextResult, wrapLanguageModel, generateObject, generateText, streamText, streamObject, experimental_generateImage, embed, embedMany, experimental_transcribe, experimental_generateSpeech, InferUITools } from 'ai';
|
|
11
|
-
export { ModelMessage } from 'ai';
|
|
11
|
+
export { ModelMessage, Tool, tool } from 'ai';
|
|
12
12
|
import { Page as Page$1 } from 'playwright-core';
|
|
13
13
|
export { Page as PlaywrightPage } from 'playwright-core';
|
|
14
14
|
import { Page as Page$2 } from 'puppeteer-core';
|
package/dist/index.js
CHANGED
|
@@ -27155,6 +27155,7 @@ __export(v3_exports, {
|
|
|
27155
27155
|
providerEnvVarMap: () => providerEnvVarMap,
|
|
27156
27156
|
toGeminiSchema: () => toGeminiSchema,
|
|
27157
27157
|
toJsonSchema: () => toJsonSchema,
|
|
27158
|
+
tool: () => import_ai23.tool,
|
|
27158
27159
|
transformSchema: () => transformSchema,
|
|
27159
27160
|
trimTrailingTextNode: () => trimTrailingTextNode,
|
|
27160
27161
|
validateZodSchema: () => validateZodSchema
|
|
@@ -32355,8 +32356,8 @@ function buildToolsSection(isHybridMode, hasSearch, excludeTools) {
|
|
|
32355
32356
|
description: "Perform a web search and return results. Prefer this over navigating to Google and searching within the page for reliability and efficiency."
|
|
32356
32357
|
});
|
|
32357
32358
|
}
|
|
32358
|
-
const filteredTools = baseTools.filter((
|
|
32359
|
-
const toolLines = filteredTools.map((
|
|
32359
|
+
const filteredTools = baseTools.filter((tool22) => !excludeSet.has(tool22.name));
|
|
32360
|
+
const toolLines = filteredTools.map((tool22) => ` <tool name="${tool22.name}">${tool22.description}</tool>`).join("\n");
|
|
32360
32361
|
return `<tools>
|
|
32361
32362
|
${toolLines}
|
|
32362
32363
|
</tools>`;
|
|
@@ -33549,8 +33550,8 @@ var AnthropicCUAClient = class extends AgentClient {
|
|
|
33549
33550
|
betas: ["computer-use-2025-01-24"]
|
|
33550
33551
|
};
|
|
33551
33552
|
if (this.tools && Object.keys(this.tools).length > 0) {
|
|
33552
|
-
const customTools = Object.entries(this.tools).map(([name,
|
|
33553
|
-
const schema =
|
|
33553
|
+
const customTools = Object.entries(this.tools).map(([name, tool22]) => {
|
|
33554
|
+
const schema = tool22.inputSchema;
|
|
33554
33555
|
const jsonSchema3 = toJsonSchema(schema);
|
|
33555
33556
|
const inputSchema = {
|
|
33556
33557
|
type: "object",
|
|
@@ -33559,7 +33560,7 @@ var AnthropicCUAClient = class extends AgentClient {
|
|
|
33559
33560
|
};
|
|
33560
33561
|
return {
|
|
33561
33562
|
name,
|
|
33562
|
-
description:
|
|
33563
|
+
description: tool22.description,
|
|
33563
33564
|
input_schema: inputSchema
|
|
33564
33565
|
};
|
|
33565
33566
|
});
|
|
@@ -33677,13 +33678,13 @@ var AnthropicCUAClient = class extends AgentClient {
|
|
|
33677
33678
|
let toolResult = "Tool executed successfully";
|
|
33678
33679
|
if (this.tools && item.name in this.tools) {
|
|
33679
33680
|
try {
|
|
33680
|
-
const
|
|
33681
|
+
const tool22 = this.tools[item.name];
|
|
33681
33682
|
logger({
|
|
33682
33683
|
category: "agent",
|
|
33683
33684
|
message: `Executing tool call: ${item.name} with args: ${JSON.stringify(item.input)}`,
|
|
33684
33685
|
level: 1
|
|
33685
33686
|
});
|
|
33686
|
-
const result = yield
|
|
33687
|
+
const result = yield tool22.execute(item.input, {
|
|
33687
33688
|
toolCallId: item.id,
|
|
33688
33689
|
messages: []
|
|
33689
33690
|
});
|
|
@@ -34245,13 +34246,13 @@ var OpenAICUAClient = class extends AgentClient {
|
|
|
34245
34246
|
truncation: "auto"
|
|
34246
34247
|
};
|
|
34247
34248
|
if (this.tools && Object.keys(this.tools).length > 0) {
|
|
34248
|
-
const customTools = Object.entries(this.tools).map(([name,
|
|
34249
|
+
const customTools = Object.entries(this.tools).map(([name, tool22]) => ({
|
|
34249
34250
|
type: "function",
|
|
34250
34251
|
name,
|
|
34251
34252
|
function: {
|
|
34252
34253
|
name,
|
|
34253
|
-
description:
|
|
34254
|
-
parameters:
|
|
34254
|
+
description: tool22.description,
|
|
34255
|
+
parameters: tool22.inputSchema
|
|
34255
34256
|
}
|
|
34256
34257
|
}));
|
|
34257
34258
|
requestParams.tools = [
|
|
@@ -34403,14 +34404,14 @@ var OpenAICUAClient = class extends AgentClient {
|
|
|
34403
34404
|
let toolResult = "Tool executed successfully";
|
|
34404
34405
|
if (this.tools && item.name in this.tools) {
|
|
34405
34406
|
try {
|
|
34406
|
-
const
|
|
34407
|
+
const tool22 = this.tools[item.name];
|
|
34407
34408
|
const args = JSON.parse(item.arguments);
|
|
34408
34409
|
logger({
|
|
34409
34410
|
category: "agent",
|
|
34410
34411
|
message: `Executing tool call: ${item.name} with args: ${item.arguments}`,
|
|
34411
34412
|
level: 1
|
|
34412
34413
|
});
|
|
34413
|
-
const result = yield
|
|
34414
|
+
const result = yield tool22.execute(args, {
|
|
34414
34415
|
toolCallId: item.call_id,
|
|
34415
34416
|
messages: []
|
|
34416
34417
|
});
|
|
@@ -34573,8 +34574,8 @@ function executeGoogleCustomTool(toolName, toolArgs, tools, functionCall, logger
|
|
|
34573
34574
|
message: `Executing custom tool: ${toolName} with args: ${JSON.stringify(toolArgs)}`,
|
|
34574
34575
|
level: 1
|
|
34575
34576
|
});
|
|
34576
|
-
const
|
|
34577
|
-
const toolResult = yield
|
|
34577
|
+
const tool22 = tools[toolName];
|
|
34578
|
+
const toolResult = yield tool22.execute(toolArgs, {
|
|
34578
34579
|
toolCallId: `tool_${Date.now()}`,
|
|
34579
34580
|
messages: []
|
|
34580
34581
|
});
|
|
@@ -34622,22 +34623,22 @@ function isCustomTool(functionCall, tools) {
|
|
|
34622
34623
|
}
|
|
34623
34624
|
function convertToolSetToFunctionDeclarations(tools) {
|
|
34624
34625
|
const functionDeclarations = [];
|
|
34625
|
-
for (const [name,
|
|
34626
|
-
const functionDeclaration = convertToolToFunctionDeclaration(name,
|
|
34626
|
+
for (const [name, tool22] of Object.entries(tools)) {
|
|
34627
|
+
const functionDeclaration = convertToolToFunctionDeclaration(name, tool22);
|
|
34627
34628
|
if (functionDeclaration) {
|
|
34628
34629
|
functionDeclarations.push(functionDeclaration);
|
|
34629
34630
|
}
|
|
34630
34631
|
}
|
|
34631
34632
|
return functionDeclarations;
|
|
34632
34633
|
}
|
|
34633
|
-
function convertToolToFunctionDeclaration(name,
|
|
34634
|
+
function convertToolToFunctionDeclaration(name, tool22) {
|
|
34634
34635
|
try {
|
|
34635
|
-
const schema =
|
|
34636
|
+
const schema = tool22.inputSchema;
|
|
34636
34637
|
const jsonSchema3 = toJsonSchema(schema);
|
|
34637
34638
|
const parameters = convertJsonSchemaToGoogleParameters(jsonSchema3);
|
|
34638
34639
|
return {
|
|
34639
34640
|
name,
|
|
34640
|
-
description:
|
|
34641
|
+
description: tool22.description || `Execute ${name}`,
|
|
34641
34642
|
parameters
|
|
34642
34643
|
};
|
|
34643
34644
|
} catch (error) {
|
|
@@ -38128,10 +38129,10 @@ You must respond in JSON format. respond WITH JSON. Do not include any other tex
|
|
|
38128
38129
|
}
|
|
38129
38130
|
const tools = {};
|
|
38130
38131
|
if (options.tools && options.tools.length > 0) {
|
|
38131
|
-
for (const
|
|
38132
|
-
tools[
|
|
38133
|
-
description:
|
|
38134
|
-
inputSchema:
|
|
38132
|
+
for (const tool22 of options.tools) {
|
|
38133
|
+
tools[tool22.name] = {
|
|
38134
|
+
description: tool22.description,
|
|
38135
|
+
inputSchema: tool22.parameters
|
|
38135
38136
|
};
|
|
38136
38137
|
}
|
|
38137
38138
|
}
|
|
@@ -38330,14 +38331,14 @@ var AnthropicClient = class extends LLMClient {
|
|
|
38330
38331
|
}
|
|
38331
38332
|
formattedMessages.push(screenshotMessage);
|
|
38332
38333
|
}
|
|
38333
|
-
let anthropicTools2 = (_a4 = options.tools) == null ? void 0 : _a4.map((
|
|
38334
|
+
let anthropicTools2 = (_a4 = options.tools) == null ? void 0 : _a4.map((tool22) => {
|
|
38334
38335
|
return {
|
|
38335
|
-
name:
|
|
38336
|
-
description:
|
|
38336
|
+
name: tool22.name,
|
|
38337
|
+
description: tool22.description,
|
|
38337
38338
|
input_schema: {
|
|
38338
38339
|
type: "object",
|
|
38339
|
-
properties:
|
|
38340
|
-
required:
|
|
38340
|
+
properties: tool22.parameters.properties,
|
|
38341
|
+
required: tool22.parameters.required
|
|
38341
38342
|
}
|
|
38342
38343
|
};
|
|
38343
38344
|
});
|
|
@@ -38524,15 +38525,15 @@ var CerebrasClient = class extends LLMClient {
|
|
|
38524
38525
|
return __spreadProps(__spreadValues({}, baseMessage), { role: "user" });
|
|
38525
38526
|
}
|
|
38526
38527
|
});
|
|
38527
|
-
let tools = (_a4 = options.tools) == null ? void 0 : _a4.map((
|
|
38528
|
+
let tools = (_a4 = options.tools) == null ? void 0 : _a4.map((tool22) => ({
|
|
38528
38529
|
type: "function",
|
|
38529
38530
|
function: {
|
|
38530
|
-
name:
|
|
38531
|
-
description:
|
|
38531
|
+
name: tool22.name,
|
|
38532
|
+
description: tool22.description,
|
|
38532
38533
|
parameters: {
|
|
38533
38534
|
type: "object",
|
|
38534
|
-
properties:
|
|
38535
|
-
required:
|
|
38535
|
+
properties: tool22.parameters.properties,
|
|
38536
|
+
required: tool22.parameters.required
|
|
38536
38537
|
}
|
|
38537
38538
|
}
|
|
38538
38539
|
}));
|
|
@@ -38825,18 +38826,18 @@ ${firstPartText.text}`;
|
|
|
38825
38826
|
}
|
|
38826
38827
|
return [
|
|
38827
38828
|
{
|
|
38828
|
-
functionDeclarations: tools.map((
|
|
38829
|
+
functionDeclarations: tools.map((tool22) => {
|
|
38829
38830
|
let parameters = void 0;
|
|
38830
|
-
if (
|
|
38831
|
+
if (tool22.parameters) {
|
|
38831
38832
|
parameters = {
|
|
38832
38833
|
type: import_genai4.Type.OBJECT,
|
|
38833
|
-
properties:
|
|
38834
|
-
required:
|
|
38834
|
+
properties: tool22.parameters.properties,
|
|
38835
|
+
required: tool22.parameters.required
|
|
38835
38836
|
};
|
|
38836
38837
|
}
|
|
38837
38838
|
return {
|
|
38838
|
-
name:
|
|
38839
|
-
description:
|
|
38839
|
+
name: tool22.name,
|
|
38840
|
+
description: tool22.description,
|
|
38840
38841
|
parameters
|
|
38841
38842
|
};
|
|
38842
38843
|
})
|
|
@@ -39112,15 +39113,15 @@ var GroqClient = class extends LLMClient {
|
|
|
39112
39113
|
return __spreadProps(__spreadValues({}, baseMessage), { role: "user" });
|
|
39113
39114
|
}
|
|
39114
39115
|
});
|
|
39115
|
-
let tools = (_a4 = options.tools) == null ? void 0 : _a4.map((
|
|
39116
|
+
let tools = (_a4 = options.tools) == null ? void 0 : _a4.map((tool22) => ({
|
|
39116
39117
|
type: "function",
|
|
39117
39118
|
function: {
|
|
39118
|
-
name:
|
|
39119
|
-
description:
|
|
39119
|
+
name: tool22.name,
|
|
39120
|
+
description: tool22.description,
|
|
39120
39121
|
parameters: {
|
|
39121
39122
|
type: "object",
|
|
39122
|
-
properties:
|
|
39123
|
-
required:
|
|
39123
|
+
properties: tool22.parameters.properties,
|
|
39124
|
+
required: tool22.parameters.required
|
|
39124
39125
|
}
|
|
39125
39126
|
}
|
|
39126
39127
|
}));
|
|
@@ -39497,11 +39498,11 @@ ${parsedSchema}
|
|
|
39497
39498
|
messages: formattedMessages,
|
|
39498
39499
|
response_format: responseFormat,
|
|
39499
39500
|
stream: false,
|
|
39500
|
-
tools: (_e = options.tools) == null ? void 0 : _e.map((
|
|
39501
|
+
tools: (_e = options.tools) == null ? void 0 : _e.map((tool22) => ({
|
|
39501
39502
|
function: {
|
|
39502
|
-
name:
|
|
39503
|
-
description:
|
|
39504
|
-
parameters:
|
|
39503
|
+
name: tool22.name,
|
|
39504
|
+
description: tool22.description,
|
|
39505
|
+
parameters: tool22.parameters
|
|
39505
39506
|
},
|
|
39506
39507
|
type: "function"
|
|
39507
39508
|
}))
|
|
@@ -42167,21 +42168,21 @@ function prepareChatTools({
|
|
|
42167
42168
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
42168
42169
|
}
|
|
42169
42170
|
const openaiTools2 = [];
|
|
42170
|
-
for (const
|
|
42171
|
-
switch (
|
|
42171
|
+
for (const tool22 of tools) {
|
|
42172
|
+
switch (tool22.type) {
|
|
42172
42173
|
case "function":
|
|
42173
42174
|
openaiTools2.push({
|
|
42174
42175
|
type: "function",
|
|
42175
42176
|
function: {
|
|
42176
|
-
name:
|
|
42177
|
-
description:
|
|
42178
|
-
parameters:
|
|
42177
|
+
name: tool22.name,
|
|
42178
|
+
description: tool22.description,
|
|
42179
|
+
parameters: tool22.inputSchema,
|
|
42179
42180
|
strict: structuredOutputs ? strictJsonSchema : void 0
|
|
42180
42181
|
}
|
|
42181
42182
|
});
|
|
42182
42183
|
break;
|
|
42183
42184
|
default:
|
|
42184
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
42185
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
42185
42186
|
break;
|
|
42186
42187
|
}
|
|
42187
42188
|
}
|
|
@@ -44497,22 +44498,22 @@ function prepareResponsesTools(_0) {
|
|
|
44497
44498
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
44498
44499
|
}
|
|
44499
44500
|
const openaiTools2 = [];
|
|
44500
|
-
for (const
|
|
44501
|
-
switch (
|
|
44501
|
+
for (const tool22 of tools) {
|
|
44502
|
+
switch (tool22.type) {
|
|
44502
44503
|
case "function":
|
|
44503
44504
|
openaiTools2.push({
|
|
44504
44505
|
type: "function",
|
|
44505
|
-
name:
|
|
44506
|
-
description:
|
|
44507
|
-
parameters:
|
|
44506
|
+
name: tool22.name,
|
|
44507
|
+
description: tool22.description,
|
|
44508
|
+
parameters: tool22.inputSchema,
|
|
44508
44509
|
strict: strictJsonSchema
|
|
44509
44510
|
});
|
|
44510
44511
|
break;
|
|
44511
44512
|
case "provider-defined": {
|
|
44512
|
-
switch (
|
|
44513
|
+
switch (tool22.id) {
|
|
44513
44514
|
case "openai.file_search": {
|
|
44514
44515
|
const args = yield validateTypes({
|
|
44515
|
-
value:
|
|
44516
|
+
value: tool22.args,
|
|
44516
44517
|
schema: fileSearchArgsSchema
|
|
44517
44518
|
});
|
|
44518
44519
|
openaiTools2.push({
|
|
@@ -44535,7 +44536,7 @@ function prepareResponsesTools(_0) {
|
|
|
44535
44536
|
}
|
|
44536
44537
|
case "openai.web_search_preview": {
|
|
44537
44538
|
const args = yield validateTypes({
|
|
44538
|
-
value:
|
|
44539
|
+
value: tool22.args,
|
|
44539
44540
|
schema: webSearchPreviewArgsSchema
|
|
44540
44541
|
});
|
|
44541
44542
|
openaiTools2.push({
|
|
@@ -44547,7 +44548,7 @@ function prepareResponsesTools(_0) {
|
|
|
44547
44548
|
}
|
|
44548
44549
|
case "openai.web_search": {
|
|
44549
44550
|
const args = yield validateTypes({
|
|
44550
|
-
value:
|
|
44551
|
+
value: tool22.args,
|
|
44551
44552
|
schema: webSearchArgsSchema
|
|
44552
44553
|
});
|
|
44553
44554
|
openaiTools2.push({
|
|
@@ -44560,7 +44561,7 @@ function prepareResponsesTools(_0) {
|
|
|
44560
44561
|
}
|
|
44561
44562
|
case "openai.code_interpreter": {
|
|
44562
44563
|
const args = yield validateTypes({
|
|
44563
|
-
value:
|
|
44564
|
+
value: tool22.args,
|
|
44564
44565
|
schema: codeInterpreterArgsSchema
|
|
44565
44566
|
});
|
|
44566
44567
|
openaiTools2.push({
|
|
@@ -44571,7 +44572,7 @@ function prepareResponsesTools(_0) {
|
|
|
44571
44572
|
}
|
|
44572
44573
|
case "openai.image_generation": {
|
|
44573
44574
|
const args = yield validateTypes({
|
|
44574
|
-
value:
|
|
44575
|
+
value: tool22.args,
|
|
44575
44576
|
schema: imageGenerationArgsSchema
|
|
44576
44577
|
});
|
|
44577
44578
|
openaiTools2.push({
|
|
@@ -44595,7 +44596,7 @@ function prepareResponsesTools(_0) {
|
|
|
44595
44596
|
break;
|
|
44596
44597
|
}
|
|
44597
44598
|
default:
|
|
44598
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
44599
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
44599
44600
|
break;
|
|
44600
44601
|
}
|
|
44601
44602
|
}
|
|
@@ -44700,7 +44701,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
44700
44701
|
}
|
|
44701
44702
|
function hasOpenAITool(id) {
|
|
44702
44703
|
return (tools == null ? void 0 : tools.find(
|
|
44703
|
-
(
|
|
44704
|
+
(tool22) => tool22.type === "provider-defined" && tool22.id === id
|
|
44704
44705
|
)) != null;
|
|
44705
44706
|
}
|
|
44706
44707
|
const topLogprobs = typeof (openaiOptions == null ? void 0 : openaiOptions.logprobs) === "number" ? openaiOptions == null ? void 0 : openaiOptions.logprobs : (openaiOptions == null ? void 0 : openaiOptions.logprobs) === true ? TOP_LOGPROBS_MAX : void 0;
|
|
@@ -44708,7 +44709,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
44708
44709
|
addInclude("message.output_text.logprobs");
|
|
44709
44710
|
}
|
|
44710
44711
|
const webSearchToolName = (_c = tools == null ? void 0 : tools.find(
|
|
44711
|
-
(
|
|
44712
|
+
(tool22) => tool22.type === "provider-defined" && (tool22.id === "openai.web_search" || tool22.id === "openai.web_search_preview")
|
|
44712
44713
|
)) == null ? void 0 : _c.name;
|
|
44713
44714
|
if (webSearchToolName) {
|
|
44714
44715
|
addInclude("web_search_call.action.sources");
|
|
@@ -48302,25 +48303,25 @@ function prepareTools({
|
|
|
48302
48303
|
if (tools == null) {
|
|
48303
48304
|
return { tools: void 0, toolConfig: void 0, toolWarnings };
|
|
48304
48305
|
}
|
|
48305
|
-
const hasFunctionTools = tools.some((
|
|
48306
|
+
const hasFunctionTools = tools.some((tool22) => tool22.type === "function");
|
|
48306
48307
|
const hasProviderDefinedTools = tools.some(
|
|
48307
|
-
(
|
|
48308
|
+
(tool22) => tool22.type === "provider-defined"
|
|
48308
48309
|
);
|
|
48309
48310
|
if (hasFunctionTools && hasProviderDefinedTools) {
|
|
48310
|
-
const functionTools = tools.filter((
|
|
48311
|
+
const functionTools = tools.filter((tool22) => tool22.type === "function");
|
|
48311
48312
|
toolWarnings.push({
|
|
48312
48313
|
type: "unsupported-tool",
|
|
48313
|
-
tool: tools.find((
|
|
48314
|
+
tool: tools.find((tool22) => tool22.type === "function"),
|
|
48314
48315
|
details: `Cannot mix function tools with provider-defined tools in the same request. Falling back to provider-defined tools only. The following function tools will be ignored: ${functionTools.map((t2) => t2.name).join(", ")}. Please use either function tools or provider-defined tools, but not both.`
|
|
48315
48316
|
});
|
|
48316
48317
|
}
|
|
48317
48318
|
if (hasProviderDefinedTools) {
|
|
48318
48319
|
const googleTools22 = [];
|
|
48319
48320
|
const providerDefinedTools = tools.filter(
|
|
48320
|
-
(
|
|
48321
|
+
(tool22) => tool22.type === "provider-defined"
|
|
48321
48322
|
);
|
|
48322
|
-
providerDefinedTools.forEach((
|
|
48323
|
-
switch (
|
|
48323
|
+
providerDefinedTools.forEach((tool22) => {
|
|
48324
|
+
switch (tool22.id) {
|
|
48324
48325
|
case "google.google_search":
|
|
48325
48326
|
if (isGemini2orNewer) {
|
|
48326
48327
|
googleTools22.push({ googleSearch: {} });
|
|
@@ -48328,8 +48329,8 @@ function prepareTools({
|
|
|
48328
48329
|
googleTools22.push({
|
|
48329
48330
|
googleSearchRetrieval: {
|
|
48330
48331
|
dynamicRetrievalConfig: {
|
|
48331
|
-
mode:
|
|
48332
|
-
dynamicThreshold:
|
|
48332
|
+
mode: tool22.args.mode,
|
|
48333
|
+
dynamicThreshold: tool22.args.dynamicThreshold
|
|
48333
48334
|
}
|
|
48334
48335
|
}
|
|
48335
48336
|
});
|
|
@@ -48343,7 +48344,7 @@ function prepareTools({
|
|
|
48343
48344
|
} else {
|
|
48344
48345
|
toolWarnings.push({
|
|
48345
48346
|
type: "unsupported-tool",
|
|
48346
|
-
tool:
|
|
48347
|
+
tool: tool22,
|
|
48347
48348
|
details: "The URL context tool is not supported with other Gemini models than Gemini 2."
|
|
48348
48349
|
});
|
|
48349
48350
|
}
|
|
@@ -48354,18 +48355,18 @@ function prepareTools({
|
|
|
48354
48355
|
} else {
|
|
48355
48356
|
toolWarnings.push({
|
|
48356
48357
|
type: "unsupported-tool",
|
|
48357
|
-
tool:
|
|
48358
|
+
tool: tool22,
|
|
48358
48359
|
details: "The code execution tools is not supported with other Gemini models than Gemini 2."
|
|
48359
48360
|
});
|
|
48360
48361
|
}
|
|
48361
48362
|
break;
|
|
48362
48363
|
case "google.file_search":
|
|
48363
48364
|
if (supportsFileSearch) {
|
|
48364
|
-
googleTools22.push({ fileSearch: __spreadValues({},
|
|
48365
|
+
googleTools22.push({ fileSearch: __spreadValues({}, tool22.args) });
|
|
48365
48366
|
} else {
|
|
48366
48367
|
toolWarnings.push({
|
|
48367
48368
|
type: "unsupported-tool",
|
|
48368
|
-
tool:
|
|
48369
|
+
tool: tool22,
|
|
48369
48370
|
details: "The file search tool is only supported with Gemini 2.5 models."
|
|
48370
48371
|
});
|
|
48371
48372
|
}
|
|
@@ -48376,22 +48377,22 @@ function prepareTools({
|
|
|
48376
48377
|
retrieval: {
|
|
48377
48378
|
vertex_rag_store: {
|
|
48378
48379
|
rag_resources: {
|
|
48379
|
-
rag_corpus:
|
|
48380
|
+
rag_corpus: tool22.args.ragCorpus
|
|
48380
48381
|
},
|
|
48381
|
-
similarity_top_k:
|
|
48382
|
+
similarity_top_k: tool22.args.topK
|
|
48382
48383
|
}
|
|
48383
48384
|
}
|
|
48384
48385
|
});
|
|
48385
48386
|
} else {
|
|
48386
48387
|
toolWarnings.push({
|
|
48387
48388
|
type: "unsupported-tool",
|
|
48388
|
-
tool:
|
|
48389
|
+
tool: tool22,
|
|
48389
48390
|
details: "The RAG store tool is not supported with other Gemini models than Gemini 2."
|
|
48390
48391
|
});
|
|
48391
48392
|
}
|
|
48392
48393
|
break;
|
|
48393
48394
|
default:
|
|
48394
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
48395
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
48395
48396
|
break;
|
|
48396
48397
|
}
|
|
48397
48398
|
});
|
|
@@ -48402,17 +48403,17 @@ function prepareTools({
|
|
|
48402
48403
|
};
|
|
48403
48404
|
}
|
|
48404
48405
|
const functionDeclarations = [];
|
|
48405
|
-
for (const
|
|
48406
|
-
switch (
|
|
48406
|
+
for (const tool22 of tools) {
|
|
48407
|
+
switch (tool22.type) {
|
|
48407
48408
|
case "function":
|
|
48408
48409
|
functionDeclarations.push({
|
|
48409
|
-
name:
|
|
48410
|
-
description: (_a4 =
|
|
48411
|
-
parameters: convertJSONSchemaToOpenAPISchema(
|
|
48410
|
+
name: tool22.name,
|
|
48411
|
+
description: (_a4 = tool22.description) != null ? _a4 : "",
|
|
48412
|
+
parameters: convertJSONSchemaToOpenAPISchema(tool22.inputSchema)
|
|
48412
48413
|
});
|
|
48413
48414
|
break;
|
|
48414
48415
|
default:
|
|
48415
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
48416
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
48416
48417
|
break;
|
|
48417
48418
|
}
|
|
48418
48419
|
}
|
|
@@ -48526,7 +48527,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
48526
48527
|
schema: googleGenerativeAIProviderOptions
|
|
48527
48528
|
});
|
|
48528
48529
|
if ((tools == null ? void 0 : tools.some(
|
|
48529
|
-
(
|
|
48530
|
+
(tool22) => tool22.type === "provider-defined" && tool22.id === "google.vertex_rag_store"
|
|
48530
48531
|
)) && !this.config.provider.startsWith("google.vertex.")) {
|
|
48531
48532
|
warnings.push({
|
|
48532
48533
|
type: "other",
|
|
@@ -50388,23 +50389,23 @@ function prepareTools2(_0) {
|
|
|
50388
50389
|
return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
|
|
50389
50390
|
}
|
|
50390
50391
|
const anthropicTools2 = [];
|
|
50391
|
-
for (const
|
|
50392
|
-
switch (
|
|
50392
|
+
for (const tool22 of tools) {
|
|
50393
|
+
switch (tool22.type) {
|
|
50393
50394
|
case "function": {
|
|
50394
|
-
const cacheControl = validator3.getCacheControl(
|
|
50395
|
+
const cacheControl = validator3.getCacheControl(tool22.providerOptions, {
|
|
50395
50396
|
type: "tool definition",
|
|
50396
50397
|
canCache: true
|
|
50397
50398
|
});
|
|
50398
50399
|
anthropicTools2.push({
|
|
50399
|
-
name:
|
|
50400
|
-
description:
|
|
50401
|
-
input_schema:
|
|
50400
|
+
name: tool22.name,
|
|
50401
|
+
description: tool22.description,
|
|
50402
|
+
input_schema: tool22.inputSchema,
|
|
50402
50403
|
cache_control: cacheControl
|
|
50403
50404
|
});
|
|
50404
50405
|
break;
|
|
50405
50406
|
}
|
|
50406
50407
|
case "provider-defined": {
|
|
50407
|
-
switch (
|
|
50408
|
+
switch (tool22.id) {
|
|
50408
50409
|
case "anthropic.code_execution_20250522": {
|
|
50409
50410
|
betas.add("code-execution-2025-05-22");
|
|
50410
50411
|
anthropicTools2.push({
|
|
@@ -50427,9 +50428,9 @@ function prepareTools2(_0) {
|
|
|
50427
50428
|
anthropicTools2.push({
|
|
50428
50429
|
name: "computer",
|
|
50429
50430
|
type: "computer_20250124",
|
|
50430
|
-
display_width_px:
|
|
50431
|
-
display_height_px:
|
|
50432
|
-
display_number:
|
|
50431
|
+
display_width_px: tool22.args.displayWidthPx,
|
|
50432
|
+
display_height_px: tool22.args.displayHeightPx,
|
|
50433
|
+
display_number: tool22.args.displayNumber,
|
|
50433
50434
|
cache_control: void 0
|
|
50434
50435
|
});
|
|
50435
50436
|
break;
|
|
@@ -50439,9 +50440,9 @@ function prepareTools2(_0) {
|
|
|
50439
50440
|
anthropicTools2.push({
|
|
50440
50441
|
name: "computer",
|
|
50441
50442
|
type: "computer_20241022",
|
|
50442
|
-
display_width_px:
|
|
50443
|
-
display_height_px:
|
|
50444
|
-
display_number:
|
|
50443
|
+
display_width_px: tool22.args.displayWidthPx,
|
|
50444
|
+
display_height_px: tool22.args.displayHeightPx,
|
|
50445
|
+
display_number: tool22.args.displayNumber,
|
|
50445
50446
|
cache_control: void 0
|
|
50446
50447
|
});
|
|
50447
50448
|
break;
|
|
@@ -50475,7 +50476,7 @@ function prepareTools2(_0) {
|
|
|
50475
50476
|
}
|
|
50476
50477
|
case "anthropic.text_editor_20250728": {
|
|
50477
50478
|
const args = yield validateTypes2({
|
|
50478
|
-
value:
|
|
50479
|
+
value: tool22.args,
|
|
50479
50480
|
schema: textEditor_20250728ArgsSchema
|
|
50480
50481
|
});
|
|
50481
50482
|
anthropicTools2.push({
|
|
@@ -50515,7 +50516,7 @@ function prepareTools2(_0) {
|
|
|
50515
50516
|
case "anthropic.web_fetch_20250910": {
|
|
50516
50517
|
betas.add("web-fetch-2025-09-10");
|
|
50517
50518
|
const args = yield validateTypes2({
|
|
50518
|
-
value:
|
|
50519
|
+
value: tool22.args,
|
|
50519
50520
|
schema: webFetch_20250910ArgsSchema
|
|
50520
50521
|
});
|
|
50521
50522
|
anthropicTools2.push({
|
|
@@ -50532,7 +50533,7 @@ function prepareTools2(_0) {
|
|
|
50532
50533
|
}
|
|
50533
50534
|
case "anthropic.web_search_20250305": {
|
|
50534
50535
|
const args = yield validateTypes2({
|
|
50535
|
-
value:
|
|
50536
|
+
value: tool22.args,
|
|
50536
50537
|
schema: webSearch_20250305ArgsSchema
|
|
50537
50538
|
});
|
|
50538
50539
|
anthropicTools2.push({
|
|
@@ -50547,14 +50548,14 @@ function prepareTools2(_0) {
|
|
|
50547
50548
|
break;
|
|
50548
50549
|
}
|
|
50549
50550
|
default: {
|
|
50550
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
50551
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
50551
50552
|
break;
|
|
50552
50553
|
}
|
|
50553
50554
|
}
|
|
50554
50555
|
break;
|
|
50555
50556
|
}
|
|
50556
50557
|
default: {
|
|
50557
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
50558
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
50558
50559
|
break;
|
|
50559
50560
|
}
|
|
50560
50561
|
}
|
|
@@ -51513,7 +51514,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
51513
51514
|
betas.add("skills-2025-10-02");
|
|
51514
51515
|
betas.add("files-api-2025-04-14");
|
|
51515
51516
|
if (!(tools == null ? void 0 : tools.some(
|
|
51516
|
-
(
|
|
51517
|
+
(tool22) => tool22.type === "provider-defined" && tool22.id === "anthropic.code_execution_20250825"
|
|
51517
51518
|
))) {
|
|
51518
51519
|
warnings.push({
|
|
51519
51520
|
type: "other",
|
|
@@ -53351,24 +53352,24 @@ function prepareTools3({
|
|
|
53351
53352
|
if (tools == null) {
|
|
53352
53353
|
return { tools: void 0, toolConfig: void 0, toolWarnings };
|
|
53353
53354
|
}
|
|
53354
|
-
const hasFunctionTools = tools.some((
|
|
53355
|
+
const hasFunctionTools = tools.some((tool22) => tool22.type === "function");
|
|
53355
53356
|
const hasProviderDefinedTools = tools.some(
|
|
53356
|
-
(
|
|
53357
|
+
(tool22) => tool22.type === "provider-defined"
|
|
53357
53358
|
);
|
|
53358
53359
|
if (hasFunctionTools && hasProviderDefinedTools) {
|
|
53359
53360
|
toolWarnings.push({
|
|
53360
53361
|
type: "unsupported-tool",
|
|
53361
|
-
tool: tools.find((
|
|
53362
|
+
tool: tools.find((tool22) => tool22.type === "function"),
|
|
53362
53363
|
details: "Cannot mix function tools with provider-defined tools in the same request. Please use either function tools or provider-defined tools, but not both."
|
|
53363
53364
|
});
|
|
53364
53365
|
}
|
|
53365
53366
|
if (hasProviderDefinedTools) {
|
|
53366
53367
|
const googleTools22 = [];
|
|
53367
53368
|
const providerDefinedTools = tools.filter(
|
|
53368
|
-
(
|
|
53369
|
+
(tool22) => tool22.type === "provider-defined"
|
|
53369
53370
|
);
|
|
53370
|
-
providerDefinedTools.forEach((
|
|
53371
|
-
switch (
|
|
53371
|
+
providerDefinedTools.forEach((tool22) => {
|
|
53372
|
+
switch (tool22.id) {
|
|
53372
53373
|
case "google.google_search":
|
|
53373
53374
|
if (isGemini2) {
|
|
53374
53375
|
googleTools22.push({ googleSearch: {} });
|
|
@@ -53376,8 +53377,8 @@ function prepareTools3({
|
|
|
53376
53377
|
googleTools22.push({
|
|
53377
53378
|
googleSearchRetrieval: {
|
|
53378
53379
|
dynamicRetrievalConfig: {
|
|
53379
|
-
mode:
|
|
53380
|
-
dynamicThreshold:
|
|
53380
|
+
mode: tool22.args.mode,
|
|
53381
|
+
dynamicThreshold: tool22.args.dynamicThreshold
|
|
53381
53382
|
}
|
|
53382
53383
|
}
|
|
53383
53384
|
});
|
|
@@ -53391,7 +53392,7 @@ function prepareTools3({
|
|
|
53391
53392
|
} else {
|
|
53392
53393
|
toolWarnings.push({
|
|
53393
53394
|
type: "unsupported-tool",
|
|
53394
|
-
tool:
|
|
53395
|
+
tool: tool22,
|
|
53395
53396
|
details: "The URL context tool is not supported with other Gemini models than Gemini 2."
|
|
53396
53397
|
});
|
|
53397
53398
|
}
|
|
@@ -53402,13 +53403,13 @@ function prepareTools3({
|
|
|
53402
53403
|
} else {
|
|
53403
53404
|
toolWarnings.push({
|
|
53404
53405
|
type: "unsupported-tool",
|
|
53405
|
-
tool:
|
|
53406
|
+
tool: tool22,
|
|
53406
53407
|
details: "The code execution tools is not supported with other Gemini models than Gemini 2."
|
|
53407
53408
|
});
|
|
53408
53409
|
}
|
|
53409
53410
|
break;
|
|
53410
53411
|
default:
|
|
53411
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
53412
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
53412
53413
|
break;
|
|
53413
53414
|
}
|
|
53414
53415
|
});
|
|
@@ -53419,17 +53420,17 @@ function prepareTools3({
|
|
|
53419
53420
|
};
|
|
53420
53421
|
}
|
|
53421
53422
|
const functionDeclarations = [];
|
|
53422
|
-
for (const
|
|
53423
|
-
switch (
|
|
53423
|
+
for (const tool22 of tools) {
|
|
53424
|
+
switch (tool22.type) {
|
|
53424
53425
|
case "function":
|
|
53425
53426
|
functionDeclarations.push({
|
|
53426
|
-
name:
|
|
53427
|
-
description: (_a4 =
|
|
53428
|
-
parameters: convertJSONSchemaToOpenAPISchema2(
|
|
53427
|
+
name: tool22.name,
|
|
53428
|
+
description: (_a4 = tool22.description) != null ? _a4 : "",
|
|
53429
|
+
parameters: convertJSONSchemaToOpenAPISchema2(tool22.inputSchema)
|
|
53429
53430
|
});
|
|
53430
53431
|
break;
|
|
53431
53432
|
default:
|
|
53432
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
53433
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
53433
53434
|
break;
|
|
53434
53435
|
}
|
|
53435
53436
|
}
|
|
@@ -54552,16 +54553,16 @@ function prepareTools4({
|
|
|
54552
54553
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
54553
54554
|
}
|
|
54554
54555
|
const openaiCompatTools = [];
|
|
54555
|
-
for (const
|
|
54556
|
-
if (
|
|
54557
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
54556
|
+
for (const tool22 of tools) {
|
|
54557
|
+
if (tool22.type === "provider-defined") {
|
|
54558
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
54558
54559
|
} else {
|
|
54559
54560
|
openaiCompatTools.push({
|
|
54560
54561
|
type: "function",
|
|
54561
54562
|
function: {
|
|
54562
|
-
name:
|
|
54563
|
-
description:
|
|
54564
|
-
parameters:
|
|
54563
|
+
name: tool22.name,
|
|
54564
|
+
description: tool22.description,
|
|
54565
|
+
parameters: tool22.inputSchema
|
|
54565
54566
|
}
|
|
54566
54567
|
});
|
|
54567
54568
|
}
|
|
@@ -55906,16 +55907,16 @@ function prepareTools5({
|
|
|
55906
55907
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
55907
55908
|
}
|
|
55908
55909
|
const xaiTools = [];
|
|
55909
|
-
for (const
|
|
55910
|
-
if (
|
|
55911
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
55910
|
+
for (const tool22 of tools) {
|
|
55911
|
+
if (tool22.type === "provider-defined") {
|
|
55912
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
55912
55913
|
} else {
|
|
55913
55914
|
xaiTools.push({
|
|
55914
55915
|
type: "function",
|
|
55915
55916
|
function: {
|
|
55916
|
-
name:
|
|
55917
|
-
description:
|
|
55918
|
-
parameters:
|
|
55917
|
+
name: tool22.name,
|
|
55918
|
+
description: tool22.description,
|
|
55919
|
+
parameters: tool22.inputSchema
|
|
55919
55920
|
}
|
|
55920
55921
|
});
|
|
55921
55922
|
}
|
|
@@ -56915,21 +56916,21 @@ function prepareChatTools2({
|
|
|
56915
56916
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
56916
56917
|
}
|
|
56917
56918
|
const openaiTools2 = [];
|
|
56918
|
-
for (const
|
|
56919
|
-
switch (
|
|
56919
|
+
for (const tool22 of tools) {
|
|
56920
|
+
switch (tool22.type) {
|
|
56920
56921
|
case "function":
|
|
56921
56922
|
openaiTools2.push({
|
|
56922
56923
|
type: "function",
|
|
56923
56924
|
function: {
|
|
56924
|
-
name:
|
|
56925
|
-
description:
|
|
56926
|
-
parameters:
|
|
56925
|
+
name: tool22.name,
|
|
56926
|
+
description: tool22.description,
|
|
56927
|
+
parameters: tool22.inputSchema,
|
|
56927
56928
|
strict: structuredOutputs ? strictJsonSchema : void 0
|
|
56928
56929
|
}
|
|
56929
56930
|
});
|
|
56930
56931
|
break;
|
|
56931
56932
|
default:
|
|
56932
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
56933
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
56933
56934
|
break;
|
|
56934
56935
|
}
|
|
56935
56936
|
}
|
|
@@ -59511,22 +59512,22 @@ function prepareResponsesTools2(_0) {
|
|
|
59511
59512
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
59512
59513
|
}
|
|
59513
59514
|
const openaiTools2 = [];
|
|
59514
|
-
for (const
|
|
59515
|
-
switch (
|
|
59515
|
+
for (const tool22 of tools) {
|
|
59516
|
+
switch (tool22.type) {
|
|
59516
59517
|
case "function":
|
|
59517
59518
|
openaiTools2.push({
|
|
59518
59519
|
type: "function",
|
|
59519
|
-
name:
|
|
59520
|
-
description:
|
|
59521
|
-
parameters:
|
|
59520
|
+
name: tool22.name,
|
|
59521
|
+
description: tool22.description,
|
|
59522
|
+
parameters: tool22.inputSchema,
|
|
59522
59523
|
strict: strictJsonSchema
|
|
59523
59524
|
});
|
|
59524
59525
|
break;
|
|
59525
59526
|
case "provider-defined": {
|
|
59526
|
-
switch (
|
|
59527
|
+
switch (tool22.id) {
|
|
59527
59528
|
case "openai.file_search": {
|
|
59528
59529
|
const args = yield validateTypes({
|
|
59529
|
-
value:
|
|
59530
|
+
value: tool22.args,
|
|
59530
59531
|
schema: fileSearchArgsSchema3
|
|
59531
59532
|
});
|
|
59532
59533
|
openaiTools2.push({
|
|
@@ -59549,7 +59550,7 @@ function prepareResponsesTools2(_0) {
|
|
|
59549
59550
|
}
|
|
59550
59551
|
case "openai.web_search_preview": {
|
|
59551
59552
|
const args = yield validateTypes({
|
|
59552
|
-
value:
|
|
59553
|
+
value: tool22.args,
|
|
59553
59554
|
schema: webSearchPreviewArgsSchema2
|
|
59554
59555
|
});
|
|
59555
59556
|
openaiTools2.push({
|
|
@@ -59561,7 +59562,7 @@ function prepareResponsesTools2(_0) {
|
|
|
59561
59562
|
}
|
|
59562
59563
|
case "openai.web_search": {
|
|
59563
59564
|
const args = yield validateTypes({
|
|
59564
|
-
value:
|
|
59565
|
+
value: tool22.args,
|
|
59565
59566
|
schema: webSearchArgsSchema2
|
|
59566
59567
|
});
|
|
59567
59568
|
openaiTools2.push({
|
|
@@ -59574,7 +59575,7 @@ function prepareResponsesTools2(_0) {
|
|
|
59574
59575
|
}
|
|
59575
59576
|
case "openai.code_interpreter": {
|
|
59576
59577
|
const args = yield validateTypes({
|
|
59577
|
-
value:
|
|
59578
|
+
value: tool22.args,
|
|
59578
59579
|
schema: codeInterpreterArgsSchema2
|
|
59579
59580
|
});
|
|
59580
59581
|
openaiTools2.push({
|
|
@@ -59585,7 +59586,7 @@ function prepareResponsesTools2(_0) {
|
|
|
59585
59586
|
}
|
|
59586
59587
|
case "openai.image_generation": {
|
|
59587
59588
|
const args = yield validateTypes({
|
|
59588
|
-
value:
|
|
59589
|
+
value: tool22.args,
|
|
59589
59590
|
schema: imageGenerationArgsSchema2
|
|
59590
59591
|
});
|
|
59591
59592
|
openaiTools2.push({
|
|
@@ -59609,7 +59610,7 @@ function prepareResponsesTools2(_0) {
|
|
|
59609
59610
|
break;
|
|
59610
59611
|
}
|
|
59611
59612
|
default:
|
|
59612
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
59613
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
59613
59614
|
break;
|
|
59614
59615
|
}
|
|
59615
59616
|
}
|
|
@@ -59714,7 +59715,7 @@ var OpenAIResponsesLanguageModel2 = class {
|
|
|
59714
59715
|
}
|
|
59715
59716
|
function hasOpenAITool(id) {
|
|
59716
59717
|
return (tools == null ? void 0 : tools.find(
|
|
59717
|
-
(
|
|
59718
|
+
(tool22) => tool22.type === "provider-defined" && tool22.id === id
|
|
59718
59719
|
)) != null;
|
|
59719
59720
|
}
|
|
59720
59721
|
const topLogprobs = typeof (openaiOptions == null ? void 0 : openaiOptions.logprobs) === "number" ? openaiOptions == null ? void 0 : openaiOptions.logprobs : (openaiOptions == null ? void 0 : openaiOptions.logprobs) === true ? TOP_LOGPROBS_MAX2 : void 0;
|
|
@@ -59722,7 +59723,7 @@ var OpenAIResponsesLanguageModel2 = class {
|
|
|
59722
59723
|
addInclude("message.output_text.logprobs");
|
|
59723
59724
|
}
|
|
59724
59725
|
const webSearchToolName = (_c = tools == null ? void 0 : tools.find(
|
|
59725
|
-
(
|
|
59726
|
+
(tool22) => tool22.type === "provider-defined" && (tool22.id === "openai.web_search" || tool22.id === "openai.web_search_preview")
|
|
59726
59727
|
)) == null ? void 0 : _c.name;
|
|
59727
59728
|
if (webSearchToolName) {
|
|
59728
59729
|
addInclude("web_search_call.action.sources");
|
|
@@ -60945,13 +60946,13 @@ function prepareTools6({
|
|
|
60945
60946
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
60946
60947
|
}
|
|
60947
60948
|
const groqTools2 = [];
|
|
60948
|
-
for (const
|
|
60949
|
-
if (
|
|
60950
|
-
if (
|
|
60949
|
+
for (const tool22 of tools) {
|
|
60950
|
+
if (tool22.type === "provider-defined") {
|
|
60951
|
+
if (tool22.id === "groq.browser_search") {
|
|
60951
60952
|
if (!isBrowserSearchSupportedModel(modelId)) {
|
|
60952
60953
|
toolWarnings.push({
|
|
60953
60954
|
type: "unsupported-tool",
|
|
60954
|
-
tool:
|
|
60955
|
+
tool: tool22,
|
|
60955
60956
|
details: `Browser search is only supported on the following models: ${getSupportedModelsString()}. Current model: ${modelId}`
|
|
60956
60957
|
});
|
|
60957
60958
|
} else {
|
|
@@ -60960,15 +60961,15 @@ function prepareTools6({
|
|
|
60960
60961
|
});
|
|
60961
60962
|
}
|
|
60962
60963
|
} else {
|
|
60963
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
60964
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
60964
60965
|
}
|
|
60965
60966
|
} else {
|
|
60966
60967
|
groqTools2.push({
|
|
60967
60968
|
type: "function",
|
|
60968
60969
|
function: {
|
|
60969
|
-
name:
|
|
60970
|
-
description:
|
|
60971
|
-
parameters:
|
|
60970
|
+
name: tool22.name,
|
|
60971
|
+
description: tool22.description,
|
|
60972
|
+
parameters: tool22.inputSchema
|
|
60972
60973
|
}
|
|
60973
60974
|
});
|
|
60974
60975
|
}
|
|
@@ -62020,16 +62021,16 @@ function prepareTools7({
|
|
|
62020
62021
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
62021
62022
|
}
|
|
62022
62023
|
const mistralTools = [];
|
|
62023
|
-
for (const
|
|
62024
|
-
if (
|
|
62025
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
62024
|
+
for (const tool22 of tools) {
|
|
62025
|
+
if (tool22.type === "provider-defined") {
|
|
62026
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
62026
62027
|
} else {
|
|
62027
62028
|
mistralTools.push({
|
|
62028
62029
|
type: "function",
|
|
62029
62030
|
function: {
|
|
62030
|
-
name:
|
|
62031
|
-
description:
|
|
62032
|
-
parameters:
|
|
62031
|
+
name: tool22.name,
|
|
62032
|
+
description: tool22.description,
|
|
62033
|
+
parameters: tool22.inputSchema
|
|
62033
62034
|
}
|
|
62034
62035
|
});
|
|
62035
62036
|
}
|
|
@@ -62049,7 +62050,7 @@ function prepareTools7({
|
|
|
62049
62050
|
case "tool":
|
|
62050
62051
|
return {
|
|
62051
62052
|
tools: mistralTools.filter(
|
|
62052
|
-
(
|
|
62053
|
+
(tool22) => tool22.function.name === toolChoice.toolName
|
|
62053
62054
|
),
|
|
62054
62055
|
toolChoice: "any",
|
|
62055
62056
|
toolWarnings
|
|
@@ -63832,10 +63833,10 @@ function prepareResponsesTools3({
|
|
|
63832
63833
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
63833
63834
|
}
|
|
63834
63835
|
const ollamaTools = [];
|
|
63835
|
-
for (const
|
|
63836
|
-
switch (
|
|
63836
|
+
for (const tool22 of tools) {
|
|
63837
|
+
switch (tool22.type) {
|
|
63837
63838
|
case "function": {
|
|
63838
|
-
let parameters =
|
|
63839
|
+
let parameters = tool22.inputSchema;
|
|
63839
63840
|
if (!parameters) {
|
|
63840
63841
|
parameters = {
|
|
63841
63842
|
type: "object",
|
|
@@ -63851,15 +63852,15 @@ function prepareResponsesTools3({
|
|
|
63851
63852
|
ollamaTools.push({
|
|
63852
63853
|
type: "function",
|
|
63853
63854
|
function: {
|
|
63854
|
-
name:
|
|
63855
|
-
description:
|
|
63855
|
+
name: tool22.name,
|
|
63856
|
+
description: tool22.description,
|
|
63856
63857
|
parameters
|
|
63857
63858
|
}
|
|
63858
63859
|
});
|
|
63859
63860
|
break;
|
|
63860
63861
|
}
|
|
63861
63862
|
default:
|
|
63862
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
63863
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool22 });
|
|
63863
63864
|
break;
|
|
63864
63865
|
}
|
|
63865
63866
|
}
|
|
@@ -64657,13 +64658,13 @@ var resolveTools = (clients, userTools) => __async(null, null, function* () {
|
|
|
64657
64658
|
const clientTools = yield clientInstance.listTools({
|
|
64658
64659
|
cursor: nextCursor
|
|
64659
64660
|
});
|
|
64660
|
-
for (const
|
|
64661
|
-
tools[
|
|
64662
|
-
description:
|
|
64663
|
-
inputSchema: jsonSchemaToZod(
|
|
64661
|
+
for (const tool22 of clientTools.tools) {
|
|
64662
|
+
tools[tool22.name] = {
|
|
64663
|
+
description: tool22.description,
|
|
64664
|
+
inputSchema: jsonSchemaToZod(tool22.inputSchema),
|
|
64664
64665
|
execute: (input) => __async(null, null, function* () {
|
|
64665
64666
|
const result = yield clientInstance.callTool({
|
|
64666
|
-
name:
|
|
64667
|
+
name: tool22.name,
|
|
64667
64668
|
arguments: input
|
|
64668
64669
|
});
|
|
64669
64670
|
return result;
|
|
@@ -68627,6 +68628,9 @@ I'm providing ${screenshots.length} screenshots showing the progression of the t
|
|
|
68627
68628
|
});
|
|
68628
68629
|
}
|
|
68629
68630
|
};
|
|
68631
|
+
|
|
68632
|
+
// lib/v3/index.ts
|
|
68633
|
+
var import_ai23 = require("ai");
|
|
68630
68634
|
// Annotate the CommonJS export names for ESM import in node:
|
|
68631
68635
|
0 && (module.exports = {
|
|
68632
68636
|
AISdkClient,
|
|
@@ -68709,6 +68713,7 @@ I'm providing ${screenshots.length} screenshots showing the progression of the t
|
|
|
68709
68713
|
providerEnvVarMap,
|
|
68710
68714
|
toGeminiSchema,
|
|
68711
68715
|
toJsonSchema,
|
|
68716
|
+
tool,
|
|
68712
68717
|
transformSchema,
|
|
68713
68718
|
trimTrailingTextNode,
|
|
68714
68719
|
validateZodSchema
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@browserbasehq/stagehand",
|
|
3
|
-
"version": "3.0.8-alpha-
|
|
3
|
+
"version": "3.0.8-alpha-72ac775a831d6f0f376ceda4426525f93cc21452",
|
|
4
4
|
"description": "An AI web browsing framework focused on simplicity and extensibility.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|