/** * Configuration Parser Module * * Generic configuration parsing utilities for LLM providers. * Provides a unified approach to parsing generation configs from INI files. */ import type { ServiceType } from '../providers/types.js'; /** * Generic generation config that works across providers * Each provider can extend this with their specific fields */ export interface BaseGenerationConfig { temperature?: number; max_tokens?: number; top_p?: number; top_k?: number; stop_sequences?: string[]; } /** * Parameter mapping definition for config parsing * Maps internal field names to possible INI key variations */ export interface ParameterMapping { /** Internal field name */ field: string; /** Possible keys in INI file (checked in order) */ keys: string[]; /** Type of the parameter */ type: 'number' | 'string' | 'json_array'; } /** * Standard parameter mappings for common generation config fields * Each provider can use these or define their own */ export declare const COMMON_PARAM_MAPPINGS: ParameterMapping[]; /** * Gemini-specific parameter mappings */ export declare const GEMINI_PARAM_MAPPINGS: ParameterMapping[]; /** * Qwen-specific parameter mappings */ export declare const QWEN_PARAM_MAPPINGS: ParameterMapping[]; /** * Find the config file path * Searches in config/ subdirectory and parent directories * * @param filename - Config filename to search for (default: hazo_llm_api_config.ini) * @returns The path to the config file or null if not found */ export declare function find_config_file(filename?: string): string | null; /** * Read and parse an INI config file * * @param config_path - Path to the config file * @returns Parsed config object or null if reading fails */ export declare function read_config_file(config_path: string): Record> | null; /** * Parse a generation config from an INI section using parameter mappings * * This is a generic parser that works with any provider by using * configurable parameter mappings. * * @param section - The parsed INI section object * @param mappings - Array of parameter mappings to use * @param prefix - Optional prefix to prepend to all keys (e.g., "text_" or "image_") * @returns Parsed config object or undefined if no params set * * @example * ```typescript * // Parse Gemini text config * const text_config = parse_generation_config( * gemini_section, * GEMINI_PARAM_MAPPINGS, * 'text_' * ); * * // Parse Qwen image config * const image_config = parse_generation_config( * qwen_section, * QWEN_PARAM_MAPPINGS, * 'image_' * ); * ``` */ export declare function parse_generation_config>(section: Record | undefined, mappings: ParameterMapping[], prefix?: string): T | undefined; /** * Parse capabilities from config value (JSON array or comma-separated) * * @param value - Capabilities value from config * @returns Array of ServiceType or empty array */ export declare function parse_capabilities(value: string | undefined): ServiceType[]; /** * Parse enabled_llms from config (JSON array or comma-separated) * * @param value - Enabled LLMs value from config * @param default_value - Default value if parsing fails * @returns Array of LLM names */ export declare function parse_enabled_llms(value: string | undefined, default_value?: string[]): string[]; /** * Load API key from environment variable * * @param provider_name - Provider name (e.g., "gemini", "qwen", "openai") * @returns API key or undefined if not found */ export declare function load_api_key_from_env(provider_name: string): string | undefined; /** * Get the environment variable name for a provider's API key * * @param provider_name - Provider name * @returns Environment variable name */ export declare function get_api_key_env_var_name(provider_name: string): string; /** * Global LLM configuration from [llm] section */ export interface GlobalLLMConfig { enabled_llms: string[]; primary_llm: string; sqlite_path: string; } /** * Read LLM global config from [llm] section * * @returns Object with enabled_llms, primary_llm, and sqlite_path */ export declare function get_llm_global_config(): GlobalLLMConfig; //# sourceMappingURL=config_parser.d.ts.map