import { Message } from 'ai'; import { StreamMessage } from '../types'; import { z } from 'zod'; export type Conversation = { prompt: string; response: StreamMessage; }; export declare const ConversationSchema: z.ZodObject<{ prompt: z.ZodString; response: z.ZodObject<{ parts: z.ZodOptional; text: z.ZodString; additionalData: z.ZodOptional; isCompleted: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "text"; text: string; isCompleted?: boolean | undefined; additionalData?: any; }, { type: "text"; text: string; isCompleted?: boolean | undefined; additionalData?: any; }>, z.ZodObject<{ type: z.ZodLiteral<"tool-invocation">; toolInvocation: z.ZodObject<{ toolCallId: z.ZodString; toolName: z.ZodString; args: z.ZodAny; state: z.ZodString; result: z.ZodOptional; }, "strip", z.ZodTypeAny, { toolName: string; toolCallId: string; state: string; args?: any; result?: any; }, { toolName: string; toolCallId: string; state: string; args?: any; result?: any; }>; additionalData: z.ZodOptional; isCompleted: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "tool-invocation"; toolInvocation: { toolName: string; toolCallId: string; state: string; args?: any; result?: any; }; isCompleted?: boolean | undefined; additionalData?: any; }, { type: "tool-invocation"; toolInvocation: { toolName: string; toolCallId: string; state: string; args?: any; result?: any; }; isCompleted?: boolean | undefined; additionalData?: any; }>, z.ZodObject<{ type: z.ZodString; additionalData: z.ZodOptional; isCompleted: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ type: z.ZodString; additionalData: z.ZodOptional; isCompleted: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ type: z.ZodString; additionalData: z.ZodOptional; isCompleted: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>]>, "many">>; }, "strip", z.ZodTypeAny, { parts?: ({ type: "text"; text: string; isCompleted?: boolean | undefined; additionalData?: any; } | { type: "tool-invocation"; toolInvocation: { toolName: string; toolCallId: string; state: string; args?: any; result?: any; }; isCompleted?: boolean | undefined; additionalData?: any; } | z.objectOutputType<{ type: z.ZodString; additionalData: z.ZodOptional; isCompleted: z.ZodOptional; }, z.ZodTypeAny, "passthrough">)[] | undefined; }, { parts?: ({ type: "text"; text: string; isCompleted?: boolean | undefined; additionalData?: any; } | { type: "tool-invocation"; toolInvocation: { toolName: string; toolCallId: string; state: string; args?: any; result?: any; }; isCompleted?: boolean | undefined; additionalData?: any; } | z.objectInputType<{ type: z.ZodString; additionalData: z.ZodOptional; isCompleted: z.ZodOptional; }, z.ZodTypeAny, "passthrough">)[] | undefined; }>; }, "strip", z.ZodTypeAny, { prompt: string; response: { parts?: ({ type: "text"; text: string; isCompleted?: boolean | undefined; additionalData?: any; } | { type: "tool-invocation"; toolInvocation: { toolName: string; toolCallId: string; state: string; args?: any; result?: any; }; isCompleted?: boolean | undefined; additionalData?: any; } | z.objectOutputType<{ type: z.ZodString; additionalData: z.ZodOptional; isCompleted: z.ZodOptional; }, z.ZodTypeAny, "passthrough">)[] | undefined; }; }, { prompt: string; response: { parts?: ({ type: "text"; text: string; isCompleted?: boolean | undefined; additionalData?: any; } | { type: "tool-invocation"; toolInvocation: { toolName: string; toolCallId: string; state: string; args?: any; result?: any; }; isCompleted?: boolean | undefined; additionalData?: any; } | z.objectInputType<{ type: z.ZodString; additionalData: z.ZodOptional; isCompleted: z.ZodOptional; }, z.ZodTypeAny, "passthrough">)[] | undefined; }; }>; /** * Rebuild the messages from the conversations, which is an array of `{prompt, response}`. * The messages are in the format of the Message interface in Vercel AI SDK. * This function can be used to restore the messages from the persisted conversations. * * For example: * ```ts * const messages = rebuildMessages([ * { * prompt: 'What is the capital of France?', * response: { text: 'Paris' }, * }, * ]); * * // create assistant * const assistant = createAssistant({ * model: 'gpt-4o', * }); * * assistant.setMessages(messages); * ``` * * @param conversations The conversations to rebuild the messages from * @returns The messages used in the Vercel AI SDK */ export declare function rebuildMessages(conversations: Conversation[]): Message[];