@botpress/vai 0.0.1-beta.1

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.
@@ -0,0 +1,473 @@
1
+ import * as _botpress_sdk from '@botpress/sdk';
2
+ import { z } from '@botpress/sdk';
3
+ import { TestFunction } from 'vitest';
4
+ import { Client } from '@botpress/client';
5
+
6
+ type ScenarioLike = z.infer<typeof ScenarioLike>;
7
+ declare const ScenarioLike: _botpress_sdk.ZodUnion<[_botpress_sdk.ZodString, _botpress_sdk.ZodObject<{
8
+ name: _botpress_sdk.ZodString;
9
+ }, "passthrough", _botpress_sdk.ZodTypeAny, _botpress_sdk.objectOutputType<{
10
+ name: _botpress_sdk.ZodString;
11
+ }, _botpress_sdk.ZodTypeAny, "passthrough">, _botpress_sdk.objectInputType<{
12
+ name: _botpress_sdk.ZodString;
13
+ }, _botpress_sdk.ZodTypeAny, "passthrough">>, _botpress_sdk.ZodObject<{
14
+ id: _botpress_sdk.ZodString;
15
+ }, "passthrough", _botpress_sdk.ZodTypeAny, _botpress_sdk.objectOutputType<{
16
+ id: _botpress_sdk.ZodString;
17
+ }, _botpress_sdk.ZodTypeAny, "passthrough">, _botpress_sdk.objectInputType<{
18
+ id: _botpress_sdk.ZodString;
19
+ }, _botpress_sdk.ZodTypeAny, "passthrough">>]>;
20
+ declare function compare<T extends ReadonlyArray<ScenarioLike>>(name: string | Function, scenarios: T, fn?: TestFunction<{
21
+ scenario: T[number];
22
+ }>): void;
23
+
24
+ type Input = z.infer<typeof Input>;
25
+ declare const Input: _botpress_sdk.ZodUnion<[_botpress_sdk.ZodUnion<[_botpress_sdk.ZodString, z.ZodTransformer<_botpress_sdk.ZodObject<{}, "passthrough", _botpress_sdk.ZodTypeAny, _botpress_sdk.objectOutputType<{}, _botpress_sdk.ZodTypeAny, "passthrough">, _botpress_sdk.objectInputType<{}, _botpress_sdk.ZodTypeAny, "passthrough">>, _botpress_sdk.objectOutputType<{}, _botpress_sdk.ZodTypeAny, "passthrough">, _botpress_sdk.objectInputType<{}, _botpress_sdk.ZodTypeAny, "passthrough">>]>, _botpress_sdk.ZodArray<_botpress_sdk.ZodAny, "many">]>;
26
+ type Output<T = any> = z.infer<typeof Output> & {
27
+ result: T;
28
+ };
29
+ declare const Output: _botpress_sdk.ZodObject<{
30
+ reason: _botpress_sdk.ZodString;
31
+ result: _botpress_sdk.ZodAny;
32
+ }, "strip", _botpress_sdk.ZodTypeAny, {
33
+ reason: string;
34
+ result?: any;
35
+ }, {
36
+ reason: string;
37
+ result?: any;
38
+ }>;
39
+
40
+ declare class AsyncExpectError<T> extends Error {
41
+ readonly output: Output<T>;
42
+ constructor(message: string, output: Output<T>);
43
+ }
44
+
45
+ type CheckOptions<T> = {
46
+ examples?: {
47
+ value: T;
48
+ expected: boolean;
49
+ reason: string;
50
+ }[];
51
+ };
52
+ declare function check<T extends Input>(value: T, condition: string, options?: CheckOptions<T>): {
53
+ toBe: (expected: boolean) => Promise<Output<boolean> | AsyncExpectError<boolean>>;
54
+ toMatchInlineSnapshot: (expected?: string) => Promise<void | Output<boolean> | AsyncExpectError<boolean>>;
55
+ then<TResult1 = Output<boolean>, TResult2 = never>(onfulfilled?: ((value: Output<boolean>) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): PromiseLike<TResult1 | TResult2>;
56
+ value: PromiseLike<boolean>;
57
+ };
58
+
59
+ type ExtractOptions<T, S> = {
60
+ description?: string;
61
+ examples?: {
62
+ value: T;
63
+ extracted: S;
64
+ reason: string;
65
+ }[];
66
+ };
67
+ declare function extract<T extends Input, S extends z.AnyZodObject>(value: T, shape: S, options?: ExtractOptions<T, z.infer<S>>): {
68
+ toBe: (expected: z.infer<S>) => Promise<Output<z.infer<S>> | AsyncExpectError<z.infer<S>>>;
69
+ toMatchObject: (expected: Partial<z.infer<S>>) => Promise<Output<z.infer<S>> | AsyncExpectError<z.infer<S>>>;
70
+ toMatchInlineSnapshot: (expected?: string) => Promise<void | Output<z.infer<S>> | AsyncExpectError<z.infer<S>>>;
71
+ then<TResult1 = Output<z.infer<S>>, TResult2 = never>(onfulfilled?: ((value: Output<z.infer<S>>) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): PromiseLike<TResult1 | TResult2>;
72
+ value: PromiseLike<z.infer<S>>;
73
+ };
74
+
75
+ type FilterOptions<T> = {
76
+ examples?: {
77
+ value: T;
78
+ reason: string;
79
+ keep: boolean;
80
+ }[];
81
+ };
82
+ declare function filter<U>(values: U[], condition: string, options?: FilterOptions<U>): {
83
+ toBe: (expected: U[]) => Promise<Output<U[]> | AsyncExpectError<U[]>>;
84
+ toMatchInlineSnapshot: (expected?: string) => Promise<void | Output<U[]> | AsyncExpectError<U[]>>;
85
+ toHaveNoneFiltered: () => Promise<Output<U[]> | AsyncExpectError<U[]>>;
86
+ toHaveSomeFiltered: () => Promise<Output<U[]> | AsyncExpectError<U[]>>;
87
+ toBeEmpty: () => Promise<Output<U[]> | AsyncExpectError<U[]>>;
88
+ length: {
89
+ toBe: (expected: number) => Promise<Output<U[]> | AsyncExpectError<U[]>>;
90
+ toBeGreaterThanOrEqual: (expected: number) => Promise<Output<U[]> | AsyncExpectError<U[]>>;
91
+ toBeLessThanOrEqual: (expected: number) => Promise<Output<U[]> | AsyncExpectError<U[]>>;
92
+ toBeBetween: (min: number, max: number) => Promise<Output<U[]> | AsyncExpectError<U[]>>;
93
+ };
94
+ then<TResult1 = Output<U[]>, TResult2 = never>(onfulfilled?: ((value: Output<U[]>) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): PromiseLike<TResult1 | TResult2>;
95
+ value: PromiseLike<U[]>;
96
+ };
97
+
98
+ type RatingScore = 1 | 2 | 3 | 4 | 5;
99
+ type RateOptions<T> = {
100
+ examples?: {
101
+ value: T;
102
+ rating: number;
103
+ reason: string;
104
+ }[];
105
+ };
106
+ declare function rate<T extends Input>(value: T, condition: string, options?: RateOptions<T>): {
107
+ toBe: (expected: number) => Promise<Output<number> | AsyncExpectError<number>>;
108
+ toMatchInlineSnapshot: (expected?: string) => Promise<void | Output<number> | AsyncExpectError<number>>;
109
+ toBeGreaterThanOrEqual: (expected: RatingScore) => Promise<Output<number> | AsyncExpectError<number>>;
110
+ toBeLessThanOrEqual: (expected: RatingScore) => Promise<Output<number> | AsyncExpectError<number>>;
111
+ then<TResult1 = Output<number>, TResult2 = never>(onfulfilled?: ((value: Output<number>) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): PromiseLike<TResult1 | TResult2>;
112
+ value: PromiseLike<number>;
113
+ };
114
+
115
+ declare const Models: readonly [{
116
+ readonly id: "anthropic__claude-3-haiku-20240307";
117
+ readonly name: "Claude 3 Haiku";
118
+ readonly integration: "anthropic";
119
+ readonly input: {
120
+ readonly maxTokens: 200000;
121
+ };
122
+ readonly output: {
123
+ readonly maxTokens: 4096;
124
+ };
125
+ }, {
126
+ readonly id: "anthropic__claude-3-5-sonnet-20240620";
127
+ readonly name: "Claude 3.5 Sonnet";
128
+ readonly integration: "anthropic";
129
+ readonly input: {
130
+ readonly maxTokens: 200000;
131
+ };
132
+ readonly output: {
133
+ readonly maxTokens: 4096;
134
+ };
135
+ }, {
136
+ readonly id: "cerebras__llama3.1-70b";
137
+ readonly name: "Llama 3.1 70B";
138
+ readonly integration: "cerebras";
139
+ readonly input: {
140
+ readonly maxTokens: 8192;
141
+ };
142
+ readonly output: {
143
+ readonly maxTokens: 8192;
144
+ };
145
+ }, {
146
+ readonly id: "cerebras__llama3.1-8b";
147
+ readonly name: "Llama 3.1 8B";
148
+ readonly integration: "cerebras";
149
+ readonly input: {
150
+ readonly maxTokens: 8192;
151
+ };
152
+ readonly output: {
153
+ readonly maxTokens: 8192;
154
+ };
155
+ }, {
156
+ readonly id: "fireworks-ai__accounts/fireworks/models/deepseek-coder-v2-instruct";
157
+ readonly name: "DeepSeek Coder V2 Instruct";
158
+ readonly integration: "fireworks-ai";
159
+ readonly input: {
160
+ readonly maxTokens: 131072;
161
+ };
162
+ readonly output: {
163
+ readonly maxTokens: 131072;
164
+ };
165
+ }, {
166
+ readonly id: "fireworks-ai__accounts/fireworks/models/deepseek-coder-v2-lite-instruct";
167
+ readonly name: "DeepSeek Coder V2 Lite";
168
+ readonly integration: "fireworks-ai";
169
+ readonly input: {
170
+ readonly maxTokens: 163840;
171
+ };
172
+ readonly output: {
173
+ readonly maxTokens: 163840;
174
+ };
175
+ }, {
176
+ readonly id: "fireworks-ai__accounts/fireworks/models/firellava-13b";
177
+ readonly name: "FireLLaVA-13B";
178
+ readonly integration: "fireworks-ai";
179
+ readonly input: {
180
+ readonly maxTokens: 4096;
181
+ };
182
+ readonly output: {
183
+ readonly maxTokens: 4096;
184
+ };
185
+ }, {
186
+ readonly id: "fireworks-ai__accounts/fireworks/models/firefunction-v2";
187
+ readonly name: "Firefunction V2";
188
+ readonly integration: "fireworks-ai";
189
+ readonly input: {
190
+ readonly maxTokens: 8192;
191
+ };
192
+ readonly output: {
193
+ readonly maxTokens: 8192;
194
+ };
195
+ }, {
196
+ readonly id: "fireworks-ai__accounts/fireworks/models/gemma2-9b-it";
197
+ readonly name: "Gemma 2 9B Instruct";
198
+ readonly integration: "fireworks-ai";
199
+ readonly input: {
200
+ readonly maxTokens: 8192;
201
+ };
202
+ readonly output: {
203
+ readonly maxTokens: 8192;
204
+ };
205
+ }, {
206
+ readonly id: "fireworks-ai__accounts/fireworks/models/llama-v3p1-405b-instruct";
207
+ readonly name: "Llama 3.1 405B Instruct";
208
+ readonly integration: "fireworks-ai";
209
+ readonly input: {
210
+ readonly maxTokens: 131072;
211
+ };
212
+ readonly output: {
213
+ readonly maxTokens: 131072;
214
+ };
215
+ }, {
216
+ readonly id: "fireworks-ai__accounts/fireworks/models/llama-v3p1-70b-instruct";
217
+ readonly name: "Llama 3.1 70B Instruct";
218
+ readonly integration: "fireworks-ai";
219
+ readonly input: {
220
+ readonly maxTokens: 131072;
221
+ };
222
+ readonly output: {
223
+ readonly maxTokens: 131072;
224
+ };
225
+ }, {
226
+ readonly id: "fireworks-ai__accounts/fireworks/models/llama-v3p1-8b-instruct";
227
+ readonly name: "Llama 3.1 8B Instruct";
228
+ readonly integration: "fireworks-ai";
229
+ readonly input: {
230
+ readonly maxTokens: 131072;
231
+ };
232
+ readonly output: {
233
+ readonly maxTokens: 131072;
234
+ };
235
+ }, {
236
+ readonly id: "fireworks-ai__accounts/fireworks/models/mixtral-8x22b-instruct";
237
+ readonly name: "Mixtral MoE 8x22B Instruct";
238
+ readonly integration: "fireworks-ai";
239
+ readonly input: {
240
+ readonly maxTokens: 65536;
241
+ };
242
+ readonly output: {
243
+ readonly maxTokens: 65536;
244
+ };
245
+ }, {
246
+ readonly id: "fireworks-ai__accounts/fireworks/models/mixtral-8x7b-instruct";
247
+ readonly name: "Mixtral MoE 8x7B Instruct";
248
+ readonly integration: "fireworks-ai";
249
+ readonly input: {
250
+ readonly maxTokens: 32768;
251
+ };
252
+ readonly output: {
253
+ readonly maxTokens: 32768;
254
+ };
255
+ }, {
256
+ readonly id: "fireworks-ai__accounts/fireworks/models/mythomax-l2-13b";
257
+ readonly name: "MythoMax L2 13b";
258
+ readonly integration: "fireworks-ai";
259
+ readonly input: {
260
+ readonly maxTokens: 4096;
261
+ };
262
+ readonly output: {
263
+ readonly maxTokens: 4096;
264
+ };
265
+ }, {
266
+ readonly id: "fireworks-ai__accounts/fireworks/models/qwen2-72b-instruct";
267
+ readonly name: "Qwen2 72b Instruct";
268
+ readonly integration: "fireworks-ai";
269
+ readonly input: {
270
+ readonly maxTokens: 32768;
271
+ };
272
+ readonly output: {
273
+ readonly maxTokens: 32768;
274
+ };
275
+ }, {
276
+ readonly id: "groq__gemma2-9b-it";
277
+ readonly name: "Gemma2 9B";
278
+ readonly integration: "groq";
279
+ readonly input: {
280
+ readonly maxTokens: 8192;
281
+ };
282
+ readonly output: {
283
+ readonly maxTokens: 8192;
284
+ };
285
+ }, {
286
+ readonly id: "groq__llama3-70b-8192";
287
+ readonly name: "LLaMA 3 70B";
288
+ readonly integration: "groq";
289
+ readonly input: {
290
+ readonly maxTokens: 8192;
291
+ };
292
+ readonly output: {
293
+ readonly maxTokens: 8192;
294
+ };
295
+ }, {
296
+ readonly id: "groq__llama3-8b-8192";
297
+ readonly name: "LLaMA 3 8B";
298
+ readonly integration: "groq";
299
+ readonly input: {
300
+ readonly maxTokens: 8192;
301
+ };
302
+ readonly output: {
303
+ readonly maxTokens: 8192;
304
+ };
305
+ }, {
306
+ readonly id: "groq__llama-3.1-70b-versatile";
307
+ readonly name: "LLaMA 3.1 70B";
308
+ readonly integration: "groq";
309
+ readonly input: {
310
+ readonly maxTokens: 128000;
311
+ };
312
+ readonly output: {
313
+ readonly maxTokens: 8192;
314
+ };
315
+ }, {
316
+ readonly id: "groq__llama-3.1-8b-instant";
317
+ readonly name: "LLaMA 3.1 8B";
318
+ readonly integration: "groq";
319
+ readonly input: {
320
+ readonly maxTokens: 128000;
321
+ };
322
+ readonly output: {
323
+ readonly maxTokens: 8192;
324
+ };
325
+ }, {
326
+ readonly id: "groq__llama-3.2-11b-vision-preview";
327
+ readonly name: "LLaMA 3.2 11B Vision";
328
+ readonly integration: "groq";
329
+ readonly input: {
330
+ readonly maxTokens: 128000;
331
+ };
332
+ readonly output: {
333
+ readonly maxTokens: 8192;
334
+ };
335
+ }, {
336
+ readonly id: "groq__llama-3.2-1b-preview";
337
+ readonly name: "LLaMA 3.2 1B";
338
+ readonly integration: "groq";
339
+ readonly input: {
340
+ readonly maxTokens: 128000;
341
+ };
342
+ readonly output: {
343
+ readonly maxTokens: 8192;
344
+ };
345
+ }, {
346
+ readonly id: "groq__llama-3.2-3b-preview";
347
+ readonly name: "LLaMA 3.2 3B";
348
+ readonly integration: "groq";
349
+ readonly input: {
350
+ readonly maxTokens: 128000;
351
+ };
352
+ readonly output: {
353
+ readonly maxTokens: 8192;
354
+ };
355
+ }, {
356
+ readonly id: "groq__llama-3.2-90b-vision-preview";
357
+ readonly name: "LLaMA 3.2 90B Vision";
358
+ readonly integration: "groq";
359
+ readonly input: {
360
+ readonly maxTokens: 128000;
361
+ };
362
+ readonly output: {
363
+ readonly maxTokens: 8192;
364
+ };
365
+ }, {
366
+ readonly id: "groq__llama-3.3-70b-versatile";
367
+ readonly name: "LLaMA 3.3 70B";
368
+ readonly integration: "groq";
369
+ readonly input: {
370
+ readonly maxTokens: 128000;
371
+ };
372
+ readonly output: {
373
+ readonly maxTokens: 32768;
374
+ };
375
+ }, {
376
+ readonly id: "groq__mixtral-8x7b-32768";
377
+ readonly name: "Mixtral 8x7B";
378
+ readonly integration: "groq";
379
+ readonly input: {
380
+ readonly maxTokens: 32768;
381
+ };
382
+ readonly output: {
383
+ readonly maxTokens: 32768;
384
+ };
385
+ }, {
386
+ readonly id: "openai__o1-2024-12-17";
387
+ readonly name: "GPT o1";
388
+ readonly integration: "openai";
389
+ readonly input: {
390
+ readonly maxTokens: 200000;
391
+ };
392
+ readonly output: {
393
+ readonly maxTokens: 100000;
394
+ };
395
+ }, {
396
+ readonly id: "openai__o1-mini-2024-09-12";
397
+ readonly name: "GPT o1-mini";
398
+ readonly integration: "openai";
399
+ readonly input: {
400
+ readonly maxTokens: 128000;
401
+ };
402
+ readonly output: {
403
+ readonly maxTokens: 65536;
404
+ };
405
+ }, {
406
+ readonly id: "openai__gpt-3.5-turbo-0125";
407
+ readonly name: "GPT-3.5 Turbo";
408
+ readonly integration: "openai";
409
+ readonly input: {
410
+ readonly maxTokens: 128000;
411
+ };
412
+ readonly output: {
413
+ readonly maxTokens: 4096;
414
+ };
415
+ }, {
416
+ readonly id: "openai__gpt-4-turbo-2024-04-09";
417
+ readonly name: "GPT-4 Turbo";
418
+ readonly integration: "openai";
419
+ readonly input: {
420
+ readonly maxTokens: 128000;
421
+ };
422
+ readonly output: {
423
+ readonly maxTokens: 4096;
424
+ };
425
+ }, {
426
+ readonly id: "openai__gpt-4o-2024-08-06";
427
+ readonly name: "GPT-4o (August 2024)";
428
+ readonly integration: "openai";
429
+ readonly input: {
430
+ readonly maxTokens: 128000;
431
+ };
432
+ readonly output: {
433
+ readonly maxTokens: 16384;
434
+ };
435
+ }, {
436
+ readonly id: "openai__gpt-4o-2024-05-13";
437
+ readonly name: "GPT-4o (May 2024)";
438
+ readonly integration: "openai";
439
+ readonly input: {
440
+ readonly maxTokens: 128000;
441
+ };
442
+ readonly output: {
443
+ readonly maxTokens: 4096;
444
+ };
445
+ }, {
446
+ readonly id: "openai__gpt-4o-2024-11-20";
447
+ readonly name: "GPT-4o (November 2024)";
448
+ readonly integration: "openai";
449
+ readonly input: {
450
+ readonly maxTokens: 128000;
451
+ };
452
+ readonly output: {
453
+ readonly maxTokens: 16384;
454
+ };
455
+ }, {
456
+ readonly id: "openai__gpt-4o-mini-2024-07-18";
457
+ readonly name: "GPT-4o Mini";
458
+ readonly integration: "openai";
459
+ readonly input: {
460
+ readonly maxTokens: 128000;
461
+ };
462
+ readonly output: {
463
+ readonly maxTokens: 16384;
464
+ };
465
+ }];
466
+
467
+ type EvaluatorModel = (typeof Models)[number]['id'];
468
+
469
+ declare const setEvaluator: (model: EvaluatorModel) => void;
470
+
471
+ declare const setupClient: (client: Client) => void;
472
+
473
+ export { check, compare, extract, filter, rate, setEvaluator, setupClient };