@adaptic/lumic-utils 1.0.12 → 1.0.14
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/apollo-client.client-Lu1K9ohp.js +3694 -0
- package/dist/apollo-client.client-Lu1K9ohp.js.map +1 -0
- package/dist/apollo-client.client-YFsBF7bL.js +3705 -0
- package/dist/apollo-client.client-YFsBF7bL.js.map +1 -0
- package/dist/apollo-client.server-CAtwy7W4.js +16320 -0
- package/dist/apollo-client.server-CAtwy7W4.js.map +1 -0
- package/dist/apollo-client.server-CWrxRFr9.js +16322 -0
- package/dist/apollo-client.server-CWrxRFr9.js.map +1 -0
- package/dist/index-Bc3hrZJm.js +12108 -0
- package/dist/index-Bc3hrZJm.js.map +1 -0
- package/dist/index-CZkVRs3j.js +75962 -0
- package/dist/index-CZkVRs3j.js.map +1 -0
- package/dist/{index-CcXQeJz8.js → index-Cstek604.js} +182 -22
- package/dist/index-Cstek604.js.map +1 -0
- package/dist/index-DT2sMbfH.js +76169 -0
- package/dist/index-DT2sMbfH.js.map +1 -0
- package/dist/index-DZUGtDjj.js +12271 -0
- package/dist/index-DZUGtDjj.js.map +1 -0
- package/dist/{index-CcgbRft2.js → index-DZZCd-1T.js} +182 -22
- package/dist/index-DZZCd-1T.js.map +1 -0
- package/dist/index.cjs +137 -11417
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +40 -11399
- package/dist/index.mjs.map +1 -1
- package/dist/test.cjs +25 -7
- package/dist/test.cjs.map +1 -1
- package/dist/test.mjs +25 -7
- package/dist/test.mjs.map +1 -1
- package/dist/types/config/__tests__/secrets.test.d.ts +1 -0
- package/dist/types/config/secrets.d.ts +286 -0
- package/dist/types/errors/__tests__/errors.test.d.ts +1 -0
- package/dist/types/errors/index.d.ts +77 -0
- package/dist/types/functions/__tests__/aws-lambda.test.d.ts +1 -0
- package/dist/types/functions/__tests__/aws-s3-utils.test.d.ts +1 -0
- package/dist/types/functions/__tests__/json-llm-tools.test.d.ts +1 -0
- package/dist/types/functions/__tests__/json-tools.test.d.ts +1 -0
- package/dist/types/functions/__tests__/slack-utils.test.d.ts +1 -0
- package/dist/types/functions/aws-lambda.d.ts +1 -1
- package/dist/types/functions/aws-s3-utils.d.ts +2 -2
- package/dist/types/functions/google-sheets.d.ts +4 -4
- package/dist/types/functions/json-llm-tools.d.ts +25 -3
- package/dist/types/functions/llm-anthropic.d.ts +14 -0
- package/dist/types/functions/llm-call.d.ts +14 -3
- package/dist/types/functions/llm-config.d.ts +13 -8
- package/dist/types/functions/llm-deepseek.d.ts +1 -1
- package/dist/types/functions/llm-openai-compatible.d.ts +15 -0
- package/dist/types/functions/llm-openai.d.ts +3 -2
- package/dist/types/functions/llm-utils.d.ts +24 -1
- package/dist/types/functions/slack-utils.d.ts +3 -4
- package/dist/types/functions/utils.d.ts +2 -14
- package/dist/types/functions/zip-utils.d.ts +12 -10
- package/dist/types/index.d.ts +33 -0
- package/dist/types/schemas/aws-schemas.d.ts +210 -0
- package/dist/types/schemas/google-sheets-schemas.d.ts +32 -0
- package/dist/types/schemas/index.d.ts +17 -0
- package/dist/types/schemas/openai-schemas.d.ts +834 -0
- package/dist/types/schemas/perplexity-schemas.d.ts +338 -0
- package/dist/types/schemas/validation-helpers.d.ts +33 -0
- package/dist/types/types/aws-types.d.ts +1 -1
- package/dist/types/types/google-types.d.ts +5 -3
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/openai-types.d.ts +396 -6
- package/dist/types/utils/__tests__/circuit-breaker.test.d.ts +1 -0
- package/dist/types/utils/__tests__/correlation.test.d.ts +1 -0
- package/dist/types/utils/__tests__/input-validator.test.d.ts +1 -0
- package/dist/types/utils/__tests__/llm-cost-tracker.test.d.ts +1 -0
- package/dist/types/utils/__tests__/logger.test.d.ts +1 -0
- package/dist/types/utils/__tests__/metrics.test.d.ts +1 -0
- package/dist/types/utils/__tests__/retry.test.d.ts +1 -0
- package/dist/types/utils/__tests__/sanitizer.test.d.ts +1 -0
- package/dist/types/utils/__tests__/timeouts.test.d.ts +1 -0
- package/dist/types/utils/aws-initialise.d.ts +6 -1
- package/dist/types/utils/circuit-breaker.d.ts +99 -0
- package/dist/types/utils/config.d.ts +40 -2
- package/dist/types/utils/correlation.d.ts +43 -0
- package/dist/types/utils/health-check.d.ts +50 -0
- package/dist/types/utils/input-validator.d.ts +51 -0
- package/dist/types/utils/llm-cost-tracker.d.ts +174 -0
- package/dist/types/utils/logger.d.ts +8 -0
- package/dist/types/utils/metrics.d.ts +61 -0
- package/dist/types/utils/rate-limiter.d.ts +85 -0
- package/dist/types/utils/retry.d.ts +58 -0
- package/dist/types/utils/sanitizer.d.ts +30 -0
- package/dist/types/utils/timeouts.d.ts +44 -0
- package/package.json +2 -1
- package/dist/index-CcXQeJz8.js.map +0 -1
- package/dist/index-CcgbRft2.js.map +0 -1
- package/dist/types/aws-types.ts +0 -64
- package/dist/types/google-types.ts +0 -48
- package/dist/types/index.ts +0 -57
- package/dist/types/openai-types.ts +0 -92
|
@@ -1,17 +1,395 @@
|
|
|
1
1
|
import { ChatCompletionMessageParam, ChatCompletionTool, ChatCompletionMessageToolCall } from 'openai/resources/chat/completions';
|
|
2
2
|
import { ImageGenerateParams } from 'openai/resources/images';
|
|
3
|
+
/**
|
|
4
|
+
* All supported LLM provider identifiers
|
|
5
|
+
*/
|
|
6
|
+
export type LLMProvider = 'openai' | 'anthropic' | 'deepseek' | 'kimi' | 'qwen' | 'xai' | 'gemini';
|
|
7
|
+
/**
|
|
8
|
+
* Model capability configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface ModelCapabilities {
|
|
11
|
+
provider: LLMProvider;
|
|
12
|
+
supportsTools: boolean;
|
|
13
|
+
supportsJson: boolean;
|
|
14
|
+
supportsStructuredOutput: boolean;
|
|
15
|
+
supportsDeveloperPrompt: boolean;
|
|
16
|
+
supportsTemperature: boolean;
|
|
17
|
+
isReasoningModel: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Configuration for OpenAI-compatible providers (Deepseek, Kimi, Qwen, xAI, Gemini, etc.)
|
|
21
|
+
*/
|
|
22
|
+
export interface OpenAICompatibleProviderConfig {
|
|
23
|
+
name: LLMProvider;
|
|
24
|
+
baseURL: string;
|
|
25
|
+
apiKeySecretPath: string;
|
|
26
|
+
apiKeyEnvVar: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Registry of OpenAI-compatible provider configurations.
|
|
30
|
+
* These providers use the OpenAI SDK with a custom baseURL.
|
|
31
|
+
*/
|
|
32
|
+
export declare const OPENAI_COMPATIBLE_PROVIDERS: Record<string, OpenAICompatibleProviderConfig>;
|
|
33
|
+
/**
|
|
34
|
+
* Supported models with their capabilities
|
|
35
|
+
*/
|
|
36
|
+
export declare const SUPPORTED_MODELS: {
|
|
37
|
+
readonly 'gpt-5.4': {
|
|
38
|
+
readonly provider: "openai";
|
|
39
|
+
readonly supportsTools: true;
|
|
40
|
+
readonly supportsJson: true;
|
|
41
|
+
readonly supportsStructuredOutput: true;
|
|
42
|
+
readonly supportsDeveloperPrompt: true;
|
|
43
|
+
readonly supportsTemperature: true;
|
|
44
|
+
readonly isReasoningModel: false;
|
|
45
|
+
};
|
|
46
|
+
readonly 'gpt-5.4-mini': {
|
|
47
|
+
readonly provider: "openai";
|
|
48
|
+
readonly supportsTools: true;
|
|
49
|
+
readonly supportsJson: true;
|
|
50
|
+
readonly supportsStructuredOutput: true;
|
|
51
|
+
readonly supportsDeveloperPrompt: true;
|
|
52
|
+
readonly supportsTemperature: true;
|
|
53
|
+
readonly isReasoningModel: false;
|
|
54
|
+
};
|
|
55
|
+
readonly 'gpt-5.4-nano': {
|
|
56
|
+
readonly provider: "openai";
|
|
57
|
+
readonly supportsTools: true;
|
|
58
|
+
readonly supportsJson: true;
|
|
59
|
+
readonly supportsStructuredOutput: true;
|
|
60
|
+
readonly supportsDeveloperPrompt: true;
|
|
61
|
+
readonly supportsTemperature: true;
|
|
62
|
+
readonly isReasoningModel: false;
|
|
63
|
+
};
|
|
64
|
+
readonly 'gpt-5': {
|
|
65
|
+
readonly provider: "openai";
|
|
66
|
+
readonly supportsTools: true;
|
|
67
|
+
readonly supportsJson: true;
|
|
68
|
+
readonly supportsStructuredOutput: true;
|
|
69
|
+
readonly supportsDeveloperPrompt: true;
|
|
70
|
+
readonly supportsTemperature: true;
|
|
71
|
+
readonly isReasoningModel: false;
|
|
72
|
+
};
|
|
73
|
+
readonly 'gpt-5-mini': {
|
|
74
|
+
readonly provider: "openai";
|
|
75
|
+
readonly supportsTools: true;
|
|
76
|
+
readonly supportsJson: true;
|
|
77
|
+
readonly supportsStructuredOutput: true;
|
|
78
|
+
readonly supportsDeveloperPrompt: true;
|
|
79
|
+
readonly supportsTemperature: true;
|
|
80
|
+
readonly isReasoningModel: false;
|
|
81
|
+
};
|
|
82
|
+
readonly 'gpt-4.1': {
|
|
83
|
+
readonly provider: "openai";
|
|
84
|
+
readonly supportsTools: true;
|
|
85
|
+
readonly supportsJson: true;
|
|
86
|
+
readonly supportsStructuredOutput: true;
|
|
87
|
+
readonly supportsDeveloperPrompt: true;
|
|
88
|
+
readonly supportsTemperature: true;
|
|
89
|
+
readonly isReasoningModel: false;
|
|
90
|
+
};
|
|
91
|
+
readonly 'gpt-4.1-mini': {
|
|
92
|
+
readonly provider: "openai";
|
|
93
|
+
readonly supportsTools: true;
|
|
94
|
+
readonly supportsJson: true;
|
|
95
|
+
readonly supportsStructuredOutput: true;
|
|
96
|
+
readonly supportsDeveloperPrompt: true;
|
|
97
|
+
readonly supportsTemperature: true;
|
|
98
|
+
readonly isReasoningModel: false;
|
|
99
|
+
};
|
|
100
|
+
readonly 'gpt-4.1-nano': {
|
|
101
|
+
readonly provider: "openai";
|
|
102
|
+
readonly supportsTools: true;
|
|
103
|
+
readonly supportsJson: true;
|
|
104
|
+
readonly supportsStructuredOutput: true;
|
|
105
|
+
readonly supportsDeveloperPrompt: true;
|
|
106
|
+
readonly supportsTemperature: true;
|
|
107
|
+
readonly isReasoningModel: false;
|
|
108
|
+
};
|
|
109
|
+
readonly o1: {
|
|
110
|
+
readonly provider: "openai";
|
|
111
|
+
readonly supportsTools: true;
|
|
112
|
+
readonly supportsJson: false;
|
|
113
|
+
readonly supportsStructuredOutput: true;
|
|
114
|
+
readonly supportsDeveloperPrompt: true;
|
|
115
|
+
readonly supportsTemperature: false;
|
|
116
|
+
readonly isReasoningModel: true;
|
|
117
|
+
};
|
|
118
|
+
readonly 'o1-mini': {
|
|
119
|
+
readonly provider: "openai";
|
|
120
|
+
readonly supportsTools: true;
|
|
121
|
+
readonly supportsJson: false;
|
|
122
|
+
readonly supportsStructuredOutput: false;
|
|
123
|
+
readonly supportsDeveloperPrompt: false;
|
|
124
|
+
readonly supportsTemperature: false;
|
|
125
|
+
readonly isReasoningModel: true;
|
|
126
|
+
};
|
|
127
|
+
readonly o3: {
|
|
128
|
+
readonly provider: "openai";
|
|
129
|
+
readonly supportsTools: true;
|
|
130
|
+
readonly supportsJson: false;
|
|
131
|
+
readonly supportsStructuredOutput: true;
|
|
132
|
+
readonly supportsDeveloperPrompt: true;
|
|
133
|
+
readonly supportsTemperature: false;
|
|
134
|
+
readonly isReasoningModel: true;
|
|
135
|
+
};
|
|
136
|
+
readonly 'o3-mini': {
|
|
137
|
+
readonly provider: "openai";
|
|
138
|
+
readonly supportsTools: true;
|
|
139
|
+
readonly supportsJson: true;
|
|
140
|
+
readonly supportsStructuredOutput: true;
|
|
141
|
+
readonly supportsDeveloperPrompt: true;
|
|
142
|
+
readonly supportsTemperature: false;
|
|
143
|
+
readonly isReasoningModel: true;
|
|
144
|
+
};
|
|
145
|
+
readonly 'o4-mini': {
|
|
146
|
+
readonly provider: "openai";
|
|
147
|
+
readonly supportsTools: true;
|
|
148
|
+
readonly supportsJson: false;
|
|
149
|
+
readonly supportsStructuredOutput: true;
|
|
150
|
+
readonly supportsDeveloperPrompt: true;
|
|
151
|
+
readonly supportsTemperature: false;
|
|
152
|
+
readonly isReasoningModel: true;
|
|
153
|
+
};
|
|
154
|
+
readonly 'claude-opus-4-6': {
|
|
155
|
+
readonly provider: "anthropic";
|
|
156
|
+
readonly supportsTools: true;
|
|
157
|
+
readonly supportsJson: false;
|
|
158
|
+
readonly supportsStructuredOutput: false;
|
|
159
|
+
readonly supportsDeveloperPrompt: true;
|
|
160
|
+
readonly supportsTemperature: true;
|
|
161
|
+
readonly isReasoningModel: false;
|
|
162
|
+
};
|
|
163
|
+
readonly 'claude-sonnet-4-6': {
|
|
164
|
+
readonly provider: "anthropic";
|
|
165
|
+
readonly supportsTools: true;
|
|
166
|
+
readonly supportsJson: false;
|
|
167
|
+
readonly supportsStructuredOutput: false;
|
|
168
|
+
readonly supportsDeveloperPrompt: true;
|
|
169
|
+
readonly supportsTemperature: true;
|
|
170
|
+
readonly isReasoningModel: false;
|
|
171
|
+
};
|
|
172
|
+
readonly 'claude-haiku-4-5': {
|
|
173
|
+
readonly provider: "anthropic";
|
|
174
|
+
readonly supportsTools: true;
|
|
175
|
+
readonly supportsJson: false;
|
|
176
|
+
readonly supportsStructuredOutput: false;
|
|
177
|
+
readonly supportsDeveloperPrompt: true;
|
|
178
|
+
readonly supportsTemperature: true;
|
|
179
|
+
readonly isReasoningModel: false;
|
|
180
|
+
};
|
|
181
|
+
readonly 'deepseek-chat': {
|
|
182
|
+
readonly provider: "deepseek";
|
|
183
|
+
readonly supportsTools: true;
|
|
184
|
+
readonly supportsJson: true;
|
|
185
|
+
readonly supportsStructuredOutput: false;
|
|
186
|
+
readonly supportsDeveloperPrompt: true;
|
|
187
|
+
readonly supportsTemperature: true;
|
|
188
|
+
readonly isReasoningModel: false;
|
|
189
|
+
};
|
|
190
|
+
readonly 'deepseek-reasoner': {
|
|
191
|
+
readonly provider: "deepseek";
|
|
192
|
+
readonly supportsTools: false;
|
|
193
|
+
readonly supportsJson: false;
|
|
194
|
+
readonly supportsStructuredOutput: false;
|
|
195
|
+
readonly supportsDeveloperPrompt: true;
|
|
196
|
+
readonly supportsTemperature: true;
|
|
197
|
+
readonly isReasoningModel: true;
|
|
198
|
+
};
|
|
199
|
+
readonly 'kimi-k2-0905-preview': {
|
|
200
|
+
readonly provider: "kimi";
|
|
201
|
+
readonly supportsTools: true;
|
|
202
|
+
readonly supportsJson: true;
|
|
203
|
+
readonly supportsStructuredOutput: false;
|
|
204
|
+
readonly supportsDeveloperPrompt: true;
|
|
205
|
+
readonly supportsTemperature: true;
|
|
206
|
+
readonly isReasoningModel: false;
|
|
207
|
+
};
|
|
208
|
+
readonly 'kimi-k2-turbo-preview': {
|
|
209
|
+
readonly provider: "kimi";
|
|
210
|
+
readonly supportsTools: true;
|
|
211
|
+
readonly supportsJson: true;
|
|
212
|
+
readonly supportsStructuredOutput: false;
|
|
213
|
+
readonly supportsDeveloperPrompt: true;
|
|
214
|
+
readonly supportsTemperature: true;
|
|
215
|
+
readonly isReasoningModel: false;
|
|
216
|
+
};
|
|
217
|
+
readonly 'kimi-k2-thinking': {
|
|
218
|
+
readonly provider: "kimi";
|
|
219
|
+
readonly supportsTools: true;
|
|
220
|
+
readonly supportsJson: true;
|
|
221
|
+
readonly supportsStructuredOutput: false;
|
|
222
|
+
readonly supportsDeveloperPrompt: true;
|
|
223
|
+
readonly supportsTemperature: true;
|
|
224
|
+
readonly isReasoningModel: true;
|
|
225
|
+
};
|
|
226
|
+
readonly 'kimi-k2-thinking-turbo': {
|
|
227
|
+
readonly provider: "kimi";
|
|
228
|
+
readonly supportsTools: true;
|
|
229
|
+
readonly supportsJson: true;
|
|
230
|
+
readonly supportsStructuredOutput: false;
|
|
231
|
+
readonly supportsDeveloperPrompt: true;
|
|
232
|
+
readonly supportsTemperature: true;
|
|
233
|
+
readonly isReasoningModel: true;
|
|
234
|
+
};
|
|
235
|
+
readonly 'qwen3.5-plus': {
|
|
236
|
+
readonly provider: "qwen";
|
|
237
|
+
readonly supportsTools: true;
|
|
238
|
+
readonly supportsJson: true;
|
|
239
|
+
readonly supportsStructuredOutput: false;
|
|
240
|
+
readonly supportsDeveloperPrompt: true;
|
|
241
|
+
readonly supportsTemperature: true;
|
|
242
|
+
readonly isReasoningModel: false;
|
|
243
|
+
};
|
|
244
|
+
readonly 'qwen3.5-flash': {
|
|
245
|
+
readonly provider: "qwen";
|
|
246
|
+
readonly supportsTools: true;
|
|
247
|
+
readonly supportsJson: true;
|
|
248
|
+
readonly supportsStructuredOutput: false;
|
|
249
|
+
readonly supportsDeveloperPrompt: true;
|
|
250
|
+
readonly supportsTemperature: true;
|
|
251
|
+
readonly isReasoningModel: false;
|
|
252
|
+
};
|
|
253
|
+
readonly 'qwen3-max': {
|
|
254
|
+
readonly provider: "qwen";
|
|
255
|
+
readonly supportsTools: true;
|
|
256
|
+
readonly supportsJson: true;
|
|
257
|
+
readonly supportsStructuredOutput: false;
|
|
258
|
+
readonly supportsDeveloperPrompt: true;
|
|
259
|
+
readonly supportsTemperature: true;
|
|
260
|
+
readonly isReasoningModel: false;
|
|
261
|
+
};
|
|
262
|
+
readonly 'grok-4': {
|
|
263
|
+
readonly provider: "xai";
|
|
264
|
+
readonly supportsTools: true;
|
|
265
|
+
readonly supportsJson: true;
|
|
266
|
+
readonly supportsStructuredOutput: true;
|
|
267
|
+
readonly supportsDeveloperPrompt: true;
|
|
268
|
+
readonly supportsTemperature: true;
|
|
269
|
+
readonly isReasoningModel: false;
|
|
270
|
+
};
|
|
271
|
+
readonly 'grok-4-fast-reasoning': {
|
|
272
|
+
readonly provider: "xai";
|
|
273
|
+
readonly supportsTools: true;
|
|
274
|
+
readonly supportsJson: true;
|
|
275
|
+
readonly supportsStructuredOutput: true;
|
|
276
|
+
readonly supportsDeveloperPrompt: true;
|
|
277
|
+
readonly supportsTemperature: true;
|
|
278
|
+
readonly isReasoningModel: true;
|
|
279
|
+
};
|
|
280
|
+
readonly 'grok-4-fast-non-reasoning': {
|
|
281
|
+
readonly provider: "xai";
|
|
282
|
+
readonly supportsTools: true;
|
|
283
|
+
readonly supportsJson: true;
|
|
284
|
+
readonly supportsStructuredOutput: true;
|
|
285
|
+
readonly supportsDeveloperPrompt: true;
|
|
286
|
+
readonly supportsTemperature: true;
|
|
287
|
+
readonly isReasoningModel: false;
|
|
288
|
+
};
|
|
289
|
+
readonly 'grok-3': {
|
|
290
|
+
readonly provider: "xai";
|
|
291
|
+
readonly supportsTools: true;
|
|
292
|
+
readonly supportsJson: true;
|
|
293
|
+
readonly supportsStructuredOutput: false;
|
|
294
|
+
readonly supportsDeveloperPrompt: true;
|
|
295
|
+
readonly supportsTemperature: true;
|
|
296
|
+
readonly isReasoningModel: false;
|
|
297
|
+
};
|
|
298
|
+
readonly 'grok-3-mini': {
|
|
299
|
+
readonly provider: "xai";
|
|
300
|
+
readonly supportsTools: true;
|
|
301
|
+
readonly supportsJson: true;
|
|
302
|
+
readonly supportsStructuredOutput: false;
|
|
303
|
+
readonly supportsDeveloperPrompt: true;
|
|
304
|
+
readonly supportsTemperature: true;
|
|
305
|
+
readonly isReasoningModel: false;
|
|
306
|
+
};
|
|
307
|
+
readonly 'gemini-3.1-pro-preview': {
|
|
308
|
+
readonly provider: "gemini";
|
|
309
|
+
readonly supportsTools: true;
|
|
310
|
+
readonly supportsJson: true;
|
|
311
|
+
readonly supportsStructuredOutput: true;
|
|
312
|
+
readonly supportsDeveloperPrompt: true;
|
|
313
|
+
readonly supportsTemperature: true;
|
|
314
|
+
readonly isReasoningModel: false;
|
|
315
|
+
};
|
|
316
|
+
readonly 'gemini-3-flash-preview': {
|
|
317
|
+
readonly provider: "gemini";
|
|
318
|
+
readonly supportsTools: true;
|
|
319
|
+
readonly supportsJson: true;
|
|
320
|
+
readonly supportsStructuredOutput: true;
|
|
321
|
+
readonly supportsDeveloperPrompt: true;
|
|
322
|
+
readonly supportsTemperature: true;
|
|
323
|
+
readonly isReasoningModel: false;
|
|
324
|
+
};
|
|
325
|
+
readonly 'gemini-3.1-flash-lite-preview': {
|
|
326
|
+
readonly provider: "gemini";
|
|
327
|
+
readonly supportsTools: true;
|
|
328
|
+
readonly supportsJson: true;
|
|
329
|
+
readonly supportsStructuredOutput: false;
|
|
330
|
+
readonly supportsDeveloperPrompt: true;
|
|
331
|
+
readonly supportsTemperature: true;
|
|
332
|
+
readonly isReasoningModel: false;
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
/**
|
|
336
|
+
* Represents all supported LLM models
|
|
337
|
+
*/
|
|
338
|
+
export type SupportedModel = keyof typeof SUPPORTED_MODELS;
|
|
3
339
|
/**
|
|
4
340
|
* Represents OpenAI models
|
|
5
341
|
*/
|
|
6
|
-
export type OpenAIModel = 'gpt-5' | 'gpt-5-mini' | 'gpt-5-nano' | 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano'
|
|
342
|
+
export type OpenAIModel = Extract<SupportedModel, 'gpt-5.4' | 'gpt-5.4-mini' | 'gpt-5.4-nano' | 'gpt-5' | 'gpt-5-mini' | 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano' | 'o1' | 'o1-mini' | 'o3' | 'o3-mini' | 'o4-mini'>;
|
|
343
|
+
/**
|
|
344
|
+
* Represents Anthropic Claude models
|
|
345
|
+
*/
|
|
346
|
+
export type AnthropicModel = Extract<SupportedModel, 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'claude-haiku-4-5'>;
|
|
7
347
|
/**
|
|
8
348
|
* Represents Deepseek models
|
|
9
349
|
*/
|
|
10
|
-
export type DeepseekModel = 'deepseek-chat' | 'deepseek-reasoner'
|
|
350
|
+
export type DeepseekModel = Extract<SupportedModel, 'deepseek-chat' | 'deepseek-reasoner'>;
|
|
351
|
+
/**
|
|
352
|
+
* Represents Kimi (Moonshot) models
|
|
353
|
+
*/
|
|
354
|
+
export type KimiModel = Extract<SupportedModel, 'kimi-k2-0905-preview' | 'kimi-k2-turbo-preview' | 'kimi-k2-thinking' | 'kimi-k2-thinking-turbo'>;
|
|
355
|
+
/**
|
|
356
|
+
* Represents Qwen (Alibaba DashScope) models
|
|
357
|
+
*/
|
|
358
|
+
export type QwenModel = Extract<SupportedModel, 'qwen3.5-plus' | 'qwen3.5-flash' | 'qwen3-max'>;
|
|
359
|
+
/**
|
|
360
|
+
* Represents xAI Grok models
|
|
361
|
+
*/
|
|
362
|
+
export type XAIModel = Extract<SupportedModel, 'grok-4' | 'grok-4-fast-reasoning' | 'grok-4-fast-non-reasoning' | 'grok-3' | 'grok-3-mini'>;
|
|
363
|
+
/**
|
|
364
|
+
* Represents Google Gemini models
|
|
365
|
+
*/
|
|
366
|
+
export type GeminiModel = Extract<SupportedModel, 'gemini-3.1-pro-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-flash-lite-preview'>;
|
|
11
367
|
/**
|
|
12
368
|
* Represents all supported LLM models
|
|
13
369
|
*/
|
|
14
|
-
export type LLMModel = OpenAIModel | DeepseekModel;
|
|
370
|
+
export type LLMModel = OpenAIModel | AnthropicModel | DeepseekModel | KimiModel | QwenModel | XAIModel | GeminiModel;
|
|
371
|
+
/**
|
|
372
|
+
* Common model aliases that map to canonical model names
|
|
373
|
+
*/
|
|
374
|
+
export declare const MODEL_ALIASES: Record<string, SupportedModel>;
|
|
375
|
+
/**
|
|
376
|
+
* Type guard to check if a string is a valid supported model
|
|
377
|
+
* @param model The model name to validate
|
|
378
|
+
* @returns True if the model is supported
|
|
379
|
+
*/
|
|
380
|
+
export declare function isValidModel(model: string): model is SupportedModel;
|
|
381
|
+
/**
|
|
382
|
+
* Get capabilities for a supported model
|
|
383
|
+
* @param model The model to get capabilities for
|
|
384
|
+
* @returns Model capabilities object
|
|
385
|
+
*/
|
|
386
|
+
export declare function getModelCapabilities(model: SupportedModel): Readonly<ModelCapabilities>;
|
|
387
|
+
/**
|
|
388
|
+
* Resolve the provider for a given model name
|
|
389
|
+
* @param model The model name (must be a valid SupportedModel)
|
|
390
|
+
* @returns The provider identifier
|
|
391
|
+
*/
|
|
392
|
+
export declare function getModelProvider(model: SupportedModel): LLMProvider;
|
|
15
393
|
/**
|
|
16
394
|
* Represents the usage of the LLM.
|
|
17
395
|
*/
|
|
@@ -28,7 +406,7 @@ export interface LLMUsage {
|
|
|
28
406
|
* Represents the options for the LLM.
|
|
29
407
|
*/
|
|
30
408
|
export interface LLMOptions {
|
|
31
|
-
model?:
|
|
409
|
+
model?: LLMModel;
|
|
32
410
|
temperature?: number;
|
|
33
411
|
top_p?: number;
|
|
34
412
|
frequency_penalty?: number;
|
|
@@ -43,6 +421,10 @@ export interface LLMOptions {
|
|
|
43
421
|
parallel_tool_calls?: boolean;
|
|
44
422
|
service_tier?: 'auto' | 'default';
|
|
45
423
|
apiKey?: string;
|
|
424
|
+
/**
|
|
425
|
+
* Request timeout in milliseconds. Overrides the default LLM_TIMEOUT_MS (120000ms).
|
|
426
|
+
*/
|
|
427
|
+
timeout?: number;
|
|
46
428
|
}
|
|
47
429
|
/**
|
|
48
430
|
* Represents the response from the LLM.
|
|
@@ -53,16 +435,24 @@ export interface LLMResponse<T> {
|
|
|
53
435
|
tool_calls?: ChatCompletionMessageToolCall[];
|
|
54
436
|
}
|
|
55
437
|
/**
|
|
56
|
-
* Represents the format of the
|
|
438
|
+
* Represents the format of the LLM response.
|
|
57
439
|
*/
|
|
58
440
|
export type OpenAIResponseFormat = 'text' | 'json' | {
|
|
59
441
|
type: 'json_schema';
|
|
60
442
|
schema: {
|
|
61
443
|
type: 'object';
|
|
62
|
-
properties: Record<string,
|
|
444
|
+
properties: Record<string, unknown>;
|
|
63
445
|
required?: string[];
|
|
64
446
|
};
|
|
65
447
|
};
|
|
448
|
+
/**
|
|
449
|
+
* Default model tiers per provider for use with LLM_MODEL_MINI/NORMAL/ADVANCED env vars
|
|
450
|
+
*/
|
|
451
|
+
export declare const PROVIDER_DEFAULT_MODELS: Record<LLMProvider, {
|
|
452
|
+
mini: SupportedModel;
|
|
453
|
+
normal: SupportedModel;
|
|
454
|
+
advanced: SupportedModel;
|
|
455
|
+
}>;
|
|
66
456
|
/**
|
|
67
457
|
* Represents the options for the OpenAI Images API.
|
|
68
458
|
* Extends the official ImageGenerateParams but with more user-friendly option names.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -18,4 +18,9 @@ interface AWSAuth {
|
|
|
18
18
|
declare const validateEnvironmentVars: () => ValidationResult;
|
|
19
19
|
declare const initialiseS3Client: (auth?: AWSAuth | null) => S3Client;
|
|
20
20
|
declare const initialiseLambdaClient: (auth?: AWSAuth | null) => Lambda;
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Clears all cached AWS client instances.
|
|
23
|
+
* Useful for testing or when credentials need to be refreshed.
|
|
24
|
+
*/
|
|
25
|
+
declare const clearClientCache: () => void;
|
|
26
|
+
export { validateEnvironmentVars, initialiseS3Client, initialiseLambdaClient, clearClientCache, AWSAuth };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Possible states for a circuit breaker
|
|
3
|
+
*/
|
|
4
|
+
export declare enum CircuitBreakerState {
|
|
5
|
+
CLOSED = "CLOSED",
|
|
6
|
+
OPEN = "OPEN",
|
|
7
|
+
HALF_OPEN = "HALF_OPEN"
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Configuration for the circuit breaker
|
|
11
|
+
*/
|
|
12
|
+
export interface CircuitBreakerConfig {
|
|
13
|
+
/** Number of failures before the circuit opens (default: 5) */
|
|
14
|
+
failureThreshold: number;
|
|
15
|
+
/** Time in milliseconds before attempting recovery from OPEN state (default: 30000) */
|
|
16
|
+
resetTimeoutMs: number;
|
|
17
|
+
/** Number of consecutive successes in HALF_OPEN required to close the circuit (default: 3) */
|
|
18
|
+
successThreshold: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Callback invoked when the circuit breaker changes state
|
|
22
|
+
*/
|
|
23
|
+
export type CircuitBreakerStateChangeCallback = (from: CircuitBreakerState, to: CircuitBreakerState, serviceName: string) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Default circuit breaker configuration
|
|
26
|
+
*/
|
|
27
|
+
export declare const DEFAULT_CIRCUIT_BREAKER_CONFIG: CircuitBreakerConfig;
|
|
28
|
+
/**
|
|
29
|
+
* Error thrown when a circuit breaker is open and rejecting calls
|
|
30
|
+
*/
|
|
31
|
+
export declare class CircuitBreakerOpenError extends Error {
|
|
32
|
+
readonly serviceName: string;
|
|
33
|
+
readonly resetTimeoutMs: number;
|
|
34
|
+
constructor(serviceName: string, resetTimeoutMs: number);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Generic circuit breaker implementation for external service calls.
|
|
38
|
+
*
|
|
39
|
+
* The circuit breaker monitors failures and transitions through three states:
|
|
40
|
+
* - CLOSED: Normal operation. Calls pass through. Failures are counted.
|
|
41
|
+
* - OPEN: Too many failures. Calls are rejected immediately without executing.
|
|
42
|
+
* - HALF_OPEN: After a reset timeout, allows a limited number of trial calls
|
|
43
|
+
* to test whether the service has recovered.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* const breaker = new CircuitBreaker('slack-api');
|
|
47
|
+
* const result = await breaker.execute(() => sendSlackMessage(channel, msg));
|
|
48
|
+
*/
|
|
49
|
+
export declare class CircuitBreaker {
|
|
50
|
+
readonly serviceName: string;
|
|
51
|
+
private state;
|
|
52
|
+
private failureCount;
|
|
53
|
+
private successCount;
|
|
54
|
+
private lastFailureTime;
|
|
55
|
+
private readonly config;
|
|
56
|
+
private onStateChange;
|
|
57
|
+
constructor(serviceName: string, config?: Partial<CircuitBreakerConfig>, onStateChange?: CircuitBreakerStateChangeCallback);
|
|
58
|
+
/**
|
|
59
|
+
* Returns the current state of the circuit breaker.
|
|
60
|
+
*/
|
|
61
|
+
getState(): CircuitBreakerState;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the current failure count.
|
|
64
|
+
*/
|
|
65
|
+
getFailureCount(): number;
|
|
66
|
+
/**
|
|
67
|
+
* Returns the current success count (relevant in HALF_OPEN state).
|
|
68
|
+
*/
|
|
69
|
+
getSuccessCount(): number;
|
|
70
|
+
/**
|
|
71
|
+
* Resets the circuit breaker to its initial CLOSED state.
|
|
72
|
+
*/
|
|
73
|
+
reset(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Executes the provided function through the circuit breaker.
|
|
76
|
+
*
|
|
77
|
+
* - In CLOSED state: executes normally, tracking failures.
|
|
78
|
+
* - In OPEN state: rejects immediately with CircuitBreakerOpenError
|
|
79
|
+
* unless the reset timeout has elapsed, in which case it transitions to HALF_OPEN.
|
|
80
|
+
* - In HALF_OPEN state: allows trial calls, tracking successes to decide
|
|
81
|
+
* whether to close or re-open the circuit.
|
|
82
|
+
*
|
|
83
|
+
* @template T - The return type of the wrapped function
|
|
84
|
+
* @param fn - The async function to execute
|
|
85
|
+
* @returns The result of the function call
|
|
86
|
+
* @throws CircuitBreakerOpenError if the circuit is open
|
|
87
|
+
* @throws The original error if the function call fails
|
|
88
|
+
*/
|
|
89
|
+
execute<T>(fn: () => Promise<T>): Promise<T>;
|
|
90
|
+
/**
|
|
91
|
+
* Sets or replaces the state change callback.
|
|
92
|
+
*/
|
|
93
|
+
setOnStateChange(callback: CircuitBreakerStateChangeCallback): void;
|
|
94
|
+
private shouldAttemptReset;
|
|
95
|
+
private onSuccess;
|
|
96
|
+
private onFailure;
|
|
97
|
+
private transitionTo;
|
|
98
|
+
private notifyStateChange;
|
|
99
|
+
}
|
|
@@ -1,9 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { LLMModel, LLMProvider } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The default LLM provider, resolved from LLM_DEFAULT_PROVIDER env var.
|
|
4
|
+
* Falls back to 'openai'.
|
|
5
|
+
*/
|
|
6
|
+
export declare const LLM_DEFAULT_PROVIDER: LLMProvider;
|
|
7
|
+
/**
|
|
8
|
+
* Per-tier provider overrides. Each falls back to LLM_DEFAULT_PROVIDER.
|
|
9
|
+
*/
|
|
10
|
+
export declare const LLM_MINI_PROVIDER: LLMProvider;
|
|
11
|
+
export declare const LLM_NORMAL_PROVIDER: LLMProvider;
|
|
12
|
+
export declare const LLM_ADVANCED_PROVIDER: LLMProvider;
|
|
13
|
+
export declare const LLM_PROVIDER: LLMProvider;
|
|
14
|
+
/**
|
|
15
|
+
* The default model to use when no model is specified.
|
|
16
|
+
* Resolution order: AI_MODEL env var → default provider's normal tier
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEFAULT_MODEL: LLMModel;
|
|
19
|
+
/**
|
|
20
|
+
* Model tier values resolved from env vars.
|
|
21
|
+
*
|
|
22
|
+
* Resolution order per tier:
|
|
23
|
+
* 1. LLM_MODEL_MINI / LLM_MODEL_NORMAL / LLM_MODEL_ADVANCED (explicit model override)
|
|
24
|
+
* 2. PROVIDER_DEFAULT_MODELS[tier-specific provider][tier] (provider default for tier)
|
|
25
|
+
*
|
|
26
|
+
* The tier-specific provider is:
|
|
27
|
+
* LLM_MINI_PROVIDER → falls back to LLM_DEFAULT_PROVIDER
|
|
28
|
+
* LLM_NORMAL_PROVIDER → falls back to LLM_DEFAULT_PROVIDER
|
|
29
|
+
* LLM_ADVANCED_PROVIDER → falls back to LLM_DEFAULT_PROVIDER
|
|
30
|
+
*/
|
|
31
|
+
export declare const LLM_MODEL_MINI: LLMModel;
|
|
32
|
+
export declare const LLM_MODEL_NORMAL: LLMModel;
|
|
33
|
+
export declare const LLM_MODEL_ADVANCED: LLMModel;
|
|
3
34
|
export declare const PERPLEXITY_MODEL: string;
|
|
4
35
|
export declare const PERPLEXITY_API_URL = "https://api.perplexity.ai/chat/completions";
|
|
5
36
|
export interface Config {
|
|
6
37
|
DEFAULT_MODEL: string;
|
|
38
|
+
LLM_DEFAULT_PROVIDER: LLMProvider;
|
|
39
|
+
LLM_MINI_PROVIDER: LLMProvider;
|
|
40
|
+
LLM_NORMAL_PROVIDER: LLMProvider;
|
|
41
|
+
LLM_ADVANCED_PROVIDER: LLMProvider;
|
|
42
|
+
LLM_MODEL_MINI: string;
|
|
43
|
+
LLM_MODEL_NORMAL: string;
|
|
44
|
+
LLM_MODEL_ADVANCED: string;
|
|
7
45
|
PERPLEXITY_MODEL: string;
|
|
8
46
|
PERPLEXITY_API_URL: string;
|
|
9
47
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Correlation context stored in AsyncLocalStorage.
|
|
3
|
+
* Propagates automatically through async call chains.
|
|
4
|
+
*/
|
|
5
|
+
export interface CorrelationContext {
|
|
6
|
+
/** Unique correlation ID for request tracing */
|
|
7
|
+
correlationId: string;
|
|
8
|
+
/** Additional metadata to propagate */
|
|
9
|
+
metadata?: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Generates a new unique correlation ID.
|
|
13
|
+
* Uses crypto.randomUUID for high-quality UUIDs.
|
|
14
|
+
* @returns A new UUID string
|
|
15
|
+
*/
|
|
16
|
+
export declare function generateCorrelationId(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the current correlation ID from AsyncLocalStorage, or undefined if none is set.
|
|
19
|
+
* @returns The current correlation ID or undefined
|
|
20
|
+
*/
|
|
21
|
+
export declare function getCorrelationId(): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the full correlation context, or undefined if none is set.
|
|
24
|
+
* @returns The current CorrelationContext or undefined
|
|
25
|
+
*/
|
|
26
|
+
export declare function getCorrelationContext(): CorrelationContext | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Runs a function within a correlation context.
|
|
29
|
+
* All async operations within the callback will have access to the correlation ID.
|
|
30
|
+
*
|
|
31
|
+
* @param fn - The function to run within the context
|
|
32
|
+
* @param correlationId - Optional correlation ID. If not provided, one is generated.
|
|
33
|
+
* @param metadata - Optional metadata to attach to the context
|
|
34
|
+
* @returns The return value of the function
|
|
35
|
+
*/
|
|
36
|
+
export declare function withCorrelationId<T>(fn: () => T, correlationId?: string, metadata?: Record<string, string>): T;
|
|
37
|
+
/**
|
|
38
|
+
* Returns headers object with the correlation ID for external HTTP calls.
|
|
39
|
+
* Returns an empty object if no correlation context is active.
|
|
40
|
+
* @param headerName - The header name to use (default: 'x-correlation-id')
|
|
41
|
+
* @returns Headers object with correlation ID
|
|
42
|
+
*/
|
|
43
|
+
export declare function getCorrelationHeaders(headerName?: string): Record<string, string>;
|