From 9bea7739ed833f3002738408efd5542466c503ce Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Fri, 28 Jul 2023 12:09:49 -0700 Subject: [PATCH] move OpenAI to AiProvider folder in preparation for new AI provider support --- server/utils/{ => AiProviders}/openAi/index.js | 0 server/utils/chats/index.js | 2 +- server/utils/vectorDbProviders/chroma/index.js | 10 +++++----- server/utils/vectorDbProviders/lance/index.js | 2 +- server/utils/vectorDbProviders/pinecone/index.js | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) rename server/utils/{ => AiProviders}/openAi/index.js (100%) diff --git a/server/utils/openAi/index.js b/server/utils/AiProviders/openAi/index.js similarity index 100% rename from server/utils/openAi/index.js rename to server/utils/AiProviders/openAi/index.js diff --git a/server/utils/chats/index.js b/server/utils/chats/index.js index 5e099dad..b6f74c15 100644 --- a/server/utils/chats/index.js +++ b/server/utils/chats/index.js @@ -1,5 +1,5 @@ const { v4: uuidv4 } = require("uuid"); -const { OpenAi } = require("../openAi"); +const { OpenAi } = require("../AiProviders/openAi"); const { WorkspaceChats } = require("../../models/workspaceChats"); const { resetMemory } = require("./commands/reset"); const moment = require("moment"); diff --git a/server/utils/vectorDbProviders/chroma/index.js b/server/utils/vectorDbProviders/chroma/index.js index d66a669a..ee8ac485 100644 --- a/server/utils/vectorDbProviders/chroma/index.js +++ b/server/utils/vectorDbProviders/chroma/index.js @@ -8,7 +8,7 @@ const { storeVectorResult, cachedVectorInformation } = require("../../files"); const { v4: uuidv4 } = require("uuid"); const { toChunks } = require("../../helpers"); const { chatPrompt } = require("../../chats"); -const { OpenAi } = require("../../openAi"); +const { OpenAi } = require("../../AiProviders/openAi"); const Chroma = { name: "Chroma", @@ -324,10 +324,10 @@ const Chroma = { content: `${chatPrompt(workspace)} Context: ${contextTexts - .map((text, i) => { - return `[CONTEXT ${i}]:\n${text}\n[END CONTEXT ${i}]\n\n`; - }) - .join("")}`, + .map((text, i) => { + return `[CONTEXT ${i}]:\n${text}\n[END CONTEXT ${i}]\n\n`; + }) + .join("")}`, }; const memory = [prompt, ...chatHistory, { role: "user", content: input }]; const responseText = await openAiConnector.getChatCompletion(memory, { diff --git a/server/utils/vectorDbProviders/lance/index.js b/server/utils/vectorDbProviders/lance/index.js index 3fc0f01c..38b30af9 100644 --- a/server/utils/vectorDbProviders/lance/index.js +++ b/server/utils/vectorDbProviders/lance/index.js @@ -5,7 +5,7 @@ const { RecursiveCharacterTextSplitter } = require("langchain/text_splitter"); const { storeVectorResult, cachedVectorInformation } = require("../../files"); const { v4: uuidv4 } = require("uuid"); const { chatPrompt } = require("../../chats"); -const { OpenAi } = require("../../openAi"); +const { OpenAi } = require("../../AiProviders/openAi"); const LanceDb = { uri: `${ diff --git a/server/utils/vectorDbProviders/pinecone/index.js b/server/utils/vectorDbProviders/pinecone/index.js index a392dc40..6021cfa3 100644 --- a/server/utils/vectorDbProviders/pinecone/index.js +++ b/server/utils/vectorDbProviders/pinecone/index.js @@ -8,7 +8,7 @@ const { storeVectorResult, cachedVectorInformation } = require("../../files"); const { v4: uuidv4 } = require("uuid"); const { toChunks } = require("../../helpers"); const { chatPrompt } = require("../../chats"); -const { OpenAi } = require("../../openAi"); +const { OpenAi } = require("../../AiProviders/openAi"); const Pinecone = { name: "Pinecone",