انتقل إلى المحتوى الرئيسي

Class: FunctionTool<T, R>

Simple Tool interface. Likely to change.

Type parameters

NameType
TT
Rextends string | Promise<string>

Implements

Constructors

constructor

new FunctionTool<T, R>(_fn, _metadata): FunctionTool<T, R>

Type parameters

NameType
TT
Rextends string | Promise<string>

Parameters

NameType
_fn(input: T) => R
_metadataToolMetadata<JSONSchemaType<T>>

Returns

FunctionTool<T, R>

Defined in

packages/core/src/tools/functionTool.ts:7

Properties

_fn

Private Readonly _fn: (input: T) => R

Type declaration

▸ (input): R

Parameters
NameType
inputT
Returns

R

Defined in

packages/core/src/tools/functionTool.ts:8


_metadata

Private Readonly _metadata: ToolMetadata<JSONSchemaType<T>>

Defined in

packages/core/src/tools/functionTool.ts:9

Accessors

metadata

get metadata(): T extends Known ? ToolMetadata<JSONSchemaType<T<T>>> : ToolMetadata<Record<string, unknown>>

Returns

T extends Known ? ToolMetadata<JSONSchemaType<T<T>>> : ToolMetadata<Record<string, unknown>>

Implementation of

BaseTool.metadata

Defined in

packages/core/src/tools/functionTool.ts:23

Methods

call

call(input): R

Parameters

NameType
inputT

Returns

R

Implementation of

BaseTool.call

Defined in

packages/core/src/tools/functionTool.ts:27


from

from<T>(fn, schema): FunctionTool<T, string | Promise<string>>

Type parameters

Name
T

Parameters

NameType
fn(input: T) => string | Promise<string>
schemaToolMetadata<JSONSchemaType<T>>

Returns

FunctionTool<T, string | Promise<string>>

Defined in

packages/core/src/tools/functionTool.ts:12