Function: defineChatSessionFunction()
ts
function defineChatSessionFunction<Params>(functionDefinition: {
description: string;
params: Readonly<Params> & ((Params extends object ? Params & { [K in Exclude<keyof Params, keyof GbnfJsonBasicSchema>]: never; } & { ...; } : never) | ... 6 more ... | (Params extends object ? Params & ... 1 more ... & { ...; } : never));
handler: (params: GbnfJsonSchemaToType<Params>) => any;
}): ChatSessionModelFunction<Params>
Defined in: evaluator/LlamaChatSession/utils/defineChatSessionFunction.ts:12
Define a function that can be used by the model in a chat session, and return it.
This is a helper function to facilitate defining functions with full TypeScript type information.
The handler function can return a Promise, and the return value will be awaited before being returned to the model.
Type Parameters
Type Parameter |
---|
Params extends GbnfJsonSchema |
Parameters
Parameter | Type | Description |
---|---|---|
functionDefinition | { description : string ; params : Readonly<Params> & ((Params extends object ? Params & { [K in Exclude<keyof Params, keyof GbnfJsonBasicSchema>]: never; } & { ...; } : never) | ... 6 more ... | (Params extends object ? Params & ... 1 more ... & { ...; } : never)); handler : (params : GbnfJsonSchemaToType <Params >) => any ; } | |
functionDefinition.description ? | string | - |
functionDefinition.params ? | Readonly<Params> & ((Params extends object ? Params & { [K in Exclude<keyof Params, keyof GbnfJsonBasicSchema>]: never; } & { ...; } : never) | ... 6 more ... | (Params extends object ? Params & ... 1 more ... & { ...; } : never)) | - |
functionDefinition.handler | (params : GbnfJsonSchemaToType <Params >) => any | - |
Returns
ChatSessionModelFunction
<Params
>