From a87978d1d986f98ec9b2ec40174b35ee805485a1 Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Mon, 13 May 2024 12:22:53 -0700 Subject: [PATCH] Make LanceDB the vector database default provider in backend to prevent issues where somehow this key is not set by the user resulting in a Pinecone error even though they never said they wanted Pinecone to be their vector db --- frontend/src/pages/GeneralSettings/PrivacyAndData/index.jsx | 2 +- .../src/pages/OnboardingFlow/Steps/DataHandling/index.jsx | 2 +- server/endpoints/api/workspace/index.js | 6 +++--- server/endpoints/chat.js | 4 ++-- server/endpoints/embed/index.js | 2 +- server/endpoints/workspaceThreads.js | 2 +- server/endpoints/workspaces.js | 2 +- server/models/documents.js | 4 ++-- server/utils/helpers/index.js | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/frontend/src/pages/GeneralSettings/PrivacyAndData/index.jsx b/frontend/src/pages/GeneralSettings/PrivacyAndData/index.jsx index 4075c89a..28347089 100644 --- a/frontend/src/pages/GeneralSettings/PrivacyAndData/index.jsx +++ b/frontend/src/pages/GeneralSettings/PrivacyAndData/index.jsx @@ -64,7 +64,7 @@ export default function PrivacyAndDataHandling() { function ThirdParty({ settings }) { const llmChoice = settings?.LLMProvider || "openai"; const embeddingEngine = settings?.EmbeddingEngine || "openai"; - const vectorDb = settings?.VectorDB || "pinecone"; + const vectorDb = settings?.VectorDB || "lancedb"; return (
diff --git a/frontend/src/pages/OnboardingFlow/Steps/DataHandling/index.jsx b/frontend/src/pages/OnboardingFlow/Steps/DataHandling/index.jsx index 3c9eecd6..5c6b3798 100644 --- a/frontend/src/pages/OnboardingFlow/Steps/DataHandling/index.jsx +++ b/frontend/src/pages/OnboardingFlow/Steps/DataHandling/index.jsx @@ -299,7 +299,7 @@ export default function DataHandling({ setHeader, setForwardBtn, setBackBtn }) { async function fetchKeys() { const _settings = await System.keys(); setLLMChoice(_settings?.LLMProvider || "openai"); - setVectorDb(_settings?.VectorDB || "pinecone"); + setVectorDb(_settings?.VectorDB || "lancedb"); setEmbeddingEngine(_settings?.EmbeddingEngine || "openai"); setLoading(false); diff --git a/server/endpoints/api/workspace/index.js b/server/endpoints/api/workspace/index.js index fbfdde88..9dd3fce7 100644 --- a/server/endpoints/api/workspace/index.js +++ b/server/endpoints/api/workspace/index.js @@ -72,7 +72,7 @@ function apiWorkspaceEndpoints(app) { multiUserMode: multiUserMode(response), LLMSelection: process.env.LLM_PROVIDER || "openai", Embedder: process.env.EMBEDDING_ENGINE || "inherit", - VectorDbSelection: process.env.VECTOR_DB || "pinecone", + VectorDbSelection: process.env.VECTOR_DB || "lancedb", }); await EventLogs.logEvent("api_workspace_created", { workspaceName: workspace?.name || "Unknown Workspace", @@ -525,7 +525,7 @@ function apiWorkspaceEndpoints(app) { await Telemetry.sendTelemetry("sent_chat", { LLMSelection: process.env.LLM_PROVIDER || "openai", Embedder: process.env.EMBEDDING_ENGINE || "inherit", - VectorDbSelection: process.env.VECTOR_DB || "pinecone", + VectorDbSelection: process.env.VECTOR_DB || "lancedb", }); await EventLogs.logEvent("api_sent_chat", { workspaceName: workspace?.name, @@ -647,7 +647,7 @@ function apiWorkspaceEndpoints(app) { await Telemetry.sendTelemetry("sent_chat", { LLMSelection: process.env.LLM_PROVIDER || "openai", Embedder: process.env.EMBEDDING_ENGINE || "inherit", - VectorDbSelection: process.env.VECTOR_DB || "pinecone", + VectorDbSelection: process.env.VECTOR_DB || "lancedb", }); await EventLogs.logEvent("api_sent_chat", { workspaceName: workspace?.name, diff --git a/server/endpoints/chat.js b/server/endpoints/chat.js index a08b36e2..7445c213 100644 --- a/server/endpoints/chat.js +++ b/server/endpoints/chat.js @@ -92,7 +92,7 @@ function chatEndpoints(app) { multiUserMode: multiUserMode(response), LLMSelection: process.env.LLM_PROVIDER || "openai", Embedder: process.env.EMBEDDING_ENGINE || "inherit", - VectorDbSelection: process.env.VECTOR_DB || "pinecone", + VectorDbSelection: process.env.VECTOR_DB || "lancedb", }); await EventLogs.logEvent( @@ -200,7 +200,7 @@ function chatEndpoints(app) { multiUserMode: multiUserMode(response), LLMSelection: process.env.LLM_PROVIDER || "openai", Embedder: process.env.EMBEDDING_ENGINE || "inherit", - VectorDbSelection: process.env.VECTOR_DB || "pinecone", + VectorDbSelection: process.env.VECTOR_DB || "lancedb", }); await EventLogs.logEvent( diff --git a/server/endpoints/embed/index.js b/server/endpoints/embed/index.js index 0631a655..532b3618 100644 --- a/server/endpoints/embed/index.js +++ b/server/endpoints/embed/index.js @@ -46,7 +46,7 @@ function embeddedEndpoints(app) { multiUserMode: multiUserMode(response), LLMSelection: process.env.LLM_PROVIDER || "openai", Embedder: process.env.EMBEDDING_ENGINE || "inherit", - VectorDbSelection: process.env.VECTOR_DB || "pinecone", + VectorDbSelection: process.env.VECTOR_DB || "lancedb", }); response.end(); } catch (e) { diff --git a/server/endpoints/workspaceThreads.js b/server/endpoints/workspaceThreads.js index 05b584af..e2aead97 100644 --- a/server/endpoints/workspaceThreads.js +++ b/server/endpoints/workspaceThreads.js @@ -34,7 +34,7 @@ function workspaceThreadEndpoints(app) { multiUserMode: multiUserMode(response), LLMSelection: process.env.LLM_PROVIDER || "openai", Embedder: process.env.EMBEDDING_ENGINE || "inherit", - VectorDbSelection: process.env.VECTOR_DB || "pinecone", + VectorDbSelection: process.env.VECTOR_DB || "lancedb", }, user?.id ); diff --git a/server/endpoints/workspaces.js b/server/endpoints/workspaces.js index f85c213f..c22c679a 100644 --- a/server/endpoints/workspaces.js +++ b/server/endpoints/workspaces.js @@ -45,7 +45,7 @@ function workspaceEndpoints(app) { multiUserMode: multiUserMode(response), LLMSelection: process.env.LLM_PROVIDER || "openai", Embedder: process.env.EMBEDDING_ENGINE || "inherit", - VectorDbSelection: process.env.VECTOR_DB || "pinecone", + VectorDbSelection: process.env.VECTOR_DB || "lancedb", }, user?.id ); diff --git a/server/models/documents.js b/server/models/documents.js index 1c2d1711..6c09651c 100644 --- a/server/models/documents.js +++ b/server/models/documents.js @@ -114,7 +114,7 @@ const Document = { await Telemetry.sendTelemetry("documents_embedded_in_workspace", { LLMSelection: process.env.LLM_PROVIDER || "openai", Embedder: process.env.EMBEDDING_ENGINE || "inherit", - VectorDbSelection: process.env.VECTOR_DB || "pinecone", + VectorDbSelection: process.env.VECTOR_DB || "lancedb", }); await EventLogs.logEvent( "workspace_documents_added", @@ -157,7 +157,7 @@ const Document = { await Telemetry.sendTelemetry("documents_removed_in_workspace", { LLMSelection: process.env.LLM_PROVIDER || "openai", Embedder: process.env.EMBEDDING_ENGINE || "inherit", - VectorDbSelection: process.env.VECTOR_DB || "pinecone", + VectorDbSelection: process.env.VECTOR_DB || "lancedb", }); await EventLogs.logEvent( "workspace_documents_removed", diff --git a/server/utils/helpers/index.js b/server/utils/helpers/index.js index 514d3204..72fbfc6e 100644 --- a/server/utils/helpers/index.js +++ b/server/utils/helpers/index.js @@ -1,5 +1,5 @@ function getVectorDbClass() { - const vectorSelection = process.env.VECTOR_DB || "pinecone"; + const vectorSelection = process.env.VECTOR_DB || "lancedb"; switch (vectorSelection) { case "pinecone": const { Pinecone } = require("../vectorDbProviders/pinecone");