@fonoster/autopilot 0.12.15 → 0.13.0
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/envs.js
CHANGED
|
@@ -24,6 +24,7 @@ exports.SKIP_IDENTITY = exports.OPENAI_API_KEY = exports.INTEGRATIONS_FILE = exp
|
|
|
24
24
|
*/
|
|
25
25
|
const path_1 = require("path");
|
|
26
26
|
const common_1 = require("@fonoster/common");
|
|
27
|
+
const logger_1 = __importDefault(require("@fonoster/logger"));
|
|
27
28
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
28
29
|
const types_1 = require("./types");
|
|
29
30
|
if (process.env.NODE_ENV === "dev") {
|
|
@@ -31,7 +32,7 @@ if (process.env.NODE_ENV === "dev") {
|
|
|
31
32
|
}
|
|
32
33
|
const e = process.env;
|
|
33
34
|
exports.AWS_S3_ACCESS_KEY_ID = e.AUTOPILOT_AWS_S3_ACCESS_KEY_ID ?? "";
|
|
34
|
-
exports.AWS_S3_ENDPOINT = e.AUTOPILOT_AWS_S3_ENDPOINT
|
|
35
|
+
exports.AWS_S3_ENDPOINT = e.AUTOPILOT_AWS_S3_ENDPOINT || undefined;
|
|
35
36
|
exports.AWS_S3_REGION = e.AUTOPILOT_AWS_S3_REGION ?? "us-east-1";
|
|
36
37
|
exports.AWS_S3_SECRET_ACCESS_KEY = e.AUTOPILOT_AWS_S3_SECRET_ACCESS_KEY ?? "";
|
|
37
38
|
exports.KNOWLEDGE_BASE_ENABLED = e.AUTOPILOT_KNOWLEDGE_BASE_ENABLED === "true";
|
|
@@ -67,4 +68,8 @@ if (exports.KNOWLEDGE_BASE_ENABLED) {
|
|
|
67
68
|
"AUTOPILOT_AWS_S3_SECRET_ACCESS_KEY",
|
|
68
69
|
"AUTOPILOT_UNSTRUCTURED_API_KEY"
|
|
69
70
|
]);
|
|
71
|
+
if (!exports.AWS_S3_ENDPOINT && !exports.AWS_S3_REGION) {
|
|
72
|
+
logger_1.default.error("Knowledge base configuration error: Either AUTOPILOT_AWS_S3_ENDPOINT or AUTOPILOT_AWS_S3_REGION must be set when using AWS S3");
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
70
75
|
}
|
|
@@ -79,9 +79,14 @@ async function handleVoiceRequest(req, res) {
|
|
|
79
79
|
: await (0, loadAssistantFromAPI_1.loadAssistantFromAPI)(req, JSON.parse(fs_1.default.readFileSync(envs_1.INTEGRATIONS_FILE, "utf8")));
|
|
80
80
|
let knowledgeBase;
|
|
81
81
|
if (envs_1.KNOWLEDGE_BASE_ENABLED) {
|
|
82
|
+
const documents = assistantConfig.languageModel?.knowledgeBase?.map((doc) => doc.document);
|
|
83
|
+
logger.verbose("loading knowledge base", {
|
|
84
|
+
documents,
|
|
85
|
+
bucket: req.accessKeyId.toLowerCase()
|
|
86
|
+
});
|
|
82
87
|
knowledgeBase = new _1.S3KnowledgeBase({
|
|
83
88
|
bucket: req.accessKeyId.toLowerCase(),
|
|
84
|
-
documents
|
|
89
|
+
documents,
|
|
85
90
|
s3Config: {
|
|
86
91
|
endpoint: envs_1.AWS_S3_ENDPOINT,
|
|
87
92
|
region: envs_1.AWS_S3_REGION,
|
|
@@ -53,7 +53,7 @@ class AbstractLanguageModel {
|
|
|
53
53
|
});
|
|
54
54
|
// This handles late speech recognition
|
|
55
55
|
if (isReentry) {
|
|
56
|
-
logger.verbose("
|
|
56
|
+
logger.verbose("reentry detected, discarding last conversation turn");
|
|
57
57
|
const messages = await chatHistory.getMessages();
|
|
58
58
|
messages.pop(); // Last AI message
|
|
59
59
|
messages.pop(); // Last user message
|
|
@@ -29,7 +29,7 @@ async function sendConversationEndedEvent(eventsHook, data) {
|
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
const parsedEventsHook = common_1.eventsHookSchema.parse(eventsHook);
|
|
32
|
-
const
|
|
32
|
+
const params = {
|
|
33
33
|
eventType: common_1.EventsHookAllowedEvents.CONVERSATION_ENDED,
|
|
34
34
|
appRef,
|
|
35
35
|
sessionRef,
|
|
@@ -42,7 +42,7 @@ async function sendConversationEndedEvent(eventsHook, data) {
|
|
|
42
42
|
method: common_1.AllowedHttpMethod.POST,
|
|
43
43
|
headers: parsedEventsHook.headers,
|
|
44
44
|
waitForResponse: false,
|
|
45
|
-
|
|
45
|
+
params
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
catch (e) {
|
|
@@ -50,7 +50,7 @@ async function sendConversationEndedEvent(eventsHook, data) {
|
|
|
50
50
|
url: parsedEventsHook.url,
|
|
51
51
|
method: common_1.AllowedHttpMethod.POST,
|
|
52
52
|
waitForResponse: false,
|
|
53
|
-
|
|
53
|
+
params
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -40,9 +40,9 @@ class ToolsCatalog {
|
|
|
40
40
|
return await (0, common_1.sendHttpRequest)({
|
|
41
41
|
method: parsedTool.operation?.method ?? common_1.AllowedHttpMethod.GET,
|
|
42
42
|
url: parsedTool.operation?.url ?? "",
|
|
43
|
-
waitForResponse: parsedTool.operation?.waitForResponse
|
|
43
|
+
waitForResponse: parsedTool.operation?.waitForResponse,
|
|
44
44
|
headers: parsedTool.operation?.headers ?? {},
|
|
45
|
-
|
|
45
|
+
params: args
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
getTool(toolName) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/autopilot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Voice AI for the Fonoster platform",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/fonoster#readme",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@aws-sdk/client-s3": "^3.712.0",
|
|
36
36
|
"@dmitryrechkin/json-schema-to-zod": "^1.0.1",
|
|
37
|
-
"@fonoster/common": "^0.
|
|
38
|
-
"@fonoster/logger": "^0.
|
|
39
|
-
"@fonoster/sdk": "^0.
|
|
40
|
-
"@fonoster/types": "^0.
|
|
41
|
-
"@fonoster/voice": "^0.
|
|
37
|
+
"@fonoster/common": "^0.13.0",
|
|
38
|
+
"@fonoster/logger": "^0.13.0",
|
|
39
|
+
"@fonoster/sdk": "^0.13.0",
|
|
40
|
+
"@fonoster/types": "^0.13.0",
|
|
41
|
+
"@fonoster/voice": "^0.13.0",
|
|
42
42
|
"@langchain/anthropic": "^0.3.15",
|
|
43
43
|
"@langchain/community": "^0.3.32",
|
|
44
44
|
"@langchain/core": "^0.3.40",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"xstate": "^5.17.3",
|
|
60
60
|
"zod": "^3.23.8"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "1bbd25f403d05c2340676f8e29b9e00cd4db4bdb"
|
|
63
63
|
}
|