@fonoster/autopilot 0.9.21 → 0.9.23
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/Autopilot.js +6 -2
- package/dist/assistants/index.d.ts +18 -0
- package/dist/assistants/index.js +1 -1
- package/dist/assistants/loadAndValidateAssistant.js +2 -2
- package/dist/assistants/types.d.ts +19 -1
- package/dist/envs.d.ts +5 -5
- package/dist/envs.js +5 -5
- package/dist/handleVoiceRequest.js +11 -10
- package/dist/index.d.ts +18 -0
- package/dist/index.js +1 -1
- package/dist/knowledge/AbstractKnowledgeBase.js +1 -1
- package/dist/knowledge/FilesKnowledgeBase.d.ts +18 -0
- package/dist/knowledge/FilesKnowledgeBase.js +1 -1
- package/dist/knowledge/S3KnowledgeBase.d.ts +18 -0
- package/dist/knowledge/S3KnowledgeBase.js +1 -1
- package/dist/knowledge/index.d.ts +18 -0
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/types.d.ts +18 -0
- package/dist/loadAssistantConfigFromFile.js +2 -2
- package/dist/loadAssistantFromAPI.d.ts +18 -0
- package/dist/loadAssistantFromAPI.js +12 -9
- package/dist/machine/actions/announceIdleTimeout.js +1 -1
- package/dist/machine/actions/announceSystemError.js +1 -1
- package/dist/machine/actions/appendSpeech.d.ts +1 -1
- package/dist/machine/actions/appendSpeech.js +2 -2
- package/dist/machine/actions/cleanSpeech.d.ts +1 -1
- package/dist/machine/actions/cleanSpeech.js +1 -1
- package/dist/machine/actions/goodbye.js +1 -1
- package/dist/machine/actions/greetUser.js +1 -1
- package/dist/machine/actions/increaseIdleTimeoutCount.d.ts +1 -1
- package/dist/machine/actions/increaseIdleTimeoutCount.js +2 -2
- package/dist/machine/actions/index.d.ts +18 -0
- package/dist/machine/actions/index.js +1 -1
- package/dist/machine/actions/interruptPlayback.js +1 -1
- package/dist/machine/actions/resetIdleTimeoutCount.d.ts +1 -1
- package/dist/machine/actions/resetIdleTimeoutCount.js +2 -2
- package/dist/machine/actions/resetState.d.ts +1 -1
- package/dist/machine/actions/resetState.js +2 -2
- package/dist/machine/actions/setSpeaking.d.ts +1 -1
- package/dist/machine/actions/setSpeaking.js +2 -2
- package/dist/machine/actions/setSpeakingDone.d.ts +1 -1
- package/dist/machine/actions/setSpeakingDone.js +2 -2
- package/dist/machine/actors/doProcessUserRequest.js +2 -2
- package/dist/machine/actors/index.d.ts +18 -0
- package/dist/machine/actors/index.js +1 -1
- package/dist/machine/context.d.ts +18 -0
- package/dist/machine/context.js +1 -1
- package/dist/machine/delays.d.ts +18 -0
- package/dist/machine/delays.js +1 -2
- package/dist/machine/guards/hasSpeechResult.js +1 -1
- package/dist/machine/guards/idleTimeoutCountExceedsMax.js +1 -1
- package/dist/machine/guards/index.d.ts +18 -0
- package/dist/machine/guards/index.js +1 -1
- package/dist/machine/guards/isSpeaking.js +1 -1
- package/dist/machine/index.d.ts +18 -0
- package/dist/machine/index.js +1 -1
- package/dist/machine/machine.d.ts +38 -81
- package/dist/machine/machine.js +1 -2
- package/dist/machine/setup.d.ts +67 -83
- package/dist/machine/setup.js +57 -12
- package/dist/machine/types.d.ts +28 -1
- package/dist/models/AbstractLanguageModel.d.ts +1 -1
- package/dist/models/AbstractLanguageModel.js +3 -3
- package/dist/models/LanguageModelFactory.d.ts +2 -2
- package/dist/models/LanguageModelFactory.js +2 -2
- package/dist/models/chatHistory.js +1 -1
- package/dist/models/createChain.d.ts +19 -1
- package/dist/models/createLanguageModel.d.ts +18 -0
- package/dist/models/createLanguageModel.js +5 -6
- package/dist/models/createPromptTemplate.d.ts +18 -0
- package/dist/models/createPromptTemplate.js +1 -1
- package/dist/models/evaluations/createTestTextSimilarity.js +1 -1
- package/dist/models/evaluations/evalTestCases.d.ts +24 -2
- package/dist/models/evaluations/evalTestCases.js +3 -3
- package/dist/models/evaluations/evaluateScenario.js +18 -0
- package/dist/models/evaluations/evaluateStep.js +21 -3
- package/dist/models/evaluations/evaluateTextResponse.d.ts +18 -0
- package/dist/models/evaluations/evaluateTextResponse.js +1 -1
- package/dist/models/evaluations/evaluateToolCalls.js +18 -0
- package/dist/models/evaluations/index.d.ts +18 -0
- package/dist/models/evaluations/index.js +1 -1
- package/dist/models/evaluations/printEval.js +2 -2
- package/dist/models/evaluations/textSimilaryPrompt.d.ts +18 -0
- package/dist/models/evaluations/textSimilaryPrompt.js +1 -1
- package/dist/models/evaluations/types.d.ts +19 -6
- package/dist/models/groq/Groq.d.ts +1 -1
- package/dist/models/groq/index.d.ts +18 -0
- package/dist/models/groq/index.js +2 -2
- package/dist/models/groq/types.d.ts +18 -0
- package/dist/models/index.d.ts +18 -0
- package/dist/models/index.js +2 -2
- package/dist/models/ollama/Ollama.d.ts +1 -1
- package/dist/models/ollama/index.d.ts +18 -0
- package/dist/models/ollama/index.js +1 -1
- package/dist/models/ollama/types.d.ts +18 -0
- package/dist/models/openai/OpenAI.d.ts +1 -1
- package/dist/models/openai/index.d.ts +18 -0
- package/dist/models/openai/index.js +2 -2
- package/dist/models/openai/types.d.ts +18 -0
- package/dist/models/toolInvocation.d.ts +1 -1
- package/dist/models/toolInvocation.js +1 -1
- package/dist/models/types.d.ts +19 -1
- package/dist/sendConversationEndedEvent.d.ts +19 -2
- package/dist/sendConversationEndedEvent.js +1 -1
- package/dist/server.js +163 -1
- package/dist/tools/ToolsCatalog.d.ts +1 -1
- package/dist/tools/ToolsCatalog.js +6 -6
- package/dist/tools/builtin/hangupToolDefinition.d.ts +19 -1
- package/dist/tools/builtin/transferToolDefinition.d.ts +19 -1
- package/dist/tools/convertToolToOpenAITool.d.ts +19 -1
- package/dist/tools/index.d.ts +18 -0
- package/dist/tools/index.js +1 -1
- package/dist/tools/types.d.ts +27 -0
- package/dist/types.d.ts +27 -2
- package/dist/vad/SileroVad.js +1 -2
- package/dist/vad/SileroVadModel.js +1 -1
- package/dist/vad/chunkToFloat32Array.d.ts +18 -0
- package/dist/vad/chunkToFloat32Array.js +1 -5
- package/dist/vad/createVad.js +1 -10
- package/dist/vad/index.d.ts +18 -0
- package/dist/vad/index.js +1 -2
- package/dist/vad/types.d.ts +18 -0
- package/dist/vadWorker.js +3 -3
- package/dist/vadv5/SileroVad.js +1 -2
- package/dist/vadv5/SileroVadModel.js +1 -1
- package/dist/vadv5/createVad.js +3 -4
- package/dist/vadv5/index.d.ts +18 -0
- package/dist/vadv5/index.js +1 -2
- package/dist/vadv5/types.d.ts +18 -0
- package/dist/voice/Voice.js +1 -1
- package/dist/voice/index.d.ts +18 -0
- package/dist/voice/index.js +2 -2
- package/dist/voice/types.d.ts +18 -0
- package/dist/voiceServerSetup.js +1 -1
- package/package.json +9 -11
- package/dist/tools/type.d.ts +0 -9
- /package/dist/tools/{type.js → types.js} +0 -0
package/dist/Autopilot.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Autopilot = void 0;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
8
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
9
9
|
* http://github.com/fonoster/fonoster
|
|
10
10
|
*
|
|
@@ -93,7 +93,11 @@ class Autopilot {
|
|
|
93
93
|
const { speech, responseTime } = payload;
|
|
94
94
|
logger.verbose("received speech result", { speech, responseTime });
|
|
95
95
|
if (payload.speech) {
|
|
96
|
-
this.actor.send({
|
|
96
|
+
this.actor.send({
|
|
97
|
+
type: "SPEECH_RESULT",
|
|
98
|
+
speech: payload.speech ?? "",
|
|
99
|
+
responseTime
|
|
100
|
+
});
|
|
97
101
|
}
|
|
98
102
|
});
|
|
99
103
|
}
|
|
@@ -1,2 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
1
19
|
export * from "./loadAndValidateAssistant";
|
|
2
20
|
export * from "./types";
|
package/dist/assistants/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
18
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
19
19
|
* http://github.com/fonoster/fonoster
|
|
20
20
|
*
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.loadAndValidateAssistant = loadAndValidateAssistant;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
8
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
9
9
|
* http://github.com/fonoster/fonoster
|
|
10
10
|
*
|
|
@@ -23,8 +23,8 @@ exports.loadAndValidateAssistant = loadAndValidateAssistant;
|
|
|
23
23
|
* limitations under the License.
|
|
24
24
|
*/
|
|
25
25
|
const fs_1 = __importDefault(require("fs"));
|
|
26
|
-
const logger_1 = require("@fonoster/logger");
|
|
27
26
|
const common_1 = require("@fonoster/common");
|
|
27
|
+
const logger_1 = require("@fonoster/logger");
|
|
28
28
|
const logger = (0, logger_1.getLogger)({ service: "autopilot", filePath: __filename });
|
|
29
29
|
function loadAndValidateAssistant(path) {
|
|
30
30
|
if (!fs_1.default.existsSync(path)) {
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
2
19
|
import { assistantSchema, conversationSettingsSchema, languageModelConfigSchema } from "@fonoster/common";
|
|
20
|
+
import { z } from "zod";
|
|
3
21
|
type ConversationSettings = z.infer<typeof conversationSettingsSchema>;
|
|
4
22
|
type LanguageModelConfig = z.infer<typeof languageModelConfigSchema>;
|
|
5
23
|
type AssistantConfig = z.infer<typeof assistantSchema>;
|
package/dist/envs.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export declare const AWS_S3_ACCESS_KEY_ID: string
|
|
2
|
-
export declare const AWS_S3_ENDPOINT: string
|
|
1
|
+
export declare const AWS_S3_ACCESS_KEY_ID: string;
|
|
2
|
+
export declare const AWS_S3_ENDPOINT: string;
|
|
3
3
|
export declare const AWS_S3_REGION: string;
|
|
4
|
-
export declare const AWS_S3_SECRET_ACCESS_KEY: string
|
|
4
|
+
export declare const AWS_S3_SECRET_ACCESS_KEY: string;
|
|
5
5
|
export declare const KNOWLEDGE_BASE_ENABLED: boolean;
|
|
6
6
|
export declare const NODE_ENV: string;
|
|
7
|
-
export declare const UNSTRUCTURED_API_KEY: string
|
|
7
|
+
export declare const UNSTRUCTURED_API_KEY: string;
|
|
8
8
|
export declare const UNSTRUCTURED_API_URL: string;
|
|
9
9
|
export declare const SILERO_VAD_VERSION: string;
|
|
10
10
|
export declare const CONVERSATION_PROVIDER: string;
|
|
11
11
|
export declare const CONVERSATION_PROVIDER_FILE: string;
|
|
12
12
|
export declare const APISERVER_ENDPOINT: string;
|
|
13
13
|
export declare const INTEGRATIONS_FILE: string;
|
|
14
|
-
export declare const OPENAI_API_KEY: string
|
|
14
|
+
export declare const OPENAI_API_KEY: string;
|
|
15
15
|
export declare const SKIP_IDENTITY: boolean;
|
package/dist/envs.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SKIP_IDENTITY = exports.OPENAI_API_KEY = exports.INTEGRATIONS_FILE = exports.APISERVER_ENDPOINT = exports.CONVERSATION_PROVIDER_FILE = exports.CONVERSATION_PROVIDER = exports.SILERO_VAD_VERSION = exports.UNSTRUCTURED_API_URL = exports.UNSTRUCTURED_API_KEY = exports.NODE_ENV = exports.KNOWLEDGE_BASE_ENABLED = exports.AWS_S3_SECRET_ACCESS_KEY = exports.AWS_S3_REGION = exports.AWS_S3_ENDPOINT = exports.AWS_S3_ACCESS_KEY_ID = void 0;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
8
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
9
9
|
* http://github.com/fonoster/fonoster
|
|
10
10
|
*
|
|
@@ -30,13 +30,13 @@ if (process.env.NODE_ENV === "dev") {
|
|
|
30
30
|
dotenv_1.default.config({ path: (0, path_1.join)(__dirname, "..", "..", "..", ".env") });
|
|
31
31
|
}
|
|
32
32
|
const e = process.env;
|
|
33
|
-
exports.AWS_S3_ACCESS_KEY_ID = e.AUTOPILOT_AWS_S3_ACCESS_KEY_ID;
|
|
34
|
-
exports.AWS_S3_ENDPOINT = e.AUTOPILOT_AWS_S3_ENDPOINT;
|
|
33
|
+
exports.AWS_S3_ACCESS_KEY_ID = e.AUTOPILOT_AWS_S3_ACCESS_KEY_ID ?? "";
|
|
34
|
+
exports.AWS_S3_ENDPOINT = e.AUTOPILOT_AWS_S3_ENDPOINT ?? "";
|
|
35
35
|
exports.AWS_S3_REGION = e.AUTOPILOT_AWS_S3_REGION ?? "us-east-1";
|
|
36
|
-
exports.AWS_S3_SECRET_ACCESS_KEY = e.AUTOPILOT_AWS_S3_SECRET_ACCESS_KEY;
|
|
36
|
+
exports.AWS_S3_SECRET_ACCESS_KEY = e.AUTOPILOT_AWS_S3_SECRET_ACCESS_KEY ?? "";
|
|
37
37
|
exports.KNOWLEDGE_BASE_ENABLED = e.AUTOPILOT_KNOWLEDGE_BASE_ENABLED === "true";
|
|
38
38
|
exports.NODE_ENV = e.NODE_ENV || "production";
|
|
39
|
-
exports.UNSTRUCTURED_API_KEY = e.AUTOPILOT_UNSTRUCTURED_API_KEY;
|
|
39
|
+
exports.UNSTRUCTURED_API_KEY = e.AUTOPILOT_UNSTRUCTURED_API_KEY ?? "";
|
|
40
40
|
exports.UNSTRUCTURED_API_URL = e.AUTOPILOT_UNSTRUCTURED_API_URL ??
|
|
41
41
|
"https://api.unstructuredapp.io/general/v0/general";
|
|
42
42
|
exports.SILERO_VAD_VERSION = e.AUTOPILOT_SILERO_VAD_VERSION ?? "v5";
|
|
@@ -37,8 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.handleVoiceRequest = handleVoiceRequest;
|
|
40
|
-
|
|
41
|
-
/*
|
|
40
|
+
/**
|
|
42
41
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
43
42
|
* http://github.com/fonoster/fonoster
|
|
44
43
|
*
|
|
@@ -56,15 +55,15 @@ exports.handleVoiceRequest = handleVoiceRequest;
|
|
|
56
55
|
* See the License for the specific language governing permissions and
|
|
57
56
|
* limitations under the License.
|
|
58
57
|
*/
|
|
58
|
+
const fs_1 = __importDefault(require("fs"));
|
|
59
59
|
const common_1 = require("@fonoster/common");
|
|
60
60
|
const logger_1 = require("@fonoster/logger");
|
|
61
|
-
const createLanguageModel_1 = require("./models/createLanguageModel");
|
|
62
61
|
const envs_1 = require("./envs");
|
|
63
62
|
const loadAssistantConfigFromFile_1 = require("./loadAssistantConfigFromFile");
|
|
64
|
-
const _1 = __importStar(require("."));
|
|
65
63
|
const loadAssistantFromAPI_1 = require("./loadAssistantFromAPI");
|
|
66
|
-
const
|
|
64
|
+
const createLanguageModel_1 = require("./models/createLanguageModel");
|
|
67
65
|
const sendConversationEndedEvent_1 = require("./sendConversationEndedEvent");
|
|
66
|
+
const _1 = __importStar(require("."));
|
|
68
67
|
const logger = (0, logger_1.getLogger)({ service: "autopilot", filePath: __filename });
|
|
69
68
|
async function handleVoiceRequest(req, res) {
|
|
70
69
|
const { accessKeyId, callerNumber, ingressNumber, sessionRef, appRef, callDirection } = req;
|
|
@@ -82,7 +81,7 @@ async function handleVoiceRequest(req, res) {
|
|
|
82
81
|
if (envs_1.KNOWLEDGE_BASE_ENABLED) {
|
|
83
82
|
knowledgeBase = new _1.S3KnowledgeBase({
|
|
84
83
|
bucket: req.accessKeyId.toLowerCase(),
|
|
85
|
-
documents: assistantConfig.languageModel
|
|
84
|
+
documents: assistantConfig.languageModel?.knowledgeBase?.map((doc) => doc.document),
|
|
86
85
|
s3Config: {
|
|
87
86
|
endpoint: envs_1.AWS_S3_ENDPOINT,
|
|
88
87
|
region: envs_1.AWS_S3_REGION,
|
|
@@ -112,9 +111,9 @@ async function handleVoiceRequest(req, res) {
|
|
|
112
111
|
});
|
|
113
112
|
const { conversationSettings } = assistantConfig;
|
|
114
113
|
const autopilot = new _1.default({
|
|
115
|
-
conversationSettings,
|
|
116
|
-
voice,
|
|
117
|
-
languageModel
|
|
114
|
+
conversationSettings: conversationSettings,
|
|
115
|
+
voice: voice,
|
|
116
|
+
languageModel: languageModel
|
|
118
117
|
});
|
|
119
118
|
autopilot.start();
|
|
120
119
|
res.on(common_1.StreamEvent.END, async () => {
|
|
@@ -131,6 +130,8 @@ async function handleVoiceRequest(req, res) {
|
|
|
131
130
|
return null;
|
|
132
131
|
})
|
|
133
132
|
.filter(Boolean);
|
|
134
|
-
|
|
133
|
+
if (assistantConfig.eventsHook?.url) {
|
|
134
|
+
await (0, sendConversationEndedEvent_1.sendConversationEndedEvent)(assistantConfig.eventsHook, chatHistory);
|
|
135
|
+
}
|
|
135
136
|
});
|
|
136
137
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
1
19
|
import { Autopilot } from "./Autopilot";
|
|
2
20
|
export default Autopilot;
|
|
3
21
|
export * from "./assistants";
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
18
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
19
19
|
* http://github.com/fonoster/fonoster
|
|
20
20
|
*
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
1
19
|
import { PDFLoader } from "@langchain/community/document_loaders/fs/pdf";
|
|
2
20
|
import { Embeddings } from "@langchain/core/embeddings";
|
|
3
21
|
import { AbstractKnowledgeBase } from "./AbstractKnowledgeBase";
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
1
19
|
import { S3Loader } from "@langchain/community/document_loaders/web/s3";
|
|
2
20
|
import { AbstractKnowledgeBase } from "./AbstractKnowledgeBase";
|
|
3
21
|
import { S3KnowledgeBaseParams } from "./types";
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
1
19
|
export * from "./AbstractKnowledgeBase";
|
|
2
20
|
export * from "./FilesKnowledgeBase";
|
|
3
21
|
export * from "./S3KnowledgeBase";
|
package/dist/knowledge/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
18
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
19
19
|
* http://github.com/fonoster/fonoster
|
|
20
20
|
*
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
1
19
|
import { Embeddings } from "@langchain/core/embeddings";
|
|
2
20
|
type KnowledgeBase = {
|
|
3
21
|
load: () => Promise<void>;
|
|
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.loadAssistantConfigFromFile = loadAssistantConfigFromFile;
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
38
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
39
39
|
* http://github.com/fonoster/fonoster
|
|
40
40
|
*
|
|
@@ -53,8 +53,8 @@ exports.loadAssistantConfigFromFile = loadAssistantConfigFromFile;
|
|
|
53
53
|
* limitations under the License.
|
|
54
54
|
*/
|
|
55
55
|
const path = __importStar(require("path"));
|
|
56
|
-
const _1 = require(".");
|
|
57
56
|
const logger_1 = require("@fonoster/logger");
|
|
57
|
+
const _1 = require(".");
|
|
58
58
|
const logger = (0, logger_1.getLogger)({ service: "autopilot", filePath: __filename });
|
|
59
59
|
function loadAssistantConfigFromFile(pathToAssistantConfig) {
|
|
60
60
|
try {
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
1
19
|
import { VoiceRequest } from "@fonoster/common";
|
|
2
20
|
import { AssistantConfig } from "./assistants";
|
|
3
21
|
declare function loadAssistantFromAPI(req: VoiceRequest, integrations: {
|
|
@@ -34,8 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.loadAssistantFromAPI = loadAssistantFromAPI;
|
|
37
|
-
|
|
38
|
-
/*
|
|
37
|
+
/**
|
|
39
38
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
40
39
|
* http://github.com/fonoster/fonoster
|
|
41
40
|
*
|
|
@@ -54,10 +53,10 @@ exports.loadAssistantFromAPI = loadAssistantFromAPI;
|
|
|
54
53
|
* limitations under the License.
|
|
55
54
|
*/
|
|
56
55
|
const common_1 = require("@fonoster/common");
|
|
56
|
+
const common_2 = require("@fonoster/common");
|
|
57
|
+
const logger_1 = require("@fonoster/logger");
|
|
57
58
|
const SDK = __importStar(require("@fonoster/sdk"));
|
|
58
59
|
const envs_1 = require("./envs");
|
|
59
|
-
const logger_1 = require("@fonoster/logger");
|
|
60
|
-
const common_2 = require("@fonoster/common");
|
|
61
60
|
const logger = (0, logger_1.getLogger)({ service: "autopilot", filePath: __filename });
|
|
62
61
|
function loadAssistantFromAPI(req,
|
|
63
62
|
// TODO: Add validation for integrations
|
|
@@ -81,12 +80,16 @@ integrations) {
|
|
|
81
80
|
.then((app) => {
|
|
82
81
|
logger.verbose(`get credentials for assistant`, {
|
|
83
82
|
appRef: req.appRef,
|
|
84
|
-
productRef: app.intelligence
|
|
83
|
+
productRef: app.intelligence.productRef
|
|
85
84
|
});
|
|
86
|
-
const credentials = (0, common_1.findIntegrationsCredentials)(integrations, app.intelligence
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
const credentials = (0, common_1.findIntegrationsCredentials)(integrations, app.intelligence.productRef);
|
|
86
|
+
resolve(common_2.assistantSchema.parse({
|
|
87
|
+
...app.intelligence.config,
|
|
88
|
+
languageModel: {
|
|
89
|
+
...app.intelligence.config.languageModel,
|
|
90
|
+
apiKey: credentials.apiKey
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
90
93
|
})
|
|
91
94
|
.catch((err) => {
|
|
92
95
|
reject(new Error(`Failed to load assistant config from API: ${err}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const appendSpeech: import("xstate").ActionFunction<import("xstate").MachineContext, import("xstate").AnyEventObject, import("xstate").EventObject,
|
|
1
|
+
export declare const appendSpeech: import("xstate").ActionFunction<import("xstate").MachineContext, import("xstate").AnyEventObject, import("xstate").EventObject, {}, import("xstate").ProvidedActor, never, never, never, never>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.appendSpeech = void 0;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
5
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/fonoster
|
|
7
7
|
*
|
|
@@ -19,8 +19,8 @@ exports.appendSpeech = void 0;
|
|
|
19
19
|
* See the License for the specific language governing permissions and
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
|
-
const xstate_1 = require("xstate");
|
|
23
22
|
const logger_1 = require("@fonoster/logger");
|
|
23
|
+
const xstate_1 = require("xstate");
|
|
24
24
|
const logger = (0, logger_1.getLogger)({ service: "autopilot", filePath: __filename });
|
|
25
25
|
exports.appendSpeech = (0, xstate_1.assign)(({ context, event }) => {
|
|
26
26
|
const speech = event.speech;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const cleanSpeech: import("xstate").ActionFunction<import("xstate").MachineContext, import("xstate").AnyEventObject, import("xstate").EventObject,
|
|
1
|
+
export declare const cleanSpeech: import("xstate").ActionFunction<import("xstate").MachineContext, import("xstate").AnyEventObject, import("xstate").EventObject, {}, import("xstate").ProvidedActor, never, never, never, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const increaseIdleTimeoutCount: import("xstate").ActionFunction<import("xstate").MachineContext, import("xstate").AnyEventObject, import("xstate").EventObject,
|
|
1
|
+
export declare const increaseIdleTimeoutCount: import("xstate").ActionFunction<import("xstate").MachineContext, import("xstate").AnyEventObject, import("xstate").EventObject, {}, import("xstate").ProvidedActor, never, never, never, never>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.increaseIdleTimeoutCount = void 0;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
5
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/fonoster
|
|
7
7
|
*
|
|
@@ -19,8 +19,8 @@ exports.increaseIdleTimeoutCount = void 0;
|
|
|
19
19
|
* See the License for the specific language governing permissions and
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
|
-
const xstate_1 = require("xstate");
|
|
23
22
|
const logger_1 = require("@fonoster/logger");
|
|
23
|
+
const xstate_1 = require("xstate");
|
|
24
24
|
const logger = (0, logger_1.getLogger)({ service: "autopilot", filePath: __filename });
|
|
25
25
|
exports.increaseIdleTimeoutCount = (0, xstate_1.assign)(({ context }) => {
|
|
26
26
|
logger.verbose("called the increaseIdleTimeoutCount action", {
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
1
19
|
export { greetUser } from "./greetUser";
|
|
2
20
|
export { goodbye } from "./goodbye";
|
|
3
21
|
export { announceSystemError } from "./announceSystemError";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resetState = exports.setSpeakingDone = exports.setSpeaking = exports.resetIdleTimeoutCount = exports.appendSpeech = exports.cleanSpeech = exports.increaseIdleTimeoutCount = exports.announceIdleTimeout = exports.interruptPlayback = exports.announceSystemError = exports.goodbye = exports.greetUser = void 0;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
5
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/fonoster
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const resetIdleTimeoutCount: import("xstate").ActionFunction<import("xstate").MachineContext, import("xstate").AnyEventObject, import("xstate").EventObject,
|
|
1
|
+
export declare const resetIdleTimeoutCount: import("xstate").ActionFunction<import("xstate").MachineContext, import("xstate").AnyEventObject, import("xstate").EventObject, {}, import("xstate").ProvidedActor, never, never, never, never>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resetIdleTimeoutCount = void 0;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
5
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/fonoster
|
|
7
7
|
*
|
|
@@ -19,8 +19,8 @@ exports.resetIdleTimeoutCount = void 0;
|
|
|
19
19
|
* See the License for the specific language governing permissions and
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
|
-
const xstate_1 = require("xstate");
|
|
23
22
|
const logger_1 = require("@fonoster/logger");
|
|
23
|
+
const xstate_1 = require("xstate");
|
|
24
24
|
const logger = (0, logger_1.getLogger)({ service: "autopilot", filePath: __filename });
|
|
25
25
|
exports.resetIdleTimeoutCount = (0, xstate_1.assign)(({ context }) => {
|
|
26
26
|
logger.verbose("called the resetIdleTimeoutCount action", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const resetState: import("xstate").ActionFunction<import("xstate").MachineContext, import("xstate").AnyEventObject, import("xstate").EventObject,
|
|
1
|
+
export declare const resetState: import("xstate").ActionFunction<import("xstate").MachineContext, import("xstate").AnyEventObject, import("xstate").EventObject, {}, import("xstate").ProvidedActor, never, never, never, never>;
|