import { convertToModelMessages, streamText, type LanguageModel, type UIMessage, type UIMessageStreamOptions } from "ai"; type AIStreamTextFunction = typeof streamText; type AIConvertToModelMessagesFunction = typeof convertToModelMessages; type AIStreamTextInput = Parameters[0]; type AIConvertToModelMessagesOptions = NonNullable[1]>; export interface AIChatRequestBody> { messages: TMessage[]; [key: string]: unknown; } export interface AIChatValidationIssue { path: readonly (string | number)[]; code: string; message: string; } export type AIChatStreamTextOptions = Partial>; export type AIChatResponseOptions = ResponseInit & UIMessageStreamOptions & { consumeSseStream?: (options: { stream: ReadableStream; }) => PromiseLike | void; }; export interface AIChatPrepareContext { request: Request; body: TBody; messages: unknown[]; modelMessages: Awaited>; } export interface AIChatRouteOptions { model: LanguageModel; system?: AIStreamTextInput["system"]; instructions?: AIStreamTextInput["instructions"]; streamText?: AIStreamTextFunction; convertToModelMessages?: AIConvertToModelMessagesFunction; convertToModelMessagesOptions?: AIConvertToModelMessagesOptions; options?: AIChatStreamTextOptions; responseOptions?: AIChatResponseOptions | ((context: AIChatPrepareContext) => AIChatResponseOptions | Promise); selectMessages?: (body: TBody, request: Request) => unknown[]; prepare?: (context: AIChatPrepareContext) => AIChatStreamTextOptions | Promise; } type AIChatRequestBodySchema = { parse(value: unknown): AIChatRequestBody; safeParse(value: unknown): { success: true; data: AIChatRequestBody; } | { success: false; error: { issues: AIChatValidationIssue[]; }; }; }; export declare const aiChatRequestBodySchema: AIChatRequestBodySchema; /** * Create a Vercel AI SDK chat route for Farm's Next-style app/api convention. * * // src/app/api/chat/route.ts * export const POST = aiChatRoute({ model: "openai/gpt-4o-mini" }); */ export declare function aiChatRoute(input: AIChatRouteOptions): import("@farm.js/core").FarmTypedEndpoint, "id">>, unknown, Response>; export declare const createAIChatRoute: typeof aiChatRoute; export declare const defineAIChatRoute: typeof aiChatRoute; export {}; //# sourceMappingURL=index.d.ts.map