Documentation
Namespaces
Prompt
interfaces
Aifunction

Interface: AIFunction()<Schema, Return>

A function meant to be used with OpenAI function calling.

Type parameters

ParameterDefault
Schema extends z.ZodObject<any>z.ZodObject<any>
Return extends anyany

AIFunction(input): Promise<Return>

The implementation of the function, with arg parsing and validation.

Parameters

ParameterType
inputstring | Msg

Returns

Promise<Return>

Source

src/prompt/types.ts:31 (opens in a new tab)

Properties

PropertyTypeDescriptionSource
argsSchemaSchemaThe Zod schema for the arguments string.src/prompt/types.ts:33 (opens in a new tab)
specobjectThe function spec for the OpenAI API functions property.src/prompt/types.ts:37 (opens in a new tab)
spec.description?string-src/prompt/types.ts:39 (opens in a new tab)
spec.namestring-src/prompt/types.ts:38 (opens in a new tab)
spec.parametersRecord<string, unknown>-src/prompt/types.ts:40 (opens in a new tab)

Methods

parseArgs()

parseArgs(input): TypeOf<Schema>

Parse the function arguments from a message.

Parameters

ParameterType
inputstring | Msg

Returns

TypeOf<Schema>

Source

src/prompt/types.ts:35 (opens in a new tab)