hazo_llm_api 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +7 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/layout/index.d.ts +7 -0
- package/dist/components/layout/index.d.ts.map +1 -0
- package/dist/components/layout/index.js +7 -0
- package/dist/components/layout/index.js.map +1 -0
- package/dist/components/layout/layout.d.ts +21 -0
- package/dist/components/layout/layout.d.ts.map +1 -0
- package/dist/components/layout/layout.js +18 -0
- package/dist/components/layout/layout.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/config/config_parser.d.ts +131 -0
- package/dist/lib/config/config_parser.d.ts.map +1 -0
- package/dist/lib/config/config_parser.js +297 -0
- package/dist/lib/config/config_parser.js.map +1 -0
- package/dist/lib/config/index.d.ts +8 -0
- package/dist/lib/config/index.d.ts.map +1 -0
- package/dist/lib/config/index.js +22 -0
- package/dist/lib/config/index.js.map +1 -0
- package/dist/lib/config/provider_loader.d.ts +113 -0
- package/dist/lib/config/provider_loader.d.ts.map +1 -0
- package/dist/lib/config/provider_loader.js +169 -0
- package/dist/lib/config/provider_loader.js.map +1 -0
- package/dist/lib/database/index.d.ts +8 -0
- package/dist/lib/database/index.d.ts.map +1 -0
- package/dist/lib/database/index.js +10 -0
- package/dist/lib/database/index.js.map +1 -0
- package/dist/lib/database/init_database.d.ts +118 -0
- package/dist/lib/database/init_database.d.ts.map +1 -0
- package/dist/lib/database/init_database.js +591 -0
- package/dist/lib/database/init_database.js.map +1 -0
- package/dist/lib/database/utils.d.ts +53 -0
- package/dist/lib/database/utils.d.ts.map +1 -0
- package/dist/lib/database/utils.js +87 -0
- package/dist/lib/database/utils.js.map +1 -0
- package/dist/lib/index.d.ts +14 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +17 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/llm_api/chain_helpers.d.ts +117 -0
- package/dist/lib/llm_api/chain_helpers.d.ts.map +1 -0
- package/dist/lib/llm_api/chain_helpers.js +445 -0
- package/dist/lib/llm_api/chain_helpers.js.map +1 -0
- package/dist/lib/llm_api/hazo_llm_image_image.d.ts +26 -0
- package/dist/lib/llm_api/hazo_llm_image_image.d.ts.map +1 -0
- package/dist/lib/llm_api/hazo_llm_image_image.js +94 -0
- package/dist/lib/llm_api/hazo_llm_image_image.js.map +1 -0
- package/dist/lib/llm_api/hazo_llm_image_image_text.d.ts +26 -0
- package/dist/lib/llm_api/hazo_llm_image_image_text.d.ts.map +1 -0
- package/dist/lib/llm_api/hazo_llm_image_image_text.js +222 -0
- package/dist/lib/llm_api/hazo_llm_image_image_text.js.map +1 -0
- package/dist/lib/llm_api/hazo_llm_image_text.d.ts +20 -0
- package/dist/lib/llm_api/hazo_llm_image_text.d.ts.map +1 -0
- package/dist/lib/llm_api/hazo_llm_image_text.js +78 -0
- package/dist/lib/llm_api/hazo_llm_image_text.js.map +1 -0
- package/dist/lib/llm_api/hazo_llm_prompt_chain.d.ts +20 -0
- package/dist/lib/llm_api/hazo_llm_prompt_chain.d.ts.map +1 -0
- package/dist/lib/llm_api/hazo_llm_prompt_chain.js +368 -0
- package/dist/lib/llm_api/hazo_llm_prompt_chain.js.map +1 -0
- package/dist/lib/llm_api/hazo_llm_text_image.d.ts +20 -0
- package/dist/lib/llm_api/hazo_llm_text_image.d.ts.map +1 -0
- package/dist/lib/llm_api/hazo_llm_text_image.js +69 -0
- package/dist/lib/llm_api/hazo_llm_text_image.js.map +1 -0
- package/dist/lib/llm_api/hazo_llm_text_image_text.d.ts +26 -0
- package/dist/lib/llm_api/hazo_llm_text_image_text.d.ts.map +1 -0
- package/dist/lib/llm_api/hazo_llm_text_image_text.js +154 -0
- package/dist/lib/llm_api/hazo_llm_text_image_text.js.map +1 -0
- package/dist/lib/llm_api/hazo_llm_text_text.d.ts +20 -0
- package/dist/lib/llm_api/hazo_llm_text_text.d.ts.map +1 -0
- package/dist/lib/llm_api/hazo_llm_text_text.js +91 -0
- package/dist/lib/llm_api/hazo_llm_text_text.js.map +1 -0
- package/dist/lib/llm_api/index.d.ts +223 -0
- package/dist/lib/llm_api/index.d.ts.map +1 -0
- package/dist/lib/llm_api/index.js +1220 -0
- package/dist/lib/llm_api/index.js.map +1 -0
- package/dist/lib/llm_api/provider_helper.d.ts +163 -0
- package/dist/lib/llm_api/provider_helper.d.ts.map +1 -0
- package/dist/lib/llm_api/provider_helper.js +346 -0
- package/dist/lib/llm_api/provider_helper.js.map +1 -0
- package/dist/lib/llm_api/types.d.ts +667 -0
- package/dist/lib/llm_api/types.d.ts.map +1 -0
- package/dist/lib/llm_api/types.js +49 -0
- package/dist/lib/llm_api/types.js.map +1 -0
- package/dist/lib/prompts/get_prompt.d.ts +76 -0
- package/dist/lib/prompts/get_prompt.d.ts.map +1 -0
- package/dist/lib/prompts/get_prompt.js +342 -0
- package/dist/lib/prompts/get_prompt.js.map +1 -0
- package/dist/lib/prompts/index.d.ts +9 -0
- package/dist/lib/prompts/index.d.ts.map +1 -0
- package/dist/lib/prompts/index.js +9 -0
- package/dist/lib/prompts/index.js.map +1 -0
- package/dist/lib/prompts/prompt_cache.d.ts +151 -0
- package/dist/lib/prompts/prompt_cache.d.ts.map +1 -0
- package/dist/lib/prompts/prompt_cache.js +276 -0
- package/dist/lib/prompts/prompt_cache.js.map +1 -0
- package/dist/lib/prompts/substitute_variables.d.ts +38 -0
- package/dist/lib/prompts/substitute_variables.d.ts.map +1 -0
- package/dist/lib/prompts/substitute_variables.js +171 -0
- package/dist/lib/prompts/substitute_variables.js.map +1 -0
- package/dist/lib/providers/gemini/gemini_client.d.ts +25 -0
- package/dist/lib/providers/gemini/gemini_client.d.ts.map +1 -0
- package/dist/lib/providers/gemini/gemini_client.js +235 -0
- package/dist/lib/providers/gemini/gemini_client.js.map +1 -0
- package/dist/lib/providers/gemini/gemini_provider.d.ts +111 -0
- package/dist/lib/providers/gemini/gemini_provider.d.ts.map +1 -0
- package/dist/lib/providers/gemini/gemini_provider.js +431 -0
- package/dist/lib/providers/gemini/gemini_provider.js.map +1 -0
- package/dist/lib/providers/gemini/index.d.ts +8 -0
- package/dist/lib/providers/gemini/index.d.ts.map +1 -0
- package/dist/lib/providers/gemini/index.js +8 -0
- package/dist/lib/providers/gemini/index.js.map +1 -0
- package/dist/lib/providers/index.d.ts +8 -0
- package/dist/lib/providers/index.d.ts.map +1 -0
- package/dist/lib/providers/index.js +8 -0
- package/dist/lib/providers/index.js.map +1 -0
- package/dist/lib/providers/qwen/index.d.ts +8 -0
- package/dist/lib/providers/qwen/index.d.ts.map +1 -0
- package/dist/lib/providers/qwen/index.js +8 -0
- package/dist/lib/providers/qwen/index.js.map +1 -0
- package/dist/lib/providers/qwen/qwen_client.d.ts +154 -0
- package/dist/lib/providers/qwen/qwen_client.d.ts.map +1 -0
- package/dist/lib/providers/qwen/qwen_client.js +1002 -0
- package/dist/lib/providers/qwen/qwen_client.js.map +1 -0
- package/dist/lib/providers/qwen/qwen_provider.d.ts +139 -0
- package/dist/lib/providers/qwen/qwen_provider.d.ts.map +1 -0
- package/dist/lib/providers/qwen/qwen_provider.js +304 -0
- package/dist/lib/providers/qwen/qwen_provider.js.map +1 -0
- package/dist/lib/providers/registry.d.ts +66 -0
- package/dist/lib/providers/registry.d.ts.map +1 -0
- package/dist/lib/providers/registry.js +158 -0
- package/dist/lib/providers/registry.js.map +1 -0
- package/dist/lib/providers/types.d.ts +145 -0
- package/dist/lib/providers/types.d.ts.map +1 -0
- package/dist/lib/providers/types.js +37 -0
- package/dist/lib/providers/types.js.map +1 -0
- package/dist/server.d.ts +27 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +50 -0
- package/dist/server.js.map +1 -0
- package/package.json +12 -1
|
@@ -0,0 +1,667 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM API Types
|
|
3
|
+
*
|
|
4
|
+
* TypeScript interfaces and types for the LLM API module.
|
|
5
|
+
* Includes configuration, function parameters, and response types.
|
|
6
|
+
*/
|
|
7
|
+
import type { ServiceType, ProviderName } from '../providers/types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Logger interface matching Winston logger methods
|
|
10
|
+
* Parent application provides this logger instance
|
|
11
|
+
*/
|
|
12
|
+
export interface Logger {
|
|
13
|
+
error: (message: string, meta?: Record<string, unknown>) => void;
|
|
14
|
+
info: (message: string, meta?: Record<string, unknown>) => void;
|
|
15
|
+
warn: (message: string, meta?: Record<string, unknown>) => void;
|
|
16
|
+
debug: (message: string, meta?: Record<string, unknown>) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Gemini API generation configuration parameters
|
|
20
|
+
* All parameters are optional - only include in API calls if explicitly set
|
|
21
|
+
*
|
|
22
|
+
* Note: This is used internally by the Gemini provider.
|
|
23
|
+
* Configure via config/hazo_llm_api_config.ini [llm_gemini] section instead of passing directly.
|
|
24
|
+
*/
|
|
25
|
+
export interface GeminiGenerationConfig {
|
|
26
|
+
/** Controls randomness in output (0.0-2.0). Lower = more deterministic */
|
|
27
|
+
temperature?: number;
|
|
28
|
+
/** Maximum number of tokens in the response */
|
|
29
|
+
max_output_tokens?: number;
|
|
30
|
+
/** Nucleus sampling probability (0.0-1.0). Considers tokens up to cumulative probability */
|
|
31
|
+
top_p?: number;
|
|
32
|
+
/** Top-k sampling. Considers only the top K most probable tokens */
|
|
33
|
+
top_k?: number;
|
|
34
|
+
/** Number of response candidates to generate (1-8) */
|
|
35
|
+
candidate_count?: number;
|
|
36
|
+
/** Sequences that stop generation when encountered */
|
|
37
|
+
stop_sequences?: string[];
|
|
38
|
+
/** Format of the response: "text/plain" or "application/json" */
|
|
39
|
+
response_mime_type?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Context passed to beforeRequest hook
|
|
43
|
+
*/
|
|
44
|
+
export interface LLMRequestContext {
|
|
45
|
+
/** Service type being called */
|
|
46
|
+
service_type: ServiceType;
|
|
47
|
+
/** Provider name */
|
|
48
|
+
provider: string;
|
|
49
|
+
/** Request parameters (type varies by service) */
|
|
50
|
+
params: Record<string, unknown>;
|
|
51
|
+
/** Timestamp when request started */
|
|
52
|
+
timestamp: Date;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Context passed to afterResponse hook
|
|
56
|
+
*/
|
|
57
|
+
export interface LLMResponseContext extends LLMRequestContext {
|
|
58
|
+
/** The response from the LLM */
|
|
59
|
+
response: LLMResponse;
|
|
60
|
+
/** Duration of the request in milliseconds */
|
|
61
|
+
duration_ms: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Context passed to onError hook
|
|
65
|
+
*/
|
|
66
|
+
export interface LLMErrorContext extends LLMRequestContext {
|
|
67
|
+
/** The error that occurred */
|
|
68
|
+
error: LLMError;
|
|
69
|
+
/** Duration until error in milliseconds */
|
|
70
|
+
duration_ms: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Hook function called before each LLM request
|
|
74
|
+
* Can be async for logging to external services
|
|
75
|
+
*/
|
|
76
|
+
export type BeforeRequestHook = (context: LLMRequestContext) => void | Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Hook function called after each successful LLM response
|
|
79
|
+
* Can be async for logging/analytics
|
|
80
|
+
*/
|
|
81
|
+
export type AfterResponseHook = (context: LLMResponseContext) => void | Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Hook function called when an error occurs
|
|
84
|
+
* Can be async for error reporting
|
|
85
|
+
*/
|
|
86
|
+
export type OnErrorHook = (context: LLMErrorContext) => void | Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Lifecycle hooks for LLM API calls
|
|
89
|
+
* All hooks are optional and can be async
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* await initialize_llm_api({
|
|
94
|
+
* hooks: {
|
|
95
|
+
* beforeRequest: (ctx) => {
|
|
96
|
+
* console.log(`Calling ${ctx.provider}.${ctx.service_type}`);
|
|
97
|
+
* },
|
|
98
|
+
* afterResponse: (ctx) => {
|
|
99
|
+
* console.log(`Response in ${ctx.duration_ms}ms`);
|
|
100
|
+
* },
|
|
101
|
+
* onError: (ctx) => {
|
|
102
|
+
* console.error(`Error: ${ctx.error.code}`);
|
|
103
|
+
* },
|
|
104
|
+
* },
|
|
105
|
+
* });
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export interface LLMHooks {
|
|
109
|
+
/** Called before each LLM request */
|
|
110
|
+
beforeRequest?: BeforeRequestHook;
|
|
111
|
+
/** Called after each successful LLM response */
|
|
112
|
+
afterResponse?: AfterResponseHook;
|
|
113
|
+
/** Called when an error occurs */
|
|
114
|
+
onError?: OnErrorHook;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Configuration options for initializing the LLM API
|
|
118
|
+
* Supports provider-based architecture where providers are loaded from config file
|
|
119
|
+
*
|
|
120
|
+
* All configuration fields are optional - the API will use sensible defaults:
|
|
121
|
+
* - logger: Default console logger
|
|
122
|
+
* - sqlite_path: From config file or "prompt_library.sqlite" in cwd
|
|
123
|
+
* - hooks: None
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* // Minimal initialization
|
|
128
|
+
* await initialize_llm_api({});
|
|
129
|
+
*
|
|
130
|
+
* // With custom logger and hooks
|
|
131
|
+
* await initialize_llm_api({
|
|
132
|
+
* logger: myLogger,
|
|
133
|
+
* hooks: {
|
|
134
|
+
* beforeRequest: (ctx) => console.log(`Calling ${ctx.provider}`),
|
|
135
|
+
* },
|
|
136
|
+
* });
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export interface LLMApiConfig {
|
|
140
|
+
/**
|
|
141
|
+
* Logger instance from parent application
|
|
142
|
+
* Optional - if not provided, uses default console logger
|
|
143
|
+
*/
|
|
144
|
+
logger?: Logger;
|
|
145
|
+
/**
|
|
146
|
+
* Path to SQLite database file
|
|
147
|
+
* Supports: relative paths, absolute paths, ~ expansion, environment variables
|
|
148
|
+
* Default: "prompt_library.sqlite" (relative to process.cwd())
|
|
149
|
+
*/
|
|
150
|
+
sqlite_path?: string;
|
|
151
|
+
/**
|
|
152
|
+
* Lifecycle hooks for monitoring, logging, and analytics
|
|
153
|
+
* Optional - hooks are called at various points during LLM API calls
|
|
154
|
+
*/
|
|
155
|
+
hooks?: LLMHooks;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Single prompt variable key-value pair
|
|
159
|
+
*/
|
|
160
|
+
export interface PromptVariable {
|
|
161
|
+
[key: string]: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Array of prompt variables for substitution
|
|
165
|
+
* Format: [{ "variable1": "value1", "variable2": "value2" }]
|
|
166
|
+
*/
|
|
167
|
+
export type PromptVariables = PromptVariable[];
|
|
168
|
+
/**
|
|
169
|
+
* Base64 encoded data with MIME type
|
|
170
|
+
* Used for sending images/files to LLM APIs
|
|
171
|
+
*/
|
|
172
|
+
export interface Base64Data {
|
|
173
|
+
/** MIME type of the data (e.g., "image/jpeg", "image/png") */
|
|
174
|
+
mime_type: string;
|
|
175
|
+
/** Base64 encoded string of the data */
|
|
176
|
+
data: string;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Prompt text mode - determines how prompt text is obtained
|
|
180
|
+
*/
|
|
181
|
+
export type PromptTextMode = 'static' | 'dynamic';
|
|
182
|
+
/**
|
|
183
|
+
* Parameters for the call_llm function
|
|
184
|
+
*/
|
|
185
|
+
export interface CallLLMParams {
|
|
186
|
+
/** Area/category of the prompt (required for dynamic mode) */
|
|
187
|
+
prompt_area?: string;
|
|
188
|
+
/** Key identifier for the prompt (required for dynamic mode) */
|
|
189
|
+
prompt_key?: string;
|
|
190
|
+
/** Variables to substitute in the prompt text */
|
|
191
|
+
prompt_variables?: PromptVariables;
|
|
192
|
+
/** Base64 encoded data to include in the prompt (images, etc.) */
|
|
193
|
+
prompt_b64_data?: Base64Data[];
|
|
194
|
+
/** Static prompt text (required for static mode) */
|
|
195
|
+
static_prompt?: string;
|
|
196
|
+
/** Mode for obtaining prompt text: "static" uses static_prompt, "dynamic" fetches from database */
|
|
197
|
+
prompt_text_mode: PromptTextMode;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Prompt record from the prompts_library table
|
|
201
|
+
*/
|
|
202
|
+
export interface PromptRecord {
|
|
203
|
+
/** Unique identifier for the prompt */
|
|
204
|
+
uuid: string;
|
|
205
|
+
/** Area/category of the prompt */
|
|
206
|
+
prompt_area: string;
|
|
207
|
+
/** Key identifier for the prompt */
|
|
208
|
+
prompt_key: string;
|
|
209
|
+
/**
|
|
210
|
+
* Local filter 1 - additional filter for more specific prompt lookup
|
|
211
|
+
* Example: company name, region, or other contextual identifier
|
|
212
|
+
*/
|
|
213
|
+
local_1: string | null;
|
|
214
|
+
/**
|
|
215
|
+
* Local filter 2 - additional filter for more specific prompt lookup
|
|
216
|
+
* Example: department, product line, or other contextual identifier
|
|
217
|
+
*/
|
|
218
|
+
local_2: string | null;
|
|
219
|
+
/**
|
|
220
|
+
* Local filter 3 - additional filter for more specific prompt lookup
|
|
221
|
+
* Example: sub-category, version, or other contextual identifier
|
|
222
|
+
*/
|
|
223
|
+
local_3: string | null;
|
|
224
|
+
/** The actual prompt text */
|
|
225
|
+
prompt_text: string;
|
|
226
|
+
/** JSON string of variables used in the prompt */
|
|
227
|
+
prompt_variables: string;
|
|
228
|
+
/** Additional notes about the prompt */
|
|
229
|
+
prompt_notes: string;
|
|
230
|
+
/** Timestamp when the record was created */
|
|
231
|
+
created_at: string;
|
|
232
|
+
/** Timestamp when the record was last changed */
|
|
233
|
+
changed_by: string;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Error codes for LLM API errors
|
|
237
|
+
* Use these codes for programmatic error handling
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```typescript
|
|
241
|
+
* import { LLM_ERROR_CODES } from 'hazo_llm_api/server';
|
|
242
|
+
*
|
|
243
|
+
* if (response.error_info?.code === LLM_ERROR_CODES.RATE_LIMITED) {
|
|
244
|
+
* // Implement retry logic
|
|
245
|
+
* }
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
export declare const LLM_ERROR_CODES: {
|
|
249
|
+
/** Provider not found in registry */
|
|
250
|
+
readonly PROVIDER_NOT_FOUND: "PROVIDER_NOT_FOUND";
|
|
251
|
+
/** Provider is not enabled in configuration */
|
|
252
|
+
readonly PROVIDER_NOT_ENABLED: "PROVIDER_NOT_ENABLED";
|
|
253
|
+
/** Provider does not support the requested service type */
|
|
254
|
+
readonly CAPABILITY_NOT_SUPPORTED: "CAPABILITY_NOT_SUPPORTED";
|
|
255
|
+
/** API key is missing or invalid */
|
|
256
|
+
readonly API_KEY_MISSING: "API_KEY_MISSING";
|
|
257
|
+
/** Rate limit exceeded */
|
|
258
|
+
readonly RATE_LIMITED: "RATE_LIMITED";
|
|
259
|
+
/** Network error (connection failed, timeout, etc.) */
|
|
260
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
261
|
+
/** Invalid request parameters */
|
|
262
|
+
readonly INVALID_REQUEST: "INVALID_REQUEST";
|
|
263
|
+
/** API returned an error */
|
|
264
|
+
readonly API_ERROR: "API_ERROR";
|
|
265
|
+
/** Request timed out */
|
|
266
|
+
readonly TIMEOUT: "TIMEOUT";
|
|
267
|
+
/** Database error */
|
|
268
|
+
readonly DATABASE_ERROR: "DATABASE_ERROR";
|
|
269
|
+
/** Prompt not found */
|
|
270
|
+
readonly PROMPT_NOT_FOUND: "PROMPT_NOT_FOUND";
|
|
271
|
+
/** Unknown/unexpected error */
|
|
272
|
+
readonly UNKNOWN: "UNKNOWN";
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* Type for LLM error codes
|
|
276
|
+
*/
|
|
277
|
+
export type LLMErrorCode = typeof LLM_ERROR_CODES[keyof typeof LLM_ERROR_CODES];
|
|
278
|
+
/**
|
|
279
|
+
* Structured error information for LLM API responses
|
|
280
|
+
* Provides detailed error information for programmatic handling
|
|
281
|
+
*/
|
|
282
|
+
export interface LLMError {
|
|
283
|
+
/** Error code for programmatic handling */
|
|
284
|
+
code: LLMErrorCode;
|
|
285
|
+
/** Human-readable error message */
|
|
286
|
+
message: string;
|
|
287
|
+
/** Whether this error is potentially retryable */
|
|
288
|
+
retryable: boolean;
|
|
289
|
+
/** Original error details (if applicable) */
|
|
290
|
+
details?: Record<string, unknown>;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Generic LLM API response
|
|
294
|
+
*/
|
|
295
|
+
export interface LLMResponse {
|
|
296
|
+
/** Whether the API call was successful */
|
|
297
|
+
success: boolean;
|
|
298
|
+
/** The generated text response from the LLM */
|
|
299
|
+
text?: string;
|
|
300
|
+
/**
|
|
301
|
+
* Error message if the call failed
|
|
302
|
+
* @deprecated Use error_info for structured error data
|
|
303
|
+
*/
|
|
304
|
+
error?: string;
|
|
305
|
+
/** Structured error information (new in v2.0) */
|
|
306
|
+
error_info?: LLMError;
|
|
307
|
+
/** Raw response from the API */
|
|
308
|
+
raw_response?: unknown;
|
|
309
|
+
/** Base64 encoded image data (for image output functions) */
|
|
310
|
+
image_b64?: string;
|
|
311
|
+
/** MIME type of the generated image */
|
|
312
|
+
image_mime_type?: string;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* A single chunk from a streaming LLM response
|
|
316
|
+
*/
|
|
317
|
+
export interface LLMStreamChunk {
|
|
318
|
+
/** The text content of this chunk */
|
|
319
|
+
text: string;
|
|
320
|
+
/** Whether this is the final chunk */
|
|
321
|
+
done: boolean;
|
|
322
|
+
/**
|
|
323
|
+
* Error message if streaming failed
|
|
324
|
+
* @deprecated Use error_info for structured error data
|
|
325
|
+
*/
|
|
326
|
+
error?: string;
|
|
327
|
+
/** Structured error information if streaming failed */
|
|
328
|
+
error_info?: LLMError;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Async iterator for streaming LLM responses
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```typescript
|
|
335
|
+
* const stream = await hazo_llm_text_text_stream({ prompt: 'Hello' });
|
|
336
|
+
*
|
|
337
|
+
* for await (const chunk of stream) {
|
|
338
|
+
* if (chunk.error) {
|
|
339
|
+
* console.error(chunk.error);
|
|
340
|
+
* break;
|
|
341
|
+
* }
|
|
342
|
+
* process.stdout.write(chunk.text);
|
|
343
|
+
* if (chunk.done) break;
|
|
344
|
+
* }
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
export type LLMStreamResponse = AsyncGenerator<LLMStreamChunk, void, unknown>;
|
|
348
|
+
/**
|
|
349
|
+
* Parameters for hazo_llm_text_text (text input → text output)
|
|
350
|
+
*/
|
|
351
|
+
export interface TextTextParams {
|
|
352
|
+
/** Static prompt text */
|
|
353
|
+
prompt: string;
|
|
354
|
+
/** Variables to substitute in the prompt text */
|
|
355
|
+
prompt_variables?: PromptVariables;
|
|
356
|
+
/** Area/category for dynamic prompt (optional) */
|
|
357
|
+
prompt_area?: string;
|
|
358
|
+
/** Key for dynamic prompt (optional) */
|
|
359
|
+
prompt_key?: string;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Parameters for hazo_llm_image_text (image input → text output)
|
|
363
|
+
*/
|
|
364
|
+
export interface ImageTextParams {
|
|
365
|
+
/** Prompt/instruction for analyzing the image */
|
|
366
|
+
prompt: string;
|
|
367
|
+
/** Base64 encoded image data */
|
|
368
|
+
image_b64: string;
|
|
369
|
+
/** MIME type of the image (e.g., "image/jpeg", "image/png") */
|
|
370
|
+
image_mime_type: string;
|
|
371
|
+
/** Variables to substitute in the prompt text */
|
|
372
|
+
prompt_variables?: PromptVariables;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Parameters for hazo_llm_text_image (text input → image output)
|
|
376
|
+
*/
|
|
377
|
+
export interface TextImageParams {
|
|
378
|
+
/** Text prompt describing the image to generate */
|
|
379
|
+
prompt: string;
|
|
380
|
+
/** Variables to substitute in the prompt text */
|
|
381
|
+
prompt_variables?: PromptVariables;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Parameters for hazo_llm_image_image (image input → image output)
|
|
385
|
+
*/
|
|
386
|
+
export interface ImageImageParams {
|
|
387
|
+
/** Prompt/instruction for transforming the image(s) */
|
|
388
|
+
prompt: string;
|
|
389
|
+
/** Base64 encoded input image data (for single image, use this OR images array) */
|
|
390
|
+
image_b64?: string;
|
|
391
|
+
/** MIME type of the input image (for single image) */
|
|
392
|
+
image_mime_type?: string;
|
|
393
|
+
/** Array of input images (for multiple images) */
|
|
394
|
+
images?: Base64Data[];
|
|
395
|
+
/** Variables to substitute in the prompt text */
|
|
396
|
+
prompt_variables?: PromptVariables;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Parameters for hazo_llm_text_image_text (text → image → text)
|
|
400
|
+
* Generates an image from prompt_image, then analyzes it with prompt_text
|
|
401
|
+
*/
|
|
402
|
+
export interface TextImageTextParams {
|
|
403
|
+
/** Prompt for image generation (step 1) */
|
|
404
|
+
prompt_image: string;
|
|
405
|
+
/** Prompt for analyzing the generated image (step 2) */
|
|
406
|
+
prompt_text: string;
|
|
407
|
+
/** Variables to substitute in the image generation prompt */
|
|
408
|
+
prompt_image_variables?: PromptVariables;
|
|
409
|
+
/** Variables to substitute in the text analysis prompt */
|
|
410
|
+
prompt_text_variables?: PromptVariables;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Base64 image data for chained operations
|
|
414
|
+
*/
|
|
415
|
+
export interface ChainImage {
|
|
416
|
+
/** Base64 encoded image data */
|
|
417
|
+
image_b64: string;
|
|
418
|
+
/** MIME type of the image */
|
|
419
|
+
image_mime_type: string;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Parameters for hazo_llm_image_image_text (images → image → text)
|
|
423
|
+
* Chain multiple image transformations, then describe the final result
|
|
424
|
+
*
|
|
425
|
+
* Flow:
|
|
426
|
+
* 1. Combine images[0] + images[1] using prompts[0] → result_1
|
|
427
|
+
* 2. Combine result_1 + images[2] using prompts[1] → result_2
|
|
428
|
+
* 3. Continue chaining through all images
|
|
429
|
+
* 4. Analyze final result with description_prompt → text output
|
|
430
|
+
*
|
|
431
|
+
* Requirements:
|
|
432
|
+
* - Minimum 2 images required
|
|
433
|
+
* - Number of prompts = number of images - 1
|
|
434
|
+
*/
|
|
435
|
+
export interface ImageImageTextParams {
|
|
436
|
+
/** Array of images to chain (minimum 2) */
|
|
437
|
+
images: ChainImage[];
|
|
438
|
+
/** Array of transformation prompts (length = images.length - 1) */
|
|
439
|
+
prompts: string[];
|
|
440
|
+
/** Final prompt for describing the last generated image */
|
|
441
|
+
description_prompt: string;
|
|
442
|
+
/** Variables to substitute in the description prompt */
|
|
443
|
+
description_prompt_variables?: PromptVariables;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Gemini API text part
|
|
447
|
+
*/
|
|
448
|
+
export interface GeminiTextPart {
|
|
449
|
+
text: string;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Gemini API inline data part (for images)
|
|
453
|
+
*/
|
|
454
|
+
export interface GeminiInlineDataPart {
|
|
455
|
+
inline_data: {
|
|
456
|
+
mime_type: string;
|
|
457
|
+
data: string;
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Gemini API part (either text or inline data)
|
|
462
|
+
*/
|
|
463
|
+
export type GeminiPart = GeminiTextPart | GeminiInlineDataPart;
|
|
464
|
+
/**
|
|
465
|
+
* Gemini API content structure
|
|
466
|
+
*/
|
|
467
|
+
export interface GeminiContent {
|
|
468
|
+
parts: GeminiPart[];
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Gemini API generation config in request format (camelCase for API)
|
|
472
|
+
*/
|
|
473
|
+
export interface GeminiApiGenerationConfig {
|
|
474
|
+
temperature?: number;
|
|
475
|
+
maxOutputTokens?: number;
|
|
476
|
+
topP?: number;
|
|
477
|
+
topK?: number;
|
|
478
|
+
candidateCount?: number;
|
|
479
|
+
stopSequences?: string[];
|
|
480
|
+
responseMimeType?: string;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Gemini API request body
|
|
484
|
+
*/
|
|
485
|
+
export interface GeminiRequestBody {
|
|
486
|
+
contents: GeminiContent[];
|
|
487
|
+
generationConfig?: GeminiApiGenerationConfig;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Gemini API response candidate
|
|
491
|
+
*/
|
|
492
|
+
export interface GeminiCandidate {
|
|
493
|
+
content: {
|
|
494
|
+
parts: Array<{
|
|
495
|
+
text: string;
|
|
496
|
+
}>;
|
|
497
|
+
role: string;
|
|
498
|
+
};
|
|
499
|
+
finishReason: string;
|
|
500
|
+
index: number;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Gemini API response structure
|
|
504
|
+
*/
|
|
505
|
+
export interface GeminiApiResponse {
|
|
506
|
+
candidates?: GeminiCandidate[];
|
|
507
|
+
promptFeedback?: {
|
|
508
|
+
safetyRatings: Array<{
|
|
509
|
+
category: string;
|
|
510
|
+
probability: string;
|
|
511
|
+
}>;
|
|
512
|
+
};
|
|
513
|
+
error?: {
|
|
514
|
+
code: number;
|
|
515
|
+
message: string;
|
|
516
|
+
status: string;
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Initialized LLM API client instance
|
|
521
|
+
*/
|
|
522
|
+
export interface LLMApiClient {
|
|
523
|
+
/** Configuration used to initialize the client */
|
|
524
|
+
config: LLMApiConfig;
|
|
525
|
+
/** Whether the database has been initialized */
|
|
526
|
+
db_initialized: boolean;
|
|
527
|
+
/** Text input → Text output */
|
|
528
|
+
hazo_llm_text_text: (params: TextTextParams, llm?: ProviderName) => Promise<LLMResponse>;
|
|
529
|
+
/** Image input → Text output (image analysis) */
|
|
530
|
+
hazo_llm_image_text: (params: ImageTextParams, llm?: ProviderName) => Promise<LLMResponse>;
|
|
531
|
+
/** Text input → Image output (image generation) */
|
|
532
|
+
hazo_llm_text_image: (params: TextImageParams, llm?: ProviderName) => Promise<LLMResponse>;
|
|
533
|
+
/** Image input → Image output (image transformation) */
|
|
534
|
+
hazo_llm_image_image: (params: ImageImageParams, llm?: ProviderName) => Promise<LLMResponse>;
|
|
535
|
+
/** Text → Image → Text (generate image then analyze it) */
|
|
536
|
+
hazo_llm_text_image_text: (params: TextImageTextParams, llm?: ProviderName) => Promise<LLMResponse>;
|
|
537
|
+
/** Images → Image → Text (chain image transformations then describe) */
|
|
538
|
+
hazo_llm_image_image_text: (params: ImageImageTextParams, llm?: ProviderName) => Promise<LLMResponse>;
|
|
539
|
+
/** Execute a chain of prompts with dynamic value resolution */
|
|
540
|
+
hazo_llm_prompt_chain: (params: PromptChainParams, llm?: ProviderName) => Promise<PromptChainResponse>;
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Match type for prompt chain field resolution
|
|
544
|
+
* - "direct": Use the value as-is
|
|
545
|
+
* - "call_chain": Parse value from a previous call result (e.g., "call[0].tax_category")
|
|
546
|
+
*/
|
|
547
|
+
export type ChainMatchType = 'direct' | 'call_chain';
|
|
548
|
+
/**
|
|
549
|
+
* A field definition in a chain call for prompt_area and prompt_key
|
|
550
|
+
* Can be either a direct value or a reference to a previous call result
|
|
551
|
+
*/
|
|
552
|
+
export interface ChainFieldDefinition {
|
|
553
|
+
/** How to resolve the field value */
|
|
554
|
+
match_type: ChainMatchType;
|
|
555
|
+
/** The value (direct) or path expression (call_chain) */
|
|
556
|
+
value: string;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* A variable definition for substitution in the prompt
|
|
560
|
+
* Specifies how to resolve a value and which variable name to substitute
|
|
561
|
+
*/
|
|
562
|
+
export interface ChainVariableDefinition {
|
|
563
|
+
/** How to resolve the variable value */
|
|
564
|
+
match_type: ChainMatchType;
|
|
565
|
+
/** The value (direct) or path expression (call_chain, e.g., "call[0].result.country") */
|
|
566
|
+
value: string;
|
|
567
|
+
/** The variable name to substitute in the prompt (uses $variable_name syntax) */
|
|
568
|
+
variable_name: string;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Image definition for multi-image chain calls
|
|
572
|
+
* Used when image_image call type needs multiple input images
|
|
573
|
+
*/
|
|
574
|
+
export interface ChainImageDefinition {
|
|
575
|
+
/** Base64 image data (direct or call_chain reference) */
|
|
576
|
+
image_b64: ChainFieldDefinition;
|
|
577
|
+
/** MIME type (direct or call_chain reference) */
|
|
578
|
+
image_mime_type: ChainFieldDefinition;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* A single call definition in a prompt chain
|
|
582
|
+
* Supports all 4 service types: text_text, image_text, text_image, image_image
|
|
583
|
+
*/
|
|
584
|
+
export interface ChainCallDefinition {
|
|
585
|
+
/**
|
|
586
|
+
* Service type to invoke
|
|
587
|
+
* - 'text_text': Text input → Text output (default)
|
|
588
|
+
* - 'image_text': Image + Text input → Text output
|
|
589
|
+
* - 'text_image': Text input → Image output
|
|
590
|
+
* - 'image_image': Image + Text input → Image output
|
|
591
|
+
*/
|
|
592
|
+
call_type?: ServiceType;
|
|
593
|
+
/** Prompt area for database lookup (required) */
|
|
594
|
+
prompt_area: ChainFieldDefinition;
|
|
595
|
+
/** Prompt key for database lookup (required) */
|
|
596
|
+
prompt_key: ChainFieldDefinition;
|
|
597
|
+
/** Optional array of variables to substitute in the prompt */
|
|
598
|
+
variables?: ChainVariableDefinition[];
|
|
599
|
+
/**
|
|
600
|
+
* Single image base64 data (for image_text, image_image single mode)
|
|
601
|
+
* Can reference previous call output via call_chain: "call[0].image_b64"
|
|
602
|
+
*/
|
|
603
|
+
image_b64?: ChainFieldDefinition;
|
|
604
|
+
/**
|
|
605
|
+
* MIME type for single image (for image_text, image_image single mode)
|
|
606
|
+
* Can reference previous call output via call_chain: "call[0].image_mime_type"
|
|
607
|
+
*/
|
|
608
|
+
image_mime_type?: ChainFieldDefinition;
|
|
609
|
+
/**
|
|
610
|
+
* Multiple images (for image_image multi mode)
|
|
611
|
+
* Each image can reference previous call outputs
|
|
612
|
+
*/
|
|
613
|
+
images?: ChainImageDefinition[];
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Result of a single call in the chain
|
|
617
|
+
*/
|
|
618
|
+
export interface ChainCallResult {
|
|
619
|
+
/** Call index (0-based) */
|
|
620
|
+
call_index: number;
|
|
621
|
+
/** Whether this call succeeded */
|
|
622
|
+
success: boolean;
|
|
623
|
+
/** Raw text response from LLM (for text_text, image_text) */
|
|
624
|
+
raw_text?: string;
|
|
625
|
+
/** Parsed JSON result (if LLM returned valid JSON) */
|
|
626
|
+
parsed_result?: Record<string, unknown>;
|
|
627
|
+
/** Generated image base64 data (for text_image, image_image) */
|
|
628
|
+
image_b64?: string;
|
|
629
|
+
/** MIME type of generated image (for text_image, image_image) */
|
|
630
|
+
image_mime_type?: string;
|
|
631
|
+
/** Error message if call failed */
|
|
632
|
+
error?: string;
|
|
633
|
+
/** The prompt_area used for this call */
|
|
634
|
+
prompt_area: string;
|
|
635
|
+
/** The prompt_key used for this call */
|
|
636
|
+
prompt_key: string;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Parameters for hazo_llm_prompt_chain function
|
|
640
|
+
*/
|
|
641
|
+
export interface PromptChainParams {
|
|
642
|
+
/** Array of chain call definitions */
|
|
643
|
+
chain_calls: ChainCallDefinition[];
|
|
644
|
+
/** Whether to continue on error (skip failed calls) - defaults to true */
|
|
645
|
+
continue_on_error?: boolean;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Response from hazo_llm_prompt_chain function
|
|
649
|
+
*/
|
|
650
|
+
export interface PromptChainResponse {
|
|
651
|
+
/** Overall success (true if at least one call succeeded) */
|
|
652
|
+
success: boolean;
|
|
653
|
+
/** Deep-merged result object from all successful calls */
|
|
654
|
+
merged_result: Record<string, unknown>;
|
|
655
|
+
/** Individual results for each call */
|
|
656
|
+
call_results: ChainCallResult[];
|
|
657
|
+
/** Array of errors encountered */
|
|
658
|
+
errors: Array<{
|
|
659
|
+
call_index: number;
|
|
660
|
+
error: string;
|
|
661
|
+
}>;
|
|
662
|
+
/** Total number of calls attempted */
|
|
663
|
+
total_calls: number;
|
|
664
|
+
/** Number of successful calls */
|
|
665
|
+
successful_calls: number;
|
|
666
|
+
}
|
|
667
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/llm_api/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAMvE;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACjE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAChE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAChE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CAClE;AAMD;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,0EAA0E;IAC1E,WAAW,C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