UNPKG

enterprise-basics

Version:

A utility library for enterprise applications. It streamlines common business tasks by providing functions to process delimited and Excel files, generate professional PDFs, and handle email communications with attachments.

53 lines (52 loc) 1.75 kB
import { type LanguageModel } from 'ai'; import { z } from 'zod'; export declare const generationOptionsSchema: z.ZodObject<{ maxTokens: z.ZodNumber; temperature: z.ZodDefault<z.ZodNumber>; }, "strip", z.ZodTypeAny, { temperature: number; maxTokens: number; }, { maxTokens: number; temperature?: number | undefined; }>; /** * Generic function to generate structured output using any Zod schema * Provides type-safe AI generation with guaranteed output structure * * @param model - The language model instance * @param systemPrompt - The system prompt that defines the AI's behavior * @param prompt - The user's input prompt * @param schema - Zod schema defining the expected output structure * @param options - Optional generation parameters * @returns Promise that resolves to the validated structured output * * @example * ```typescript * // Generate a user profile * const userProfile = await generateStructuredOutput( * azureModel, * 'You are a user profile generator.', * 'Create a profile for a software developer', * z.object({ * name: z.string(), * role: z.string(), * skills: z.array(z.string()), * experience: z.number() * }) * ); * * // Generate a task list * const tasks = await generateStructuredOutput( * azureModel, * 'You are a task planner.', * 'Plan a project launch', * z.array(z.object({ * title: z.string(), * priority: z.enum(['low', 'medium', 'high']), * deadline: z.string() * })) * ); * ``` */ export declare const generateLLMStructuredOutput: <T extends z.ZodType>(model: LanguageModel, systemPrompt: string, prompt: string, schema: T, options?: z.infer<typeof generationOptionsSchema>) => Promise<z.infer<T>>;