Function: defineChatSessionFunction()
ts
function defineChatSessionFunction<Params>(functionDefinition: {
description: string;
params: Readonly<Params>;
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 undefined | GbnfJsonSchema |
Parameters
Parameter | Type | Description |
---|---|---|
functionDefinition | { description : string ; params : Readonly <Params >; handler : (params : GbnfJsonSchemaToType <Params >) => any ; } | |
functionDefinition.description ? | string | - |
functionDefinition.params ? | Readonly <Params > | - |
functionDefinition.handler | (params : GbnfJsonSchemaToType <Params >) => any | - |
Returns
ChatSessionModelFunction
<Params
>