Class: FunctionTool<T, R>
Simple Tool interface. Likely to change.
Type parameters
Name | Type |
---|---|
T | T |
R | extends JSONValue | Promise <JSONValue > |
Implements
BaseTool
<T
>
Constructors
constructor
• new FunctionTool<T
, R
>(_fn
, _metadata
): FunctionTool
<T
, R
>
Type parameters
Name | Type |
---|---|
T | T |
R | extends JSONValue | Promise <JSONValue > |
Parameters
Name | Type |
---|---|
_fn | (input : T ) => R |
_metadata | ToolMetadata <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
Name | Type |
---|---|
input | T |
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
Defined in
packages/core/src/tools/functionTool.ts:23
Methods
call
▸ call(input
): R
Parameters
Name | Type |
---|---|
input | T |
Returns
R
Implementation of
Defined in
packages/core/src/tools/functionTool.ts:27
from
▸ from<T
>(fn
, schema
): FunctionTool
<T
, JSONValue
| Promise
<JSONValue
>>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
fn | (input : T ) => JSONValue | Promise <JSONValue > |
schema | ToolMetadata <JSONSchemaType <T >> |