import { LanguageModel } from 'ai'; import { ZodSchema } from 'zod'; import { AiUsageTracker } from './ai-usage-tracker'; import { GenerateObjectParams, GenerateWithToolsParams, Provider } from './unified-ai-client.model'; /** * Unified AI Client that supports multiple AI providers (OpenAI, XAI, Gemini) * and allows generating structured responses based on Zod schemas. */ export declare class UnifiedAiClient { private model; private provider; constructor(provider: Provider); /** * Generates a structured response from the AI model based on a Zod schema. * * @template T - The type inferred from the Zod schema * * @param schema - Zod schema defining the expected response structure. * The AI model will be constrained to return data matching this schema. * @param params - Configuration object with prompt, system message, and any additional options. * See {@link GenerateObjectParams} for all available options. * * @returns Promise resolving to the validated object matching the schema type T * * @throws {Error} If the AI provider fails to generate a valid response * @throws {Error} If the response doesn't match the provided schema * * @example * // Define a schema * const SentimentSchema = z.object({ * sentiment: z.enum(['positive', 'negative', 'neutral']), * confidence: z.number().min(0).max(1), * summary: z.string(), * }); * * // Generate structured response * const result = await service.generateStructuredResponse(SentimentSchema, { * prompt: 'I absolutely love this product!', * system: 'You are a sentiment analysis expert. Be precise with confidence scores.', * }); * * console.log(result.sentiment); // 'positive' * console.log(result.confidence); // 0.95 */ generateStructuredResponse(schema: ZodSchema, params: GenerateObjectParams, usageTracker?: AiUsageTracker): Promise; generateStructuredResponseWithTools(schema: ZodSchema, params: GenerateWithToolsParams, usageTracker?: AiUsageTracker): Promise; /** * Retrieves the underlying LanguageModel instance. * @returns The LanguageModel instance used by the UnifiedAiClient. */ getModel(): LanguageModel; private createModel; } //# sourceMappingURL=unified-ai-client.d.ts.map