UNPKG

agents

Version:
152 lines (150 loc) 4.32 kB
import { z } from "zod/v3"; //#region src/schedule.d.ts /** * Get the schedule prompt for a given event * @param event - The event to get the schedule prompt for * @returns The schedule prompt */ declare function getSchedulePrompt(event: { date: Date }): string; /** * @deprecated this has been renamed to getSchedulePrompt, and unstable_getSchedulePrompt will be removed in the next major version * @param event - The event to get the schedule prompt for * @returns The schedule prompt */ declare function unstable_getSchedulePrompt(event: { date: Date }): string; /** * The schema for parsing natural language scheduling requests. * * @example * ```typescript * import { generateObject } from "ai"; * import { scheduleSchema, getSchedulePrompt } from "agents/schedule"; * * const result = await generateObject({ * model, * prompt: `${getSchedulePrompt({ date: new Date() })} Input: "${userInput}"`, * schema: scheduleSchema, * // Required for OpenAI to avoid strict JSON schema validation errors * providerOptions: { * openai: { strictJsonSchema: false } * } * }); * ``` * * @remarks * When using this schema with OpenAI models via the AI SDK, you must pass * `providerOptions: { openai: { strictJsonSchema: false } }` to `generateObject`. * This is because the schema uses optional fields which are not compatible with * OpenAI's strict structured outputs mode. */ declare const scheduleSchema: z.ZodObject< { description: z.ZodString; when: z.ZodObject< { cron: z.ZodOptional<z.ZodString>; date: z.ZodOptional<z.ZodDate>; delayInSeconds: z.ZodOptional<z.ZodNumber>; type: z.ZodEnum<["scheduled", "delayed", "cron", "no-schedule"]>; }, "strip", z.ZodTypeAny, { type: "cron" | "scheduled" | "delayed" | "no-schedule"; date?: Date | undefined; cron?: string | undefined; delayInSeconds?: number | undefined; }, { type: "cron" | "scheduled" | "delayed" | "no-schedule"; date?: Date | undefined; cron?: string | undefined; delayInSeconds?: number | undefined; } >; }, "strip", z.ZodTypeAny, { description: string; when: { type: "cron" | "scheduled" | "delayed" | "no-schedule"; date?: Date | undefined; cron?: string | undefined; delayInSeconds?: number | undefined; }; }, { description: string; when: { type: "cron" | "scheduled" | "delayed" | "no-schedule"; date?: Date | undefined; cron?: string | undefined; delayInSeconds?: number | undefined; }; } >; /** * The type for the schedule prompt */ type Schedule = z.infer<typeof scheduleSchema>; /** * @deprecated this has been renamed to scheduleSchema, and unstable_scheduleSchema will be removed in the next major version * @returns The schedule schema */ declare const unstable_scheduleSchema: z.ZodObject< { description: z.ZodString; when: z.ZodObject< { cron: z.ZodOptional<z.ZodString>; date: z.ZodOptional<z.ZodDate>; delayInSeconds: z.ZodOptional<z.ZodNumber>; type: z.ZodEnum<["scheduled", "delayed", "cron", "no-schedule"]>; }, "strip", z.ZodTypeAny, { type: "cron" | "scheduled" | "delayed" | "no-schedule"; date?: Date | undefined; cron?: string | undefined; delayInSeconds?: number | undefined; }, { type: "cron" | "scheduled" | "delayed" | "no-schedule"; date?: Date | undefined; cron?: string | undefined; delayInSeconds?: number | undefined; } >; }, "strip", z.ZodTypeAny, { description: string; when: { type: "cron" | "scheduled" | "delayed" | "no-schedule"; date?: Date | undefined; cron?: string | undefined; delayInSeconds?: number | undefined; }; }, { description: string; when: { type: "cron" | "scheduled" | "delayed" | "no-schedule"; date?: Date | undefined; cron?: string | undefined; delayInSeconds?: number | undefined; }; } >; //#endregion export { Schedule, getSchedulePrompt, scheduleSchema, unstable_getSchedulePrompt, unstable_scheduleSchema }; //# sourceMappingURL=schedule.d.ts.map