Class: WebSearchTool<NAME>
A tool for searching the web.
The input schema takes a query string.
{
query: "How many people live in Berlin?"
}
The output schema is an array of search results with title, link and snippet.
{
results:
[
{
title: "Berlin - Wikipedia",
link: "https://en.wikipedia.org/wiki/Berlin",
snippet: "Berlin is the capital and largest city of Germany by...",
},
...
]
}
Type parameters
Name | Type |
---|---|
NAME | extends string |
Hierarchy
-
Tool
<NAME
,WebSearchToolInput
,WebSearchToolOutput
>↳
WebSearchTool
Constructors
constructor
• new WebSearchTool<NAME
>(«destructured»
): WebSearchTool
<NAME
>
Type parameters
Name | Type |
---|---|
NAME | extends string |
Parameters
Name | Type | Default value |
---|---|---|
«destructured» | Object | undefined |
› description? | string | undefined |
› name | NAME | undefined |
› queryDescription? | string | "Search query" |
› execute | (input : WebSearchToolInput , options? : FunctionOptions ) => PromiseLike <WebSearchToolOutput > | undefined |
Returns
WebSearchTool
<NAME
>
Overrides
Defined in
packages/modelfusion/src/tool/WebSearchTool.ts:72
Properties
description
• Optional
Readonly
description: string
A optional description of what the tool does. Will be used by the language model to decide whether to use the tool.
Inherited from
Defined in
packages/modelfusion/src/tool/Tool.ts:22
execute
• Readonly
execute: (args
: WebSearchToolInput
, options
: FunctionCallOptions
) => PromiseLike
<WebSearchToolOutput
>
The actual execution function of the tool.
Type declaration
▸ (args
, options
): PromiseLike
<WebSearchToolOutput
>
The actual execution function of the tool.
Parameters
Name | Type |
---|---|
args | WebSearchToolInput |
options | FunctionCallOptions |
Returns
PromiseLike
<WebSearchToolOutput
>
Inherited from
Defined in
packages/modelfusion/src/tool/Tool.ts:38
name
• Readonly
name: NAME
The name of the tool. Should be understandable for language models and unique among the tools that they know.
Inherited from
Defined in
packages/modelfusion/src/tool/Tool.ts:17
parameters
• Readonly
parameters: Schema
<WebSearchToolInput
> & JsonSchemaProducer
The schema of the input that the tool expects. The language model will use this to generate the input. Use descriptions to make the input understandable for the language model.
Inherited from
Defined in
packages/modelfusion/src/tool/Tool.ts:28
returnType
• Readonly
returnType: ZodSchema
<{ results
: { link
: string
; snippet
: string
; title
: string
}[] }>
An optional schema of the output that the tool produces. This will be used to validate the output.