UNPKG

@lobehub/chat

Version:

Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.

49 lines (41 loc) 1.09 kB
import { z } from 'zod'; import type { PartialDeep } from 'type-fest'; /** * The function that the model called. */ export interface ToolFunction { /** * The arguments to call the function with, as generated by the model in JSON * format. Note that the model does not always generate valid JSON, and may * hallucinate parameters not defined by your function schema. Validate the * arguments in your code before calling your function. */ arguments: string; /** * The name of the function to call. */ name: string; } export interface MessageToolCall { /** * The function that the model called. */ function: ToolFunction; /** * The ID of the tool call. */ id: string; /** * The type of the tool. Currently, only `function` is supported. */ type: 'function' | string; } export const MessageToolCallSchema = z.object({ function: z.object({ arguments: z.string(), name: z.string(), }), id: z.string(), type: z.string(), }); export type MessageToolCallChunk = PartialDeep<MessageToolCall> & { index: number };