/** * hazo_llm_dynamic_data_extract Function * * Executes a chain of LLM calls where the next prompt is determined by * JSON output from the current call using the next_prompt database field * with JSONPath extraction and conditional branching. */ import type { DynamicDataExtractParams, DynamicDataExtractResponse, LLMApiConfig } from './types.js'; import type { HazoConnect } from '../hazo_connect/types.js'; /** * Execute a dynamic chain of LLM calls guided by next_prompt configuration * * The chain starts with the initial prompt and continues until: * - A prompt has no next_prompt configured (normal termination) * - max_depth is reached (safety limit) * - An error occurs (if continue_on_error is false) * - The resolved next prompt doesn't exist in the database * * Each step's JSON output is deep-merged with accumulated results, * which are then available for variable substitution in subsequent prompts. * * @param params - Dynamic extract parameters * @param hazo_connect - HazoConnect instance for database access * @param config - LLM API configuration * @param llm - Optional LLM provider name * @returns Dynamic extract response with merged results and step details * * @example * ```typescript * // Setup prompts: * // - "doc/classify" returns { document_type: "invoice" } * // with next_prompt: { static_prompt_area: "doc", dynamic_prompt_key: "$.document_type" } * // - "doc/invoice" returns { amount: 1500, vendor: "ACME" } * // with no next_prompt (terminates chain) * * const result = await hazo_llm_dynamic_data_extract({ * initial_prompt_area: 'doc', * initial_prompt_key: 'classify', * image_b64: '...', * image_mime_type: 'image/png' * }, hazo_connect, config); * * // result.merged_result = { document_type: 'invoice', amount: 1500, vendor: 'ACME' } * // result.step_results = [{ step_index: 0, ... }, { step_index: 1, ... }] * // result.final_stop_reason = 'no_next_prompt' * ``` */ export declare function hazo_llm_dynamic_data_extract(params: DynamicDataExtractParams, hazo_connect: HazoConnect, config: LLMApiConfig, llm?: string): Promise; //# sourceMappingURL=hazo_llm_dynamic_data_extract.d.ts.map