@fonoster/autopilot 0.8.26 → 0.8.27

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.
@@ -1,112 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.languageModelConfigSchema = exports.conversationSettingsSchema = exports.assistantSchema = void 0;
4
- /*
5
- * Copyright (C) 2024 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 common_1 = require("@fonoster/common");
23
- const zod_1 = require("zod");
24
- const ToolSchema_1 = require("../tools/ToolSchema");
25
- const types_1 = require("../types");
26
- const NUMBER_BETWEEN_0_AND_1 = "must be a number between 0 and 1";
27
- const NUMBER_BETWEEN_0_AND_2 = "must be a number between 0 and 2";
28
- const conversationSettingsSchema = zod_1.z.object({
29
- firstMessage: zod_1.z.string().optional(),
30
- systemTemplate: zod_1.z.string(),
31
- goodbyeMessage: zod_1.z.string(),
32
- systemErrorMessage: zod_1.z.string(),
33
- initialDtmf: zod_1.z
34
- .string()
35
- .regex(/^[0-9*#]+$/, { message: common_1.Messages.VALID_DTMF })
36
- .optional(),
37
- maxSpeechWaitTimeout: zod_1.z
38
- .number()
39
- .int({ message: common_1.Messages.POSITIVE_INTEGER_MESSAGE })
40
- .positive({ message: common_1.Messages.POSITIVE_INTEGER_MESSAGE }),
41
- transferOptions: zod_1.z
42
- .object({
43
- phoneNumber: zod_1.z.string(),
44
- message: zod_1.z.string(),
45
- timeout: zod_1.z
46
- .number()
47
- .int({ message: common_1.Messages.POSITIVE_INTEGER_MESSAGE })
48
- .positive({ message: common_1.Messages.POSITIVE_INTEGER_MESSAGE })
49
- .optional()
50
- })
51
- .optional(),
52
- idleOptions: zod_1.z
53
- .object({
54
- message: zod_1.z.string(),
55
- timeout: zod_1.z
56
- .number()
57
- .int({ message: common_1.Messages.POSITIVE_INTEGER_MESSAGE })
58
- .positive({ message: common_1.Messages.POSITIVE_INTEGER_MESSAGE }),
59
- maxTimeoutCount: zod_1.z
60
- .number()
61
- .int({ message: common_1.Messages.POSITIVE_INTEGER_MESSAGE })
62
- .positive({ message: common_1.Messages.POSITIVE_INTEGER_MESSAGE })
63
- })
64
- .optional(),
65
- vad: zod_1.z.object({
66
- pathToModel: zod_1.z.string().optional(),
67
- activationThreshold: zod_1.z.number()
68
- .max(1)
69
- .min(0)
70
- .positive({ message: NUMBER_BETWEEN_0_AND_1 }),
71
- deactivationThreshold: zod_1.z.number().max(1).min(0).positive({ message: NUMBER_BETWEEN_0_AND_1 }),
72
- debounceFrames: zod_1.z
73
- .number()
74
- .int({ message: common_1.Messages.POSITIVE_INTEGER_MESSAGE })
75
- .positive({ message: common_1.Messages.POSITIVE_INTEGER_MESSAGE })
76
- })
77
- });
78
- exports.conversationSettingsSchema = conversationSettingsSchema;
79
- const languageModelConfigSchema = zod_1.z.object({
80
- provider: zod_1.z.nativeEnum(types_1.LANGUAGE_MODEL_PROVIDER, {
81
- message: "Invalid language model provider."
82
- }),
83
- apiKey: zod_1.z.string().optional(),
84
- model: zod_1.z.string(),
85
- temperature: zod_1.z.number()
86
- .max(2, { message: NUMBER_BETWEEN_0_AND_2 })
87
- .min(0, { message: NUMBER_BETWEEN_0_AND_2 }),
88
- maxTokens: zod_1.z
89
- .number()
90
- .int({ message: common_1.Messages.POSITIVE_INTEGER_MESSAGE })
91
- .positive({ message: common_1.Messages.POSITIVE_INTEGER_MESSAGE }),
92
- baseUrl: zod_1.z
93
- .string()
94
- .url({
95
- message: common_1.Messages.VALID_URL
96
- })
97
- .optional(),
98
- knowledgeBase: zod_1.z.array(zod_1.z.object({
99
- type: zod_1.z.enum(["s3"]),
100
- title: zod_1.z.string(),
101
- document: zod_1.z.string().regex(/\.pdf$/, {
102
- message: "Document must be a pdf file."
103
- })
104
- })),
105
- tools: zod_1.z.array(ToolSchema_1.toolSchema)
106
- });
107
- exports.languageModelConfigSchema = languageModelConfigSchema;
108
- const assistantSchema = zod_1.z.object({
109
- conversationSettings: conversationSettingsSchema,
110
- languageModel: languageModelConfigSchema
111
- });
112
- exports.assistantSchema = assistantSchema;