Interface: AIFunction()<Schema, Return>
A function meant to be used with OpenAI function calling.
Type parameters
Parameter | Default |
---|---|
Schema extends z.ZodObject <any > | z.ZodObject <any > |
Return extends any | any |
AIFunction(
input
):Promise
<Return
>
The implementation of the function, with arg parsing and validation.
Parameters
Parameter | Type |
---|---|
input | string | Msg |
Returns
Promise
<Return
>
Source
src/prompt/types.ts:31 (opens in a new tab)
Properties
Property | Type | Description | Source |
---|---|---|---|
argsSchema | Schema | The Zod schema for the arguments string. | src/prompt/types.ts:33 (opens in a new tab) |
spec | object | The 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.name | string | - | src/prompt/types.ts:38 (opens in a new tab) |
spec.parameters | Record <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
Parameter | Type |
---|---|
input | string | Msg |
Returns
TypeOf
<Schema
>