@adaptic/lumic-utils 1.0.5 → 1.0.8
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-DE7JUXjy.js +3693 -0
- package/dist/apollo-client.client-DE7JUXjy.js.map +1 -0
- package/dist/apollo-client.client-DlG4HsFm.js +3704 -0
- package/dist/apollo-client.client-DlG4HsFm.js.map +1 -0
- package/dist/apollo-client.server-D1QJea5_.js +16319 -0
- package/dist/apollo-client.server-D1QJea5_.js.map +1 -0
- package/dist/apollo-client.server-uqalq3yp.js +16321 -0
- package/dist/apollo-client.server-uqalq3yp.js.map +1 -0
- package/dist/index-Bd84zcTQ.js +74944 -0
- package/dist/index-Bd84zcTQ.js.map +1 -0
- package/dist/index-CZKOqrJ4.js +75137 -0
- package/dist/index-CZKOqrJ4.js.map +1 -0
- package/dist/index-CsKfs4nG.js +12108 -0
- package/dist/index-CsKfs4nG.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-CcgbRft2.js → index-DZZCd-1T.js} +182 -22
- package/dist/index-DZZCd-1T.js.map +1 -0
- package/dist/index-aP9ow8_W.js +12271 -0
- package/dist/index-aP9ow8_W.js.map +1 -0
- package/dist/index.cjs +122 -11417
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +39 -11399
- package/dist/index.mjs.map +1 -1
- package/dist/test.cjs +24 -7
- package/dist/test.cjs.map +1 -1
- package/dist/test.mjs +24 -7
- package/dist/test.mjs.map +1 -1
- package/dist/types/aws-types.ts +1 -1
- package/dist/types/config/__tests__/secrets.test.d.ts +1 -0
- package/dist/types/config/secrets.d.ts +186 -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-call.d.ts +2 -2
- package/dist/types/functions/llm-deepseek.d.ts +1 -1
- 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/google-types.ts +6 -3
- package/dist/types/index.d.ts +30 -0
- package/dist/types/index.ts +1 -1
- package/dist/types/openai-types.ts +165 -6
- 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 +149 -3
- 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/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 +17 -4
- package/dist/index-CcXQeJz8.js.map +0 -1
- package/dist/index-CcgbRft2.js.map +0 -1
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema for a complete Perplexity API response.
|
|
4
|
+
* Validates the core fields that lumic-utils depends on.
|
|
5
|
+
* Uses .passthrough() to allow additional fields from newer API versions.
|
|
6
|
+
*/
|
|
7
|
+
export declare const perplexityResponseSchema: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
model: z.ZodString;
|
|
10
|
+
object: z.ZodString;
|
|
11
|
+
created: z.ZodNumber;
|
|
12
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
13
|
+
index: z.ZodNumber;
|
|
14
|
+
finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "model_length"]>>;
|
|
15
|
+
message: z.ZodObject<{
|
|
16
|
+
role: z.ZodEnum<["assistant"]>;
|
|
17
|
+
content: z.ZodString;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
role: "assistant";
|
|
20
|
+
content: string;
|
|
21
|
+
}, {
|
|
22
|
+
role: "assistant";
|
|
23
|
+
content: string;
|
|
24
|
+
}>;
|
|
25
|
+
delta: z.ZodOptional<z.ZodObject<{
|
|
26
|
+
role: z.ZodOptional<z.ZodString>;
|
|
27
|
+
content: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
role?: string | undefined;
|
|
30
|
+
content?: string | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
role?: string | undefined;
|
|
33
|
+
content?: string | undefined;
|
|
34
|
+
}>>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
message: {
|
|
37
|
+
role: "assistant";
|
|
38
|
+
content: string;
|
|
39
|
+
};
|
|
40
|
+
index: number;
|
|
41
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
42
|
+
delta?: {
|
|
43
|
+
role?: string | undefined;
|
|
44
|
+
content?: string | undefined;
|
|
45
|
+
} | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
message: {
|
|
48
|
+
role: "assistant";
|
|
49
|
+
content: string;
|
|
50
|
+
};
|
|
51
|
+
index: number;
|
|
52
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
53
|
+
delta?: {
|
|
54
|
+
role?: string | undefined;
|
|
55
|
+
content?: string | undefined;
|
|
56
|
+
} | undefined;
|
|
57
|
+
}>, "many">;
|
|
58
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
59
|
+
prompt_tokens: z.ZodNumber;
|
|
60
|
+
completion_tokens: z.ZodNumber;
|
|
61
|
+
total_tokens: z.ZodNumber;
|
|
62
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
63
|
+
prompt_tokens: z.ZodNumber;
|
|
64
|
+
completion_tokens: z.ZodNumber;
|
|
65
|
+
total_tokens: z.ZodNumber;
|
|
66
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
67
|
+
prompt_tokens: z.ZodNumber;
|
|
68
|
+
completion_tokens: z.ZodNumber;
|
|
69
|
+
total_tokens: z.ZodNumber;
|
|
70
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
71
|
+
citations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
72
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
73
|
+
id: z.ZodString;
|
|
74
|
+
model: z.ZodString;
|
|
75
|
+
object: z.ZodString;
|
|
76
|
+
created: z.ZodNumber;
|
|
77
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
78
|
+
index: z.ZodNumber;
|
|
79
|
+
finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "model_length"]>>;
|
|
80
|
+
message: z.ZodObject<{
|
|
81
|
+
role: z.ZodEnum<["assistant"]>;
|
|
82
|
+
content: z.ZodString;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
role: "assistant";
|
|
85
|
+
content: string;
|
|
86
|
+
}, {
|
|
87
|
+
role: "assistant";
|
|
88
|
+
content: string;
|
|
89
|
+
}>;
|
|
90
|
+
delta: z.ZodOptional<z.ZodObject<{
|
|
91
|
+
role: z.ZodOptional<z.ZodString>;
|
|
92
|
+
content: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
role?: string | undefined;
|
|
95
|
+
content?: string | undefined;
|
|
96
|
+
}, {
|
|
97
|
+
role?: string | undefined;
|
|
98
|
+
content?: string | undefined;
|
|
99
|
+
}>>;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
message: {
|
|
102
|
+
role: "assistant";
|
|
103
|
+
content: string;
|
|
104
|
+
};
|
|
105
|
+
index: number;
|
|
106
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
107
|
+
delta?: {
|
|
108
|
+
role?: string | undefined;
|
|
109
|
+
content?: string | undefined;
|
|
110
|
+
} | undefined;
|
|
111
|
+
}, {
|
|
112
|
+
message: {
|
|
113
|
+
role: "assistant";
|
|
114
|
+
content: string;
|
|
115
|
+
};
|
|
116
|
+
index: number;
|
|
117
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
118
|
+
delta?: {
|
|
119
|
+
role?: string | undefined;
|
|
120
|
+
content?: string | undefined;
|
|
121
|
+
} | undefined;
|
|
122
|
+
}>, "many">;
|
|
123
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
124
|
+
prompt_tokens: z.ZodNumber;
|
|
125
|
+
completion_tokens: z.ZodNumber;
|
|
126
|
+
total_tokens: z.ZodNumber;
|
|
127
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
128
|
+
prompt_tokens: z.ZodNumber;
|
|
129
|
+
completion_tokens: z.ZodNumber;
|
|
130
|
+
total_tokens: z.ZodNumber;
|
|
131
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
132
|
+
prompt_tokens: z.ZodNumber;
|
|
133
|
+
completion_tokens: z.ZodNumber;
|
|
134
|
+
total_tokens: z.ZodNumber;
|
|
135
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
136
|
+
citations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
137
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
138
|
+
id: z.ZodString;
|
|
139
|
+
model: z.ZodString;
|
|
140
|
+
object: z.ZodString;
|
|
141
|
+
created: z.ZodNumber;
|
|
142
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
143
|
+
index: z.ZodNumber;
|
|
144
|
+
finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "model_length"]>>;
|
|
145
|
+
message: z.ZodObject<{
|
|
146
|
+
role: z.ZodEnum<["assistant"]>;
|
|
147
|
+
content: z.ZodString;
|
|
148
|
+
}, "strip", z.ZodTypeAny, {
|
|
149
|
+
role: "assistant";
|
|
150
|
+
content: string;
|
|
151
|
+
}, {
|
|
152
|
+
role: "assistant";
|
|
153
|
+
content: string;
|
|
154
|
+
}>;
|
|
155
|
+
delta: z.ZodOptional<z.ZodObject<{
|
|
156
|
+
role: z.ZodOptional<z.ZodString>;
|
|
157
|
+
content: z.ZodOptional<z.ZodString>;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
role?: string | undefined;
|
|
160
|
+
content?: string | undefined;
|
|
161
|
+
}, {
|
|
162
|
+
role?: string | undefined;
|
|
163
|
+
content?: string | undefined;
|
|
164
|
+
}>>;
|
|
165
|
+
}, "strip", z.ZodTypeAny, {
|
|
166
|
+
message: {
|
|
167
|
+
role: "assistant";
|
|
168
|
+
content: string;
|
|
169
|
+
};
|
|
170
|
+
index: number;
|
|
171
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
172
|
+
delta?: {
|
|
173
|
+
role?: string | undefined;
|
|
174
|
+
content?: string | undefined;
|
|
175
|
+
} | undefined;
|
|
176
|
+
}, {
|
|
177
|
+
message: {
|
|
178
|
+
role: "assistant";
|
|
179
|
+
content: string;
|
|
180
|
+
};
|
|
181
|
+
index: number;
|
|
182
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
183
|
+
delta?: {
|
|
184
|
+
role?: string | undefined;
|
|
185
|
+
content?: string | undefined;
|
|
186
|
+
} | undefined;
|
|
187
|
+
}>, "many">;
|
|
188
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
189
|
+
prompt_tokens: z.ZodNumber;
|
|
190
|
+
completion_tokens: z.ZodNumber;
|
|
191
|
+
total_tokens: z.ZodNumber;
|
|
192
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
193
|
+
prompt_tokens: z.ZodNumber;
|
|
194
|
+
completion_tokens: z.ZodNumber;
|
|
195
|
+
total_tokens: z.ZodNumber;
|
|
196
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
197
|
+
prompt_tokens: z.ZodNumber;
|
|
198
|
+
completion_tokens: z.ZodNumber;
|
|
199
|
+
total_tokens: z.ZodNumber;
|
|
200
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
201
|
+
citations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
202
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
203
|
+
/** Type inferred from the Perplexity response schema */
|
|
204
|
+
export type PerplexityResponse = z.infer<typeof perplexityResponseSchema>;
|
|
205
|
+
/** Strict validator for Perplexity API responses. Throws on failure. */
|
|
206
|
+
export declare const validatePerplexityResponse: (data: unknown) => z.objectInputType<{
|
|
207
|
+
id: z.ZodString;
|
|
208
|
+
model: z.ZodString;
|
|
209
|
+
object: z.ZodString;
|
|
210
|
+
created: z.ZodNumber;
|
|
211
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
212
|
+
index: z.ZodNumber;
|
|
213
|
+
finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "model_length"]>>;
|
|
214
|
+
message: z.ZodObject<{
|
|
215
|
+
role: z.ZodEnum<["assistant"]>;
|
|
216
|
+
content: z.ZodString;
|
|
217
|
+
}, "strip", z.ZodTypeAny, {
|
|
218
|
+
role: "assistant";
|
|
219
|
+
content: string;
|
|
220
|
+
}, {
|
|
221
|
+
role: "assistant";
|
|
222
|
+
content: string;
|
|
223
|
+
}>;
|
|
224
|
+
delta: z.ZodOptional<z.ZodObject<{
|
|
225
|
+
role: z.ZodOptional<z.ZodString>;
|
|
226
|
+
content: z.ZodOptional<z.ZodString>;
|
|
227
|
+
}, "strip", z.ZodTypeAny, {
|
|
228
|
+
role?: string | undefined;
|
|
229
|
+
content?: string | undefined;
|
|
230
|
+
}, {
|
|
231
|
+
role?: string | undefined;
|
|
232
|
+
content?: string | undefined;
|
|
233
|
+
}>>;
|
|
234
|
+
}, "strip", z.ZodTypeAny, {
|
|
235
|
+
message: {
|
|
236
|
+
role: "assistant";
|
|
237
|
+
content: string;
|
|
238
|
+
};
|
|
239
|
+
index: number;
|
|
240
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
241
|
+
delta?: {
|
|
242
|
+
role?: string | undefined;
|
|
243
|
+
content?: string | undefined;
|
|
244
|
+
} | undefined;
|
|
245
|
+
}, {
|
|
246
|
+
message: {
|
|
247
|
+
role: "assistant";
|
|
248
|
+
content: string;
|
|
249
|
+
};
|
|
250
|
+
index: number;
|
|
251
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
252
|
+
delta?: {
|
|
253
|
+
role?: string | undefined;
|
|
254
|
+
content?: string | undefined;
|
|
255
|
+
} | undefined;
|
|
256
|
+
}>, "many">;
|
|
257
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
258
|
+
prompt_tokens: z.ZodNumber;
|
|
259
|
+
completion_tokens: z.ZodNumber;
|
|
260
|
+
total_tokens: z.ZodNumber;
|
|
261
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
262
|
+
prompt_tokens: z.ZodNumber;
|
|
263
|
+
completion_tokens: z.ZodNumber;
|
|
264
|
+
total_tokens: z.ZodNumber;
|
|
265
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
266
|
+
prompt_tokens: z.ZodNumber;
|
|
267
|
+
completion_tokens: z.ZodNumber;
|
|
268
|
+
total_tokens: z.ZodNumber;
|
|
269
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
270
|
+
citations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
271
|
+
}, z.ZodTypeAny, "passthrough">;
|
|
272
|
+
/** Safe validator for Perplexity API responses. Never throws. */
|
|
273
|
+
export declare const safeValidatePerplexityResponse: (data: unknown) => import("./validation-helpers").ValidationResult<z.objectInputType<{
|
|
274
|
+
id: z.ZodString;
|
|
275
|
+
model: z.ZodString;
|
|
276
|
+
object: z.ZodString;
|
|
277
|
+
created: z.ZodNumber;
|
|
278
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
279
|
+
index: z.ZodNumber;
|
|
280
|
+
finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "model_length"]>>;
|
|
281
|
+
message: z.ZodObject<{
|
|
282
|
+
role: z.ZodEnum<["assistant"]>;
|
|
283
|
+
content: z.ZodString;
|
|
284
|
+
}, "strip", z.ZodTypeAny, {
|
|
285
|
+
role: "assistant";
|
|
286
|
+
content: string;
|
|
287
|
+
}, {
|
|
288
|
+
role: "assistant";
|
|
289
|
+
content: string;
|
|
290
|
+
}>;
|
|
291
|
+
delta: z.ZodOptional<z.ZodObject<{
|
|
292
|
+
role: z.ZodOptional<z.ZodString>;
|
|
293
|
+
content: z.ZodOptional<z.ZodString>;
|
|
294
|
+
}, "strip", z.ZodTypeAny, {
|
|
295
|
+
role?: string | undefined;
|
|
296
|
+
content?: string | undefined;
|
|
297
|
+
}, {
|
|
298
|
+
role?: string | undefined;
|
|
299
|
+
content?: string | undefined;
|
|
300
|
+
}>>;
|
|
301
|
+
}, "strip", z.ZodTypeAny, {
|
|
302
|
+
message: {
|
|
303
|
+
role: "assistant";
|
|
304
|
+
content: string;
|
|
305
|
+
};
|
|
306
|
+
index: number;
|
|
307
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
308
|
+
delta?: {
|
|
309
|
+
role?: string | undefined;
|
|
310
|
+
content?: string | undefined;
|
|
311
|
+
} | undefined;
|
|
312
|
+
}, {
|
|
313
|
+
message: {
|
|
314
|
+
role: "assistant";
|
|
315
|
+
content: string;
|
|
316
|
+
};
|
|
317
|
+
index: number;
|
|
318
|
+
finish_reason: "length" | "stop" | "model_length" | null;
|
|
319
|
+
delta?: {
|
|
320
|
+
role?: string | undefined;
|
|
321
|
+
content?: string | undefined;
|
|
322
|
+
} | undefined;
|
|
323
|
+
}>, "many">;
|
|
324
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
325
|
+
prompt_tokens: z.ZodNumber;
|
|
326
|
+
completion_tokens: z.ZodNumber;
|
|
327
|
+
total_tokens: z.ZodNumber;
|
|
328
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
329
|
+
prompt_tokens: z.ZodNumber;
|
|
330
|
+
completion_tokens: z.ZodNumber;
|
|
331
|
+
total_tokens: z.ZodNumber;
|
|
332
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
333
|
+
prompt_tokens: z.ZodNumber;
|
|
334
|
+
completion_tokens: z.ZodNumber;
|
|
335
|
+
total_tokens: z.ZodNumber;
|
|
336
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
337
|
+
citations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
338
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Result of a safe validation attempt.
|
|
4
|
+
* On success, contains the parsed data. On failure, contains the error details.
|
|
5
|
+
*/
|
|
6
|
+
export interface ValidationResult<T> {
|
|
7
|
+
success: boolean;
|
|
8
|
+
data?: T;
|
|
9
|
+
error?: string;
|
|
10
|
+
issues?: Array<{
|
|
11
|
+
path: string;
|
|
12
|
+
message: string;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates a strict validator function for a Zod schema.
|
|
17
|
+
* Throws on validation failure with a descriptive error message.
|
|
18
|
+
*
|
|
19
|
+
* @param schema - The Zod schema to validate against
|
|
20
|
+
* @param serviceName - Human-readable service name for error messages
|
|
21
|
+
* @returns A validator function that parses and returns typed data
|
|
22
|
+
*/
|
|
23
|
+
export declare function createValidator<T>(schema: z.ZodType<T>, serviceName: string): (data: unknown) => T;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a safe validator function for a Zod schema.
|
|
26
|
+
* Never throws; returns a ValidationResult with success/failure information.
|
|
27
|
+
* On failure, logs a warning but does not throw.
|
|
28
|
+
*
|
|
29
|
+
* @param schema - The Zod schema to validate against
|
|
30
|
+
* @param serviceName - Human-readable service name for log messages
|
|
31
|
+
* @returns A safe validator function that returns a ValidationResult
|
|
32
|
+
*/
|
|
33
|
+
export declare function createSafeValidator<T>(schema: z.ZodType<T>, serviceName: string): (data: unknown) => ValidationResult<T>;
|
|
@@ -10,15 +10,17 @@ export interface GoogleSheetRange {
|
|
|
10
10
|
startCell: GoogleSheetCell;
|
|
11
11
|
endCell: GoogleSheetCell;
|
|
12
12
|
}
|
|
13
|
+
/** Represents a primitive value that can be stored in a Google Sheet cell */
|
|
14
|
+
export type GoogleSheetCellValue = string | number | boolean | null;
|
|
13
15
|
export interface GoogleSheetResponse {
|
|
14
16
|
success: boolean;
|
|
15
17
|
error?: string;
|
|
16
|
-
data?:
|
|
18
|
+
data?: unknown;
|
|
17
19
|
}
|
|
18
20
|
export interface GoogleSheetAddRowResponse extends GoogleSheetResponse {
|
|
19
21
|
data?: {
|
|
20
22
|
rowNumber: number;
|
|
21
|
-
values:
|
|
23
|
+
values: GoogleSheetCellValue[];
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
26
|
export interface GoogleSheetAddSheetResponse extends GoogleSheetResponse {
|
|
@@ -29,7 +31,7 @@ export interface GoogleSheetAddSheetResponse extends GoogleSheetResponse {
|
|
|
29
31
|
}
|
|
30
32
|
export interface GoogleSheetCellResponse extends GoogleSheetResponse {
|
|
31
33
|
data?: {
|
|
32
|
-
value:
|
|
34
|
+
value: GoogleSheetCellValue;
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
37
|
export interface GoogleSheetWriteArrayResponse extends GoogleSheetResponse {
|
|
@@ -20,7 +20,7 @@ export interface PerplexityResponse {
|
|
|
20
20
|
export type InvocationType = 'RequestResponse' | 'Event' | 'DryRun';
|
|
21
21
|
export interface LambdaResponse {
|
|
22
22
|
statusCode: number;
|
|
23
|
-
[key: string]:
|
|
23
|
+
[key: string]: unknown;
|
|
24
24
|
}
|
|
25
25
|
export interface SlackApiResponse {
|
|
26
26
|
ok: boolean;
|
|
@@ -1,17 +1,158 @@
|
|
|
1
1
|
import { ChatCompletionMessageParam, ChatCompletionTool, ChatCompletionMessageToolCall } from 'openai/resources/chat/completions';
|
|
2
2
|
import { ImageGenerateParams } from 'openai/resources/images';
|
|
3
|
+
/**
|
|
4
|
+
* Model capability configuration
|
|
5
|
+
*/
|
|
6
|
+
interface ModelCapabilities {
|
|
7
|
+
provider: 'openai' | 'deepseek';
|
|
8
|
+
supportsTools: boolean;
|
|
9
|
+
supportsJson: boolean;
|
|
10
|
+
supportsStructuredOutput: boolean;
|
|
11
|
+
supportsDeveloperPrompt: boolean;
|
|
12
|
+
supportsTemperature: boolean;
|
|
13
|
+
isReasoningModel: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Supported models with their capabilities
|
|
17
|
+
*/
|
|
18
|
+
export declare const SUPPORTED_MODELS: {
|
|
19
|
+
readonly 'gpt-5': {
|
|
20
|
+
readonly provider: "openai";
|
|
21
|
+
readonly supportsTools: true;
|
|
22
|
+
readonly supportsJson: true;
|
|
23
|
+
readonly supportsStructuredOutput: true;
|
|
24
|
+
readonly supportsDeveloperPrompt: true;
|
|
25
|
+
readonly supportsTemperature: true;
|
|
26
|
+
readonly isReasoningModel: false;
|
|
27
|
+
};
|
|
28
|
+
readonly 'gpt-5-mini': {
|
|
29
|
+
readonly provider: "openai";
|
|
30
|
+
readonly supportsTools: true;
|
|
31
|
+
readonly supportsJson: true;
|
|
32
|
+
readonly supportsStructuredOutput: true;
|
|
33
|
+
readonly supportsDeveloperPrompt: true;
|
|
34
|
+
readonly supportsTemperature: true;
|
|
35
|
+
readonly isReasoningModel: false;
|
|
36
|
+
};
|
|
37
|
+
readonly 'gpt-4.1': {
|
|
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-4.1-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-4.1-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 o1: {
|
|
65
|
+
readonly provider: "openai";
|
|
66
|
+
readonly supportsTools: true;
|
|
67
|
+
readonly supportsJson: false;
|
|
68
|
+
readonly supportsStructuredOutput: true;
|
|
69
|
+
readonly supportsDeveloperPrompt: true;
|
|
70
|
+
readonly supportsTemperature: false;
|
|
71
|
+
readonly isReasoningModel: true;
|
|
72
|
+
};
|
|
73
|
+
readonly 'o1-mini': {
|
|
74
|
+
readonly provider: "openai";
|
|
75
|
+
readonly supportsTools: true;
|
|
76
|
+
readonly supportsJson: false;
|
|
77
|
+
readonly supportsStructuredOutput: false;
|
|
78
|
+
readonly supportsDeveloperPrompt: false;
|
|
79
|
+
readonly supportsTemperature: false;
|
|
80
|
+
readonly isReasoningModel: true;
|
|
81
|
+
};
|
|
82
|
+
readonly o3: {
|
|
83
|
+
readonly provider: "openai";
|
|
84
|
+
readonly supportsTools: true;
|
|
85
|
+
readonly supportsJson: false;
|
|
86
|
+
readonly supportsStructuredOutput: true;
|
|
87
|
+
readonly supportsDeveloperPrompt: true;
|
|
88
|
+
readonly supportsTemperature: false;
|
|
89
|
+
readonly isReasoningModel: true;
|
|
90
|
+
};
|
|
91
|
+
readonly 'o3-mini': {
|
|
92
|
+
readonly provider: "openai";
|
|
93
|
+
readonly supportsTools: true;
|
|
94
|
+
readonly supportsJson: true;
|
|
95
|
+
readonly supportsStructuredOutput: true;
|
|
96
|
+
readonly supportsDeveloperPrompt: true;
|
|
97
|
+
readonly supportsTemperature: false;
|
|
98
|
+
readonly isReasoningModel: true;
|
|
99
|
+
};
|
|
100
|
+
readonly 'o4-mini': {
|
|
101
|
+
readonly provider: "openai";
|
|
102
|
+
readonly supportsTools: true;
|
|
103
|
+
readonly supportsJson: false;
|
|
104
|
+
readonly supportsStructuredOutput: true;
|
|
105
|
+
readonly supportsDeveloperPrompt: true;
|
|
106
|
+
readonly supportsTemperature: false;
|
|
107
|
+
readonly isReasoningModel: true;
|
|
108
|
+
};
|
|
109
|
+
readonly 'deepseek-chat': {
|
|
110
|
+
readonly provider: "deepseek";
|
|
111
|
+
readonly supportsTools: true;
|
|
112
|
+
readonly supportsJson: true;
|
|
113
|
+
readonly supportsStructuredOutput: false;
|
|
114
|
+
readonly supportsDeveloperPrompt: true;
|
|
115
|
+
readonly supportsTemperature: true;
|
|
116
|
+
readonly isReasoningModel: false;
|
|
117
|
+
};
|
|
118
|
+
readonly 'deepseek-reasoner': {
|
|
119
|
+
readonly provider: "deepseek";
|
|
120
|
+
readonly supportsTools: false;
|
|
121
|
+
readonly supportsJson: false;
|
|
122
|
+
readonly supportsStructuredOutput: false;
|
|
123
|
+
readonly supportsDeveloperPrompt: true;
|
|
124
|
+
readonly supportsTemperature: true;
|
|
125
|
+
readonly isReasoningModel: true;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Represents all supported LLM models
|
|
130
|
+
*/
|
|
131
|
+
export type SupportedModel = keyof typeof SUPPORTED_MODELS;
|
|
3
132
|
/**
|
|
4
133
|
* Represents OpenAI models
|
|
5
134
|
*/
|
|
6
|
-
export type OpenAIModel = 'gpt-5' | 'gpt-5-mini' | 'gpt-
|
|
135
|
+
export type OpenAIModel = Extract<SupportedModel, 'gpt-5' | 'gpt-5-mini' | 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano' | 'o1' | 'o1-mini' | 'o3' | 'o3-mini' | 'o4-mini'>;
|
|
7
136
|
/**
|
|
8
137
|
* Represents Deepseek models
|
|
9
138
|
*/
|
|
10
|
-
export type DeepseekModel = 'deepseek-chat' | 'deepseek-reasoner'
|
|
139
|
+
export type DeepseekModel = Extract<SupportedModel, 'deepseek-chat' | 'deepseek-reasoner'>;
|
|
11
140
|
/**
|
|
12
141
|
* Represents all supported LLM models
|
|
13
142
|
*/
|
|
14
143
|
export type LLMModel = OpenAIModel | DeepseekModel;
|
|
144
|
+
/**
|
|
145
|
+
* Type guard to check if a string is a valid supported model
|
|
146
|
+
* @param model The model name to validate
|
|
147
|
+
* @returns True if the model is supported
|
|
148
|
+
*/
|
|
149
|
+
export declare function isValidModel(model: string): model is SupportedModel;
|
|
150
|
+
/**
|
|
151
|
+
* Get capabilities for a supported model
|
|
152
|
+
* @param model The model to get capabilities for
|
|
153
|
+
* @returns Model capabilities object
|
|
154
|
+
*/
|
|
155
|
+
export declare function getModelCapabilities(model: SupportedModel): Readonly<ModelCapabilities>;
|
|
15
156
|
/**
|
|
16
157
|
* Represents the usage of the LLM.
|
|
17
158
|
*/
|
|
@@ -43,6 +184,11 @@ export interface LLMOptions {
|
|
|
43
184
|
parallel_tool_calls?: boolean;
|
|
44
185
|
service_tier?: 'auto' | 'default';
|
|
45
186
|
apiKey?: string;
|
|
187
|
+
/**
|
|
188
|
+
* Request timeout in milliseconds. Overrides the default LLM_TIMEOUT_MS (120000ms).
|
|
189
|
+
* Applied to the OpenAI/Deepseek SDK client for the request.
|
|
190
|
+
*/
|
|
191
|
+
timeout?: number;
|
|
46
192
|
}
|
|
47
193
|
/**
|
|
48
194
|
* Represents the response from the LLM.
|
|
@@ -59,7 +205,7 @@ export type OpenAIResponseFormat = 'text' | 'json' | {
|
|
|
59
205
|
type: 'json_schema';
|
|
60
206
|
schema: {
|
|
61
207
|
type: 'object';
|
|
62
|
-
properties: Record<string,
|
|
208
|
+
properties: Record<string, unknown>;
|
|
63
209
|
required?: string[];
|
|
64
210
|
};
|
|
65
211
|
};
|
|
@@ -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 };
|