@fonoster/autopilot 0.7.36 → 0.7.37

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.
@@ -104,17 +104,17 @@ declare const languageModelConfigSchema: z.ZodObject<{
104
104
  maxTokens: z.ZodNumber;
105
105
  baseUrl: z.ZodOptional<z.ZodString>;
106
106
  knowledgeBase: z.ZodArray<z.ZodObject<{
107
- type: z.ZodEnum<["s3", "file"]>;
107
+ type: z.ZodEnum<["s3"]>;
108
108
  title: z.ZodString;
109
- url: z.ZodString;
109
+ document: z.ZodString;
110
110
  }, "strip", z.ZodTypeAny, {
111
- type: "s3" | "file";
112
- url: string;
111
+ type: "s3";
113
112
  title: string;
113
+ document: string;
114
114
  }, {
115
- type: "s3" | "file";
116
- url: string;
115
+ type: "s3";
117
116
  title: string;
117
+ document: string;
118
118
  }>, "many">;
119
119
  tools: z.ZodArray<z.ZodObject<{
120
120
  name: z.ZodString;
@@ -227,14 +227,11 @@ declare const languageModelConfigSchema: z.ZodObject<{
227
227
  requestStartMessage?: string | undefined;
228
228
  }>, "many">;
229
229
  }, "strip", z.ZodTypeAny, {
230
- provider: LANGUAGE_MODEL_PROVIDER;
231
230
  model: string;
232
- temperature: number;
233
- maxTokens: number;
234
231
  knowledgeBase: {
235
- type: "s3" | "file";
236
- url: string;
232
+ type: "s3";
237
233
  title: string;
234
+ document: string;
238
235
  }[];
239
236
  tools: {
240
237
  name: string;
@@ -256,17 +253,17 @@ declare const languageModelConfigSchema: z.ZodObject<{
256
253
  };
257
254
  requestStartMessage?: string | undefined;
258
255
  }[];
256
+ temperature: number;
257
+ maxTokens: number;
258
+ provider: LANGUAGE_MODEL_PROVIDER;
259
259
  apiKey?: string | undefined;
260
260
  baseUrl?: string | undefined;
261
261
  }, {
262
- provider: LANGUAGE_MODEL_PROVIDER;
263
262
  model: string;
264
- temperature: number;
265
- maxTokens: number;
266
263
  knowledgeBase: {
267
- type: "s3" | "file";
268
- url: string;
264
+ type: "s3";
269
265
  title: string;
266
+ document: string;
270
267
  }[];
271
268
  tools: {
272
269
  name: string;
@@ -288,6 +285,9 @@ declare const languageModelConfigSchema: z.ZodObject<{
288
285
  };
289
286
  requestStartMessage?: string | undefined;
290
287
  }[];
288
+ temperature: number;
289
+ maxTokens: number;
290
+ provider: LANGUAGE_MODEL_PROVIDER;
291
291
  apiKey?: string | undefined;
292
292
  baseUrl?: string | undefined;
293
293
  }>;
@@ -396,17 +396,17 @@ declare const assistantSchema: z.ZodObject<{
396
396
  maxTokens: z.ZodNumber;
397
397
  baseUrl: z.ZodOptional<z.ZodString>;
398
398
  knowledgeBase: z.ZodArray<z.ZodObject<{
399
- type: z.ZodEnum<["s3", "file"]>;
399
+ type: z.ZodEnum<["s3"]>;
400
400
  title: z.ZodString;
401
- url: z.ZodString;
401
+ document: z.ZodString;
402
402
  }, "strip", z.ZodTypeAny, {
403
- type: "s3" | "file";
404
- url: string;
403
+ type: "s3";
405
404
  title: string;
405
+ document: string;
406
406
  }, {
407
- type: "s3" | "file";
408
- url: string;
407
+ type: "s3";
409
408
  title: string;
409
+ document: string;
410
410
  }>, "many">;
411
411
  tools: z.ZodArray<z.ZodObject<{
412
412
  name: z.ZodString;
@@ -519,14 +519,11 @@ declare const assistantSchema: z.ZodObject<{
519
519
  requestStartMessage?: string | undefined;
520
520
  }>, "many">;
521
521
  }, "strip", z.ZodTypeAny, {
522
- provider: LANGUAGE_MODEL_PROVIDER;
523
522
  model: string;
524
- temperature: number;
525
- maxTokens: number;
526
523
  knowledgeBase: {
527
- type: "s3" | "file";
528
- url: string;
524
+ type: "s3";
529
525
  title: string;
526
+ document: string;
530
527
  }[];
531
528
  tools: {
532
529
  name: string;
@@ -548,17 +545,17 @@ declare const assistantSchema: z.ZodObject<{
548
545
  };
549
546
  requestStartMessage?: string | undefined;
550
547
  }[];
548
+ temperature: number;
549
+ maxTokens: number;
550
+ provider: LANGUAGE_MODEL_PROVIDER;
551
551
  apiKey?: string | undefined;
552
552
  baseUrl?: string | undefined;
553
553
  }, {
554
- provider: LANGUAGE_MODEL_PROVIDER;
555
554
  model: string;
556
- temperature: number;
557
- maxTokens: number;
558
555
  knowledgeBase: {
559
- type: "s3" | "file";
560
- url: string;
556
+ type: "s3";
561
557
  title: string;
558
+ document: string;
562
559
  }[];
563
560
  tools: {
564
561
  name: string;
@@ -580,6 +577,9 @@ declare const assistantSchema: z.ZodObject<{
580
577
  };
581
578
  requestStartMessage?: string | undefined;
582
579
  }[];
580
+ temperature: number;
581
+ maxTokens: number;
582
+ provider: LANGUAGE_MODEL_PROVIDER;
583
583
  apiKey?: string | undefined;
584
584
  baseUrl?: string | undefined;
585
585
  }>;
@@ -609,14 +609,11 @@ declare const assistantSchema: z.ZodObject<{
609
609
  } | undefined;
610
610
  };
611
611
  languageModel: {
612
- provider: LANGUAGE_MODEL_PROVIDER;
613
612
  model: string;
614
- temperature: number;
615
- maxTokens: number;
616
613
  knowledgeBase: {
617
- type: "s3" | "file";
618
- url: string;
614
+ type: "s3";
619
615
  title: string;
616
+ document: string;
620
617
  }[];
621
618
  tools: {
622
619
  name: string;
@@ -638,6 +635,9 @@ declare const assistantSchema: z.ZodObject<{
638
635
  };
639
636
  requestStartMessage?: string | undefined;
640
637
  }[];
638
+ temperature: number;
639
+ maxTokens: number;
640
+ provider: LANGUAGE_MODEL_PROVIDER;
641
641
  apiKey?: string | undefined;
642
642
  baseUrl?: string | undefined;
643
643
  };
@@ -667,14 +667,11 @@ declare const assistantSchema: z.ZodObject<{
667
667
  } | undefined;
668
668
  };
669
669
  languageModel: {
670
- provider: LANGUAGE_MODEL_PROVIDER;
671
670
  model: string;
672
- temperature: number;
673
- maxTokens: number;
674
671
  knowledgeBase: {
675
- type: "s3" | "file";
676
- url: string;
672
+ type: "s3";
677
673
  title: string;
674
+ document: string;
678
675
  }[];
679
676
  tools: {
680
677
  name: string;
@@ -696,6 +693,9 @@ declare const assistantSchema: z.ZodObject<{
696
693
  };
697
694
  requestStartMessage?: string | undefined;
698
695
  }[];
696
+ temperature: number;
697
+ maxTokens: number;
698
+ provider: LANGUAGE_MODEL_PROVIDER;
699
699
  apiKey?: string | undefined;
700
700
  baseUrl?: string | undefined;
701
701
  };
@@ -89,9 +89,11 @@ const languageModelConfigSchema = zod_1.z.object({
89
89
  })
90
90
  .optional(),
91
91
  knowledgeBase: zod_1.z.array(zod_1.z.object({
92
- type: zod_1.z.enum(["s3", "file"]),
92
+ type: zod_1.z.enum(["s3"]),
93
93
  title: zod_1.z.string(),
94
- url: zod_1.z.string().url({ message: common_1.Messages.VALID_URL })
94
+ document: zod_1.z.string().regex(/\.pdf$/, {
95
+ message: "Document must be a pdf file."
96
+ })
95
97
  })),
96
98
  tools: zod_1.z.array(ToolSchema_1.toolSchema)
97
99
  });
package/dist/envs.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export declare const AWS_S3_ACCESS_KEY_ID: string | undefined;
2
+ export declare const AWS_S3_ENDPOINT: string | undefined;
3
+ export declare const AWS_S3_REGION: string;
4
+ export declare const AWS_S3_SECRET_ACCESS_KEY: string | undefined;
5
+ export declare const KNOWLEDGE_BASE_ENABLED: boolean;
6
+ export declare const NODE_ENV: string;
7
+ export declare const SKIP_IDENTITY: boolean;
8
+ export declare const UNSTRUCTURED_API_KEY: string | undefined;
9
+ export declare const UNSTRUCTURED_API_URL: string;
package/dist/envs.js ADDED
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.UNSTRUCTURED_API_URL = exports.UNSTRUCTURED_API_KEY = exports.SKIP_IDENTITY = 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
+ /*
8
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
9
+ * http://github.com/fonoster/fonoster
10
+ *
11
+ * This file is part of Fonoster
12
+ *
13
+ * Licensed under the MIT License (the "License");
14
+ * you may not use this file except in compliance with
15
+ * the License. You may obtain a copy of the License at
16
+ *
17
+ * https://opensource.org/licenses/MIT
18
+ *
19
+ * Unless required by applicable law or agreed to in writing, software
20
+ * distributed under the License is distributed on an "AS IS" BASIS,
21
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ * See the License for the specific language governing permissions and
23
+ * limitations under the License.
24
+ */
25
+ const path_1 = require("path");
26
+ const common_1 = require("@fonoster/common");
27
+ const dotenv_1 = __importDefault(require("dotenv"));
28
+ if (process.env.NODE_ENV === "dev") {
29
+ dotenv_1.default.config({ path: (0, path_1.join)(__dirname, "..", "..", "..", ".env") });
30
+ }
31
+ const e = process.env;
32
+ exports.AWS_S3_ACCESS_KEY_ID = e.AWS_S3_ACCESS_KEY_ID;
33
+ exports.AWS_S3_ENDPOINT = e.AWS_S3_ENDPOINT;
34
+ exports.AWS_S3_REGION = e.AWS_S3_REGION ?? "us-east-1";
35
+ exports.AWS_S3_SECRET_ACCESS_KEY = e.AWS_S3_SECRET_ACCESS_KEY;
36
+ exports.KNOWLEDGE_BASE_ENABLED = e.KNOWLEDGE_BASE_ENABLED === "true";
37
+ exports.NODE_ENV = e.NODE_ENV || "production";
38
+ exports.SKIP_IDENTITY = e.SKIP_IDENTITY === "true";
39
+ exports.UNSTRUCTURED_API_KEY = e.UNSTRUCTURED_API_KEY;
40
+ exports.UNSTRUCTURED_API_URL = e.UNSTRUCTURED_API_URL ?? "https://api.unstructuredapp.io/general/v0/general";
41
+ if (exports.KNOWLEDGE_BASE_ENABLED) {
42
+ (0, common_1.assertEnvsAreSet)([
43
+ "AWS_S3_ACCESS_KEY_ID",
44
+ "AWS_S3_SECRET_ACCESS_KEY",
45
+ "UNSTRUCTURED_API_KEY"
46
+ ]);
47
+ }
@@ -55,20 +55,41 @@ exports.handleVoiceRequest = handleVoiceRequest;
55
55
  const common_1 = require("@fonoster/common");
56
56
  const logger_1 = require("@fonoster/logger");
57
57
  const createLanguageModel_1 = require("./createLanguageModel");
58
+ const envs_1 = require("./envs");
58
59
  const loadAssistantConfigFromFile_1 = require("./loadAssistantConfigFromFile");
59
60
  const _1 = __importStar(require("."));
60
61
  const logger = (0, logger_1.getLogger)({ service: "autopilot", filePath: __filename });
61
62
  async function handleVoiceRequest(req, res) {
62
- const { ingressNumber, sessionRef, appRef, callDirection } = req;
63
+ const { accessKeyId, ingressNumber, sessionRef, appRef, callDirection } = req;
63
64
  logger.verbose("voice request", {
65
+ accessKeyId,
64
66
  ingressNumber,
65
67
  sessionRef,
66
68
  appRef,
67
69
  metadata: req.metadata
68
70
  });
69
71
  const assistantConfig = (0, loadAssistantConfigFromFile_1.loadAssistantConfigFromFile)(`${process.cwd()}/config/assistant.json`);
70
- // const knowledgeBase = await loadKnowledgeBaseFromS3(["sample.pdf"]);
71
- const knowledgeBase = await (0, _1.loadKnowledgeBaseFromFiles)(`${process.cwd()}/config/sample.pdf`);
72
+ let knowledgeBase;
73
+ if (envs_1.KNOWLEDGE_BASE_ENABLED) {
74
+ knowledgeBase = new _1.S3KnowledgeBase({
75
+ bucket: req.accessKeyId.toLowerCase(),
76
+ documents: assistantConfig.languageModel.knowledgeBase.map((doc) => doc.document),
77
+ s3Config: {
78
+ endpoint: envs_1.AWS_S3_ENDPOINT,
79
+ region: envs_1.AWS_S3_REGION,
80
+ credentials: {
81
+ accessKeyId: envs_1.AWS_S3_ACCESS_KEY_ID,
82
+ secretAccessKey: envs_1.AWS_S3_SECRET_ACCESS_KEY
83
+ },
84
+ forcePathStyle: true
85
+ },
86
+ unstructuredAPIURL: envs_1.UNSTRUCTURED_API_URL,
87
+ unstructuredAPIKey: envs_1.UNSTRUCTURED_API_KEY
88
+ });
89
+ }
90
+ knowledgeBase?.load().then(() => {
91
+ logger.verbose("knowledge base loaded");
92
+ });
72
93
  const voice = new _1.VoiceImpl(sessionRef, res);
73
94
  const languageModel = (0, createLanguageModel_1.createLanguageModel)({
74
95
  voice,
@@ -1,9 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AbstractKnowledgeBase = 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 logger_1 = require("@fonoster/logger");
4
23
  const openai_1 = require("@langchain/openai");
5
24
  const text_splitter_1 = require("langchain/text_splitter");
6
25
  const memory_1 = require("langchain/vectorstores/memory");
26
+ const logger = (0, logger_1.getLogger)({ service: "autopilot", filePath: __filename });
7
27
  class AbstractKnowledgeBase {
8
28
  constructor(params) {
9
29
  this.embeddings = params?.embeddings || new openai_1.OpenAIEmbeddings();
@@ -19,14 +39,15 @@ class AbstractKnowledgeBase {
19
39
  chunkOverlap: 200
20
40
  });
21
41
  const splitDocs = await Promise.all(loadedDocs.map((docs) => textSplitter.splitDocuments(docs)));
22
- console.log("xxxx splitDocs", splitDocs);
23
42
  this.vectorStore = await memory_1.MemoryVectorStore.fromDocuments(splitDocs.flat(), this.embeddings);
24
43
  }
25
44
  async queryKnowledgeBase(query, k = 2) {
26
- if (!this.vectorStore) {
27
- throw new Error("Vector store is not initialized");
45
+ const { vectorStore } = this;
46
+ if (!vectorStore) {
47
+ logger.verbose("vector store is not initialized, returning empty string");
48
+ return "";
28
49
  }
29
- const results = await this.vectorStore.similaritySearch(query, k);
50
+ const results = await vectorStore.similaritySearch(query, k);
30
51
  return results.join("\n");
31
52
  }
32
53
  }
@@ -3,7 +3,6 @@ import { Embeddings } from "@langchain/core/embeddings";
3
3
  import { AbstractKnowledgeBase } from "./AbstractKnowledgeBase";
4
4
  declare class FilesKnowledgeBase extends AbstractKnowledgeBase {
5
5
  private params;
6
- files: string[];
7
6
  constructor(params: {
8
7
  embeddings?: Embeddings;
9
8
  files: string[];
@@ -25,13 +25,14 @@ class FilesKnowledgeBase extends AbstractKnowledgeBase_1.AbstractKnowledgeBase {
25
25
  constructor(params) {
26
26
  super(params);
27
27
  this.params = params;
28
- this.files = params?.files || [];
28
+ this.params = params;
29
29
  }
30
30
  async getLoaders() {
31
- if (!this.files.every((file) => file.endsWith(".pdf"))) {
31
+ const { files } = this.params;
32
+ if (!files.every((file) => file.endsWith(".pdf"))) {
32
33
  throw new Error("Only PDF files are supported");
33
34
  }
34
- return this.files.map((file) => new pdf_1.PDFLoader(file, { splitPages: false }));
35
+ return files.map((file) => new pdf_1.PDFLoader(file, { splitPages: false }));
35
36
  }
36
37
  }
37
38
  exports.FilesKnowledgeBase = FilesKnowledgeBase;
@@ -3,7 +3,6 @@ import { AbstractKnowledgeBase } from "./AbstractKnowledgeBase";
3
3
  import { S3KnowledgeBaseParams } from "./types";
4
4
  declare class S3KnowledgeBase extends AbstractKnowledgeBase {
5
5
  private params;
6
- documents: string[];
7
6
  constructor(params: S3KnowledgeBaseParams);
8
7
  getLoaders(): Promise<S3Loader[]>;
9
8
  }
@@ -28,13 +28,14 @@ class S3KnowledgeBase extends AbstractKnowledgeBase_1.AbstractKnowledgeBase {
28
28
  this.params = params;
29
29
  }
30
30
  async getLoaders() {
31
- if (!this.documents.every((file) => file.endsWith(".pdf"))) {
31
+ const { documents } = this.params;
32
+ if (!documents.every((file) => file.endsWith(".pdf"))) {
32
33
  throw new Error("Only PDF files are supported");
33
34
  }
34
- const { bucket, key, s3Config, unstructuredAPIURL, unstructuredAPIKey } = this.params;
35
- return this.documents.map(() => new s3_1.S3Loader({
35
+ const { bucket, s3Config, unstructuredAPIURL, unstructuredAPIKey } = this.params;
36
+ return documents.map((document) => new s3_1.S3Loader({
36
37
  bucket,
37
- key,
38
+ key: document,
38
39
  s3Config,
39
40
  unstructuredAPIURL,
40
41
  unstructuredAPIKey
@@ -1,6 +1,4 @@
1
1
  export * from "./AbstractKnowledgeBase";
2
2
  export * from "./FilesKnowledgeBase";
3
3
  export * from "./S3KnowledgeBase";
4
- export * from "./loadKnowledgeBaseFromFiles";
5
- export * from "./loadKnowledgeBaseFromS3";
6
4
  export * from "./types";
@@ -35,6 +35,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
35
35
  __exportStar(require("./AbstractKnowledgeBase"), exports);
36
36
  __exportStar(require("./FilesKnowledgeBase"), exports);
37
37
  __exportStar(require("./S3KnowledgeBase"), exports);
38
- __exportStar(require("./loadKnowledgeBaseFromFiles"), exports);
39
- __exportStar(require("./loadKnowledgeBaseFromS3"), exports);
40
38
  __exportStar(require("./types"), exports);
@@ -1,12 +1,12 @@
1
1
  import { Embeddings } from "@langchain/core/embeddings";
2
2
  type KnowledgeBase = {
3
+ load: () => Promise<void>;
3
4
  queryKnowledgeBase: (query: string, k?: number) => Promise<string>;
4
5
  };
5
6
  type S3KnowledgeBaseParams = {
6
7
  embeddings?: Embeddings;
7
- documents: string[];
8
8
  bucket: string;
9
- key: string;
9
+ documents: string[];
10
10
  s3Config: {
11
11
  endpoint: string;
12
12
  region: string;
@@ -6,7 +6,7 @@ function createChain(model, knowledgeBase, promptTemplate, chatHistory) {
6
6
  return runnables_1.RunnableSequence.from([
7
7
  {
8
8
  input: (input) => input.text,
9
- context: async (input) => knowledgeBase.queryKnowledgeBase(input.text),
9
+ context: async (input) => knowledgeBase?.queryKnowledgeBase(input.text),
10
10
  history: async () => chatHistory.getMessages()
11
11
  },
12
12
  promptTemplate,
package/dist/server.js CHANGED
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  * See the License for the specific language governing permissions and
20
20
  * limitations under the License.
21
21
  */
22
+ const envs_1 = require("./envs");
22
23
  const voiceServerSetup_1 = require("./voiceServerSetup");
23
- const skipIdentity = process.env.NODE_ENV === "dev" || process.env.SKIP_IDENTITY === "true";
24
+ const skipIdentity = envs_1.NODE_ENV === "dev" || envs_1.SKIP_IDENTITY;
24
25
  (0, voiceServerSetup_1.startVoiceServer)(skipIdentity);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/autopilot",
3
- "version": "0.7.36",
3
+ "version": "0.7.37",
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",
@@ -36,10 +36,10 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@aws-sdk/client-s3": "^3.701.0",
39
- "@fonoster/common": "^0.7.36",
40
- "@fonoster/logger": "^0.7.36",
41
- "@fonoster/types": "^0.7.36",
42
- "@fonoster/voice": "^0.7.36",
39
+ "@fonoster/common": "^0.7.37",
40
+ "@fonoster/logger": "^0.7.37",
41
+ "@fonoster/types": "^0.7.37",
42
+ "@fonoster/voice": "^0.7.37",
43
43
  "@langchain/community": "^0.3.16",
44
44
  "@langchain/core": "^0.3.19",
45
45
  "@langchain/groq": "^0.1.2",
@@ -57,5 +57,5 @@
57
57
  "devDependencies": {
58
58
  "typescript": "^5.5.4"
59
59
  },
60
- "gitHead": "616656596fe60b32caccad2e63f628fb35b139d0"
60
+ "gitHead": "b9696f512b3abfd6a798045b16ed9f102d58b11a"
61
61
  }
@@ -1,3 +0,0 @@
1
- import { FilesKnowledgeBase } from "..";
2
- declare function loadKnowledgeBaseFromFiles(pathToKnowledgeBase: string): Promise<FilesKnowledgeBase>;
3
- export { loadKnowledgeBaseFromFiles };
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadKnowledgeBaseFromFiles = loadKnowledgeBaseFromFiles;
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 __1 = require("..");
23
- async function loadKnowledgeBaseFromFiles(pathToKnowledgeBase) {
24
- const knowledgeBase = new __1.FilesKnowledgeBase({
25
- files: [pathToKnowledgeBase]
26
- });
27
- await knowledgeBase.load();
28
- return knowledgeBase;
29
- }
@@ -1,3 +0,0 @@
1
- import { S3KnowledgeBase, S3KnowledgeBaseParams } from ".";
2
- declare function loadKnowledgeBaseFromS3(params: S3KnowledgeBaseParams): Promise<S3KnowledgeBase>;
3
- export { loadKnowledgeBaseFromS3 };
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadKnowledgeBaseFromS3 = loadKnowledgeBaseFromS3;
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 _1 = require(".");
23
- async function loadKnowledgeBaseFromS3(params) {
24
- const knowledgeBase = new _1.S3KnowledgeBase(params);
25
- await knowledgeBase.load();
26
- return knowledgeBase;
27
- }