@fonoster/common 0.8.52 → 0.8.59

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.
@@ -294,6 +294,206 @@ declare const assistantSchema: z.ZodObject<{
294
294
  };
295
295
  }[];
296
296
  }>;
297
+ testCases: z.ZodOptional<z.ZodObject<{
298
+ evalsLanguageModel: z.ZodObject<{
299
+ provider: z.ZodEnum<["openai"]>;
300
+ model: z.ZodString;
301
+ apiKey: z.ZodString;
302
+ }, "strip", z.ZodTypeAny, {
303
+ provider?: "openai";
304
+ apiKey?: string;
305
+ model?: string;
306
+ }, {
307
+ provider?: "openai";
308
+ apiKey?: string;
309
+ model?: string;
310
+ }>;
311
+ evalsSystemPrompt: z.ZodOptional<z.ZodString>;
312
+ scenarios: z.ZodArray<z.ZodObject<{
313
+ ref: z.ZodString;
314
+ description: z.ZodString;
315
+ telephonyContext: z.ZodObject<{
316
+ callDirection: z.ZodNativeEnum<typeof import("@fonoster/types").CallDirection>;
317
+ ingressNumber: z.ZodString;
318
+ callerNumber: z.ZodString;
319
+ }, "strip", z.ZodTypeAny, {
320
+ callDirection?: import("@fonoster/types").CallDirection;
321
+ ingressNumber?: string;
322
+ callerNumber?: string;
323
+ }, {
324
+ callDirection?: import("@fonoster/types").CallDirection;
325
+ ingressNumber?: string;
326
+ callerNumber?: string;
327
+ }>;
328
+ conversation: z.ZodArray<z.ZodObject<{
329
+ userInput: z.ZodString;
330
+ expected: z.ZodObject<{
331
+ text: z.ZodObject<{
332
+ type: z.ZodEnum<["exact", "similar"]>;
333
+ response: z.ZodString;
334
+ }, "strip", z.ZodTypeAny, {
335
+ type?: "exact" | "similar";
336
+ response?: string;
337
+ }, {
338
+ type?: "exact" | "similar";
339
+ response?: string;
340
+ }>;
341
+ tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
342
+ tool: z.ZodString;
343
+ parameters: z.ZodRecord<z.ZodString, z.ZodAny>;
344
+ }, "strip", z.ZodTypeAny, {
345
+ parameters?: Record<string, any>;
346
+ tool?: string;
347
+ }, {
348
+ parameters?: Record<string, any>;
349
+ tool?: string;
350
+ }>, "many">>;
351
+ }, "strip", z.ZodTypeAny, {
352
+ tools?: {
353
+ parameters?: Record<string, any>;
354
+ tool?: string;
355
+ }[];
356
+ text?: {
357
+ type?: "exact" | "similar";
358
+ response?: string;
359
+ };
360
+ }, {
361
+ tools?: {
362
+ parameters?: Record<string, any>;
363
+ tool?: string;
364
+ }[];
365
+ text?: {
366
+ type?: "exact" | "similar";
367
+ response?: string;
368
+ };
369
+ }>;
370
+ }, "strip", z.ZodTypeAny, {
371
+ expected?: {
372
+ tools?: {
373
+ parameters?: Record<string, any>;
374
+ tool?: string;
375
+ }[];
376
+ text?: {
377
+ type?: "exact" | "similar";
378
+ response?: string;
379
+ };
380
+ };
381
+ userInput?: string;
382
+ }, {
383
+ expected?: {
384
+ tools?: {
385
+ parameters?: Record<string, any>;
386
+ tool?: string;
387
+ }[];
388
+ text?: {
389
+ type?: "exact" | "similar";
390
+ response?: string;
391
+ };
392
+ };
393
+ userInput?: string;
394
+ }>, "many">;
395
+ }, "strip", z.ZodTypeAny, {
396
+ description?: string;
397
+ ref?: string;
398
+ telephonyContext?: {
399
+ callDirection?: import("@fonoster/types").CallDirection;
400
+ ingressNumber?: string;
401
+ callerNumber?: string;
402
+ };
403
+ conversation?: {
404
+ expected?: {
405
+ tools?: {
406
+ parameters?: Record<string, any>;
407
+ tool?: string;
408
+ }[];
409
+ text?: {
410
+ type?: "exact" | "similar";
411
+ response?: string;
412
+ };
413
+ };
414
+ userInput?: string;
415
+ }[];
416
+ }, {
417
+ description?: string;
418
+ ref?: string;
419
+ telephonyContext?: {
420
+ callDirection?: import("@fonoster/types").CallDirection;
421
+ ingressNumber?: string;
422
+ callerNumber?: string;
423
+ };
424
+ conversation?: {
425
+ expected?: {
426
+ tools?: {
427
+ parameters?: Record<string, any>;
428
+ tool?: string;
429
+ }[];
430
+ text?: {
431
+ type?: "exact" | "similar";
432
+ response?: string;
433
+ };
434
+ };
435
+ userInput?: string;
436
+ }[];
437
+ }>, "many">;
438
+ }, "strip", z.ZodTypeAny, {
439
+ evalsLanguageModel?: {
440
+ provider?: "openai";
441
+ apiKey?: string;
442
+ model?: string;
443
+ };
444
+ evalsSystemPrompt?: string;
445
+ scenarios?: {
446
+ description?: string;
447
+ ref?: string;
448
+ telephonyContext?: {
449
+ callDirection?: import("@fonoster/types").CallDirection;
450
+ ingressNumber?: string;
451
+ callerNumber?: string;
452
+ };
453
+ conversation?: {
454
+ expected?: {
455
+ tools?: {
456
+ parameters?: Record<string, any>;
457
+ tool?: string;
458
+ }[];
459
+ text?: {
460
+ type?: "exact" | "similar";
461
+ response?: string;
462
+ };
463
+ };
464
+ userInput?: string;
465
+ }[];
466
+ }[];
467
+ }, {
468
+ evalsLanguageModel?: {
469
+ provider?: "openai";
470
+ apiKey?: string;
471
+ model?: string;
472
+ };
473
+ evalsSystemPrompt?: string;
474
+ scenarios?: {
475
+ description?: string;
476
+ ref?: string;
477
+ telephonyContext?: {
478
+ callDirection?: import("@fonoster/types").CallDirection;
479
+ ingressNumber?: string;
480
+ callerNumber?: string;
481
+ };
482
+ conversation?: {
483
+ expected?: {
484
+ tools?: {
485
+ parameters?: Record<string, any>;
486
+ tool?: string;
487
+ }[];
488
+ text?: {
489
+ type?: "exact" | "similar";
490
+ response?: string;
491
+ };
492
+ };
493
+ userInput?: string;
494
+ }[];
495
+ }[];
496
+ }>>;
297
497
  }, "strip", z.ZodTypeAny, {
298
498
  conversationSettings?: {
299
499
  firstMessage?: string;
@@ -353,6 +553,36 @@ declare const assistantSchema: z.ZodObject<{
353
553
  };
354
554
  }[];
355
555
  };
556
+ testCases?: {
557
+ evalsLanguageModel?: {
558
+ provider?: "openai";
559
+ apiKey?: string;
560
+ model?: string;
561
+ };
562
+ evalsSystemPrompt?: string;
563
+ scenarios?: {
564
+ description?: string;
565
+ ref?: string;
566
+ telephonyContext?: {
567
+ callDirection?: import("@fonoster/types").CallDirection;
568
+ ingressNumber?: string;
569
+ callerNumber?: string;
570
+ };
571
+ conversation?: {
572
+ expected?: {
573
+ tools?: {
574
+ parameters?: Record<string, any>;
575
+ tool?: string;
576
+ }[];
577
+ text?: {
578
+ type?: "exact" | "similar";
579
+ response?: string;
580
+ };
581
+ };
582
+ userInput?: string;
583
+ }[];
584
+ }[];
585
+ };
356
586
  }, {
357
587
  conversationSettings?: {
358
588
  firstMessage?: string;
@@ -412,5 +642,35 @@ declare const assistantSchema: z.ZodObject<{
412
642
  };
413
643
  }[];
414
644
  };
645
+ testCases?: {
646
+ evalsLanguageModel?: {
647
+ provider?: "openai";
648
+ apiKey?: string;
649
+ model?: string;
650
+ };
651
+ evalsSystemPrompt?: string;
652
+ scenarios?: {
653
+ description?: string;
654
+ ref?: string;
655
+ telephonyContext?: {
656
+ callDirection?: import("@fonoster/types").CallDirection;
657
+ ingressNumber?: string;
658
+ callerNumber?: string;
659
+ };
660
+ conversation?: {
661
+ expected?: {
662
+ tools?: {
663
+ parameters?: Record<string, any>;
664
+ tool?: string;
665
+ }[];
666
+ text?: {
667
+ type?: "exact" | "similar";
668
+ response?: string;
669
+ };
670
+ };
671
+ userInput?: string;
672
+ }[];
673
+ }[];
674
+ };
415
675
  }>;
416
676
  export { assistantSchema };
@@ -22,8 +22,10 @@ exports.assistantSchema = void 0;
22
22
  const zod_1 = require("zod");
23
23
  const conversationSettingsSchema_1 = require("./conversationSettingsSchema");
24
24
  const languageModelConfigSchema_1 = require("./languageModelConfigSchema");
25
+ const testCasesSchema_1 = require("./testCasesSchema");
25
26
  const assistantSchema = zod_1.z.object({
26
27
  conversationSettings: conversationSettingsSchema_1.conversationSettingsSchema,
27
- languageModel: languageModelConfigSchema_1.languageModelConfigSchema
28
+ languageModel: languageModelConfigSchema_1.languageModelConfigSchema,
29
+ testCases: testCasesSchema_1.testCasesSchema.optional()
28
30
  });
29
31
  exports.assistantSchema = assistantSchema;
@@ -0,0 +1,203 @@
1
+ import { z } from "zod";
2
+ import { CallDirection } from "@fonoster/types";
3
+ declare const testCasesSchema: z.ZodObject<{
4
+ evalsLanguageModel: z.ZodObject<{
5
+ provider: z.ZodEnum<["openai"]>;
6
+ model: z.ZodString;
7
+ apiKey: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ provider?: "openai";
10
+ apiKey?: string;
11
+ model?: string;
12
+ }, {
13
+ provider?: "openai";
14
+ apiKey?: string;
15
+ model?: string;
16
+ }>;
17
+ evalsSystemPrompt: z.ZodOptional<z.ZodString>;
18
+ scenarios: z.ZodArray<z.ZodObject<{
19
+ ref: z.ZodString;
20
+ description: z.ZodString;
21
+ telephonyContext: z.ZodObject<{
22
+ callDirection: z.ZodNativeEnum<typeof CallDirection>;
23
+ ingressNumber: z.ZodString;
24
+ callerNumber: z.ZodString;
25
+ }, "strip", z.ZodTypeAny, {
26
+ callDirection?: CallDirection;
27
+ ingressNumber?: string;
28
+ callerNumber?: string;
29
+ }, {
30
+ callDirection?: CallDirection;
31
+ ingressNumber?: string;
32
+ callerNumber?: string;
33
+ }>;
34
+ conversation: z.ZodArray<z.ZodObject<{
35
+ userInput: z.ZodString;
36
+ expected: z.ZodObject<{
37
+ text: z.ZodObject<{
38
+ type: z.ZodEnum<["exact", "similar"]>;
39
+ response: z.ZodString;
40
+ }, "strip", z.ZodTypeAny, {
41
+ type?: "exact" | "similar";
42
+ response?: string;
43
+ }, {
44
+ type?: "exact" | "similar";
45
+ response?: string;
46
+ }>;
47
+ tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
48
+ tool: z.ZodString;
49
+ parameters: z.ZodRecord<z.ZodString, z.ZodAny>;
50
+ }, "strip", z.ZodTypeAny, {
51
+ parameters?: Record<string, any>;
52
+ tool?: string;
53
+ }, {
54
+ parameters?: Record<string, any>;
55
+ tool?: string;
56
+ }>, "many">>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ tools?: {
59
+ parameters?: Record<string, any>;
60
+ tool?: string;
61
+ }[];
62
+ text?: {
63
+ type?: "exact" | "similar";
64
+ response?: string;
65
+ };
66
+ }, {
67
+ tools?: {
68
+ parameters?: Record<string, any>;
69
+ tool?: string;
70
+ }[];
71
+ text?: {
72
+ type?: "exact" | "similar";
73
+ response?: string;
74
+ };
75
+ }>;
76
+ }, "strip", z.ZodTypeAny, {
77
+ expected?: {
78
+ tools?: {
79
+ parameters?: Record<string, any>;
80
+ tool?: string;
81
+ }[];
82
+ text?: {
83
+ type?: "exact" | "similar";
84
+ response?: string;
85
+ };
86
+ };
87
+ userInput?: string;
88
+ }, {
89
+ expected?: {
90
+ tools?: {
91
+ parameters?: Record<string, any>;
92
+ tool?: string;
93
+ }[];
94
+ text?: {
95
+ type?: "exact" | "similar";
96
+ response?: string;
97
+ };
98
+ };
99
+ userInput?: string;
100
+ }>, "many">;
101
+ }, "strip", z.ZodTypeAny, {
102
+ description?: string;
103
+ ref?: string;
104
+ telephonyContext?: {
105
+ callDirection?: CallDirection;
106
+ ingressNumber?: string;
107
+ callerNumber?: string;
108
+ };
109
+ conversation?: {
110
+ expected?: {
111
+ tools?: {
112
+ parameters?: Record<string, any>;
113
+ tool?: string;
114
+ }[];
115
+ text?: {
116
+ type?: "exact" | "similar";
117
+ response?: string;
118
+ };
119
+ };
120
+ userInput?: string;
121
+ }[];
122
+ }, {
123
+ description?: string;
124
+ ref?: string;
125
+ telephonyContext?: {
126
+ callDirection?: CallDirection;
127
+ ingressNumber?: string;
128
+ callerNumber?: string;
129
+ };
130
+ conversation?: {
131
+ expected?: {
132
+ tools?: {
133
+ parameters?: Record<string, any>;
134
+ tool?: string;
135
+ }[];
136
+ text?: {
137
+ type?: "exact" | "similar";
138
+ response?: string;
139
+ };
140
+ };
141
+ userInput?: string;
142
+ }[];
143
+ }>, "many">;
144
+ }, "strip", z.ZodTypeAny, {
145
+ evalsLanguageModel?: {
146
+ provider?: "openai";
147
+ apiKey?: string;
148
+ model?: string;
149
+ };
150
+ evalsSystemPrompt?: string;
151
+ scenarios?: {
152
+ description?: string;
153
+ ref?: string;
154
+ telephonyContext?: {
155
+ callDirection?: CallDirection;
156
+ ingressNumber?: string;
157
+ callerNumber?: string;
158
+ };
159
+ conversation?: {
160
+ expected?: {
161
+ tools?: {
162
+ parameters?: Record<string, any>;
163
+ tool?: string;
164
+ }[];
165
+ text?: {
166
+ type?: "exact" | "similar";
167
+ response?: string;
168
+ };
169
+ };
170
+ userInput?: string;
171
+ }[];
172
+ }[];
173
+ }, {
174
+ evalsLanguageModel?: {
175
+ provider?: "openai";
176
+ apiKey?: string;
177
+ model?: string;
178
+ };
179
+ evalsSystemPrompt?: string;
180
+ scenarios?: {
181
+ description?: string;
182
+ ref?: string;
183
+ telephonyContext?: {
184
+ callDirection?: CallDirection;
185
+ ingressNumber?: string;
186
+ callerNumber?: string;
187
+ };
188
+ conversation?: {
189
+ expected?: {
190
+ tools?: {
191
+ parameters?: Record<string, any>;
192
+ tool?: string;
193
+ }[];
194
+ text?: {
195
+ type?: "exact" | "similar";
196
+ response?: string;
197
+ };
198
+ };
199
+ userInput?: string;
200
+ }[];
201
+ }[];
202
+ }>;
203
+ export { testCasesSchema };
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.testCasesSchema = void 0;
4
+ /*
5
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster/fonoster
7
+ *
8
+ * This file is part of Fonoster
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ const zod_1 = require("zod");
23
+ const types_1 = require("@fonoster/types");
24
+ const testCasesSchema = zod_1.z.object({
25
+ evalsLanguageModel: zod_1.z.object({
26
+ provider: zod_1.z.enum(["openai"], {
27
+ message: "Invalid language model provider. Only OpenAI is supported for evals."
28
+ }),
29
+ model: zod_1.z.string(),
30
+ apiKey: zod_1.z.string()
31
+ }),
32
+ evalsSystemPrompt: zod_1.z.string().optional(),
33
+ scenarios: zod_1.z.array(zod_1.z.object({
34
+ ref: zod_1.z.string(),
35
+ description: zod_1.z.string(),
36
+ telephonyContext: zod_1.z.object({
37
+ callDirection: zod_1.z.nativeEnum(types_1.CallDirection),
38
+ ingressNumber: zod_1.z.string(),
39
+ callerNumber: zod_1.z.string()
40
+ }),
41
+ conversation: zod_1.z.array(zod_1.z.object({
42
+ userInput: zod_1.z.string(),
43
+ expected: zod_1.z.object({
44
+ text: zod_1.z.object({
45
+ type: zod_1.z.enum(["exact", "similar"]),
46
+ response: zod_1.z.string()
47
+ }),
48
+ tools: zod_1.z
49
+ .array(zod_1.z.object({
50
+ tool: zod_1.z.string(),
51
+ parameters: zod_1.z.record(zod_1.z.string(), zod_1.z.any())
52
+ }))
53
+ .optional()
54
+ })
55
+ }))
56
+ }))
57
+ });
58
+ exports.testCasesSchema = testCasesSchema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/common",
3
- "version": "0.8.52",
3
+ "version": "0.8.59",
4
4
  "description": "Common library for Fonoster projects",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -18,7 +18,7 @@
18
18
  "clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo"
19
19
  },
20
20
  "dependencies": {
21
- "@fonoster/logger": "^0.8.51",
21
+ "@fonoster/logger": "^0.8.59",
22
22
  "@grpc/grpc-js": "~1.10.6",
23
23
  "@grpc/proto-loader": "^0.7.12",
24
24
  "@influxdata/influxdb-client": "^1.35.0",
@@ -48,5 +48,5 @@
48
48
  "devDependencies": {
49
49
  "@types/nodemailer": "^6.4.14"
50
50
  },
51
- "gitHead": "772398ea115078012f8e270943ec36b61343ea36"
51
+ "gitHead": "6a5255febb9e4bcd9184d93abe72281f945c8c4d"
52
52
  }