/** * Shared utilities for structured LLM providers. * Eliminates code duplication across provider implementations. */ import type { z } from "zod"; /** * Generic singleton client factory. * Eliminates duplicated singleton pattern across providers. * * @example * const getClient = createClientGetter( * "ANTHROPIC_API_KEY", * (apiKey) => new Anthropic({ apiKey }) * ); */ export declare function createClientGetter(envVar: string, factory: (apiKey: string) => T): () => T; /** * Clean JSON schema by removing fields unsupported by LLM APIs. * Removes $schema and other metadata fields. */ export declare function cleanJsonSchema(schema: Record): Record; /** * Convert Zod schema to clean JSON schema for LLM tool definitions. * Combines zodToJsonSchema with cleanJsonSchema for convenience. */ export declare function zodToCleanJsonSchema(schema: z.ZodType): Record; /** * Provider-agnostic tool schema conversion result. */ export interface ConvertedToolSchema { name: string; description: string; jsonSchema: Record; } /** * Convert a tool definition to a provider-agnostic intermediate format. * Providers can then map this to their specific structure with minimal code. * * @example * // Anthropic * const { name, description, jsonSchema } = convertToolSchema(tool); * return { name, description, input_schema: jsonSchema }; * * // Google * const { name, description, jsonSchema } = convertToolSchema(tool); * return { name, description, parameters: jsonSchema }; */ export declare function convertToolSchema(tool: { name: string; description: string; inputSchema: z.ZodType; }): ConvertedToolSchema; //# sourceMappingURL=utils.d.ts.map