* Registers a new function to be used in the chat completion. * @remarks * This is used to add new capabilities to Codepilot's chat feature * @param name The name of the function. * @param schema The schema of the function. * @param fn The function to be executed.
(schema: ChatCompletionFunction, fn: (args: TArgs) => Promise<any>)
| 36 | * @param fn The function to be executed. |
| 37 | */ |
| 38 | public addFunction<TArgs = Record<string, any>>(schema: ChatCompletionFunction, fn: (args: TArgs) => Promise<any>): this { |
| 39 | this._functions.set(schema.name, { schema, fn }); |
| 40 | return this; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Starts the chat session and listens for user input. |