Pular para o conteúdo principal

Class: FunctionTool<T, R>

Simple Tool interface. Likely to change.

Type parameters

T

R extends JSONValue | Promise <JSONValue>

Implements

Constructors

new FunctionTool()

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

Parameters

_fn

_metadata: ToolMetadata<JSONSchemaType<T>>

Returns

FunctionTool<T, R>

Source

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

Properties

_fn()

private readonly _fn: (input) => R

Parameters

input: T

Returns

R

Source

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


_metadata

private readonly _metadata: ToolMetadata<JSONSchemaType<T>>

Source

packages/llamaindex/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>>

Source

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

Methods

call()

call(input): R

Parameters

input: T

Returns

R

Implementation of

BaseTool . call

Source

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


from()

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

Type parameters

T

Parameters

fn

schema: ToolMetadata<JSONSchemaType<T>>

Returns

FunctionTool<T, JSONValue | Promise <JSONValue>>

Source

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