From ce6951b21f4d470d79957a55ba0fa80cde8f2129 Mon Sep 17 00:00:00 2001
From: Sean Hatfield <seanhatfield5@gmail.com>
Date: Thu, 21 Sep 2023 12:04:17 -0700
Subject: [PATCH] Renamed all indicies to vectors to avoid confusion of vocab
 (#246)

* renamed all indicies to vectors to avoid confusion of vocab

* removing unneeded files

* changed indicies on frontend sidebar to vectors
---
 .../src/components/Sidebar/IndexCount.jsx     |  2 +-
 server/endpoints/api/system/index.js          | 22 +++++++++----------
 server/endpoints/system.js                    |  2 +-
 .../utils/vectorDbProviders/chroma/index.js   |  2 +-
 server/utils/vectorDbProviders/lance/index.js |  2 +-
 .../utils/vectorDbProviders/pinecone/index.js |  2 +-
 .../utils/vectorDbProviders/qdrant/index.js   |  2 +-
 .../utils/vectorDbProviders/weaviate/index.js |  2 +-
 8 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/frontend/src/components/Sidebar/IndexCount.jsx b/frontend/src/components/Sidebar/IndexCount.jsx
index 3565ca5f3..a31a1b72b 100644
--- a/frontend/src/components/Sidebar/IndexCount.jsx
+++ b/frontend/src/components/Sidebar/IndexCount.jsx
@@ -26,7 +26,7 @@ export default function IndexCount() {
     <div className="flex w-full items-center justify-end gap-x-2">
       <div className="flex items-center gap-x-1  px-2 rounded-full">
         <p className="text-slate-400 leading-tight text-sm">
-          {numberWithCommas(indexes)} {pluralize("index", indexes)}
+          {numberWithCommas(indexes)} {pluralize("vector", indexes)}
         </p>
       </div>
     </div>
diff --git a/server/endpoints/api/system/index.js b/server/endpoints/api/system/index.js
index dd5f59b75..3548c3068 100644
--- a/server/endpoints/api/system/index.js
+++ b/server/endpoints/api/system/index.js
@@ -8,7 +8,7 @@ function apiSystemEndpoints(app) {
   if (!app) return;
 
   app.get("/v1/system/env-dump", async (_, response) => {
-    /* 
+    /*
    #swagger.tags = ['System Settings']
    #swagger.description = 'Dump all settings to file storage'
    #swagger.responses[403] = {
@@ -29,7 +29,7 @@ function apiSystemEndpoints(app) {
   });
 
   app.get("/v1/system", [validApiKey], async (_, response) => {
-    /* 
+    /*
     #swagger.tags = ['System Settings']
     #swagger.description = 'Get all current system settings that are defined.'
     #swagger.responses[200] = {
@@ -48,9 +48,9 @@ function apiSystemEndpoints(app) {
               }
             }
           }
-        }           
+        }
       }
-    }  
+    }
     #swagger.responses[403] = {
       schema: {
         "$ref": "#/definitions/InvalidAPIKey"
@@ -67,7 +67,7 @@ function apiSystemEndpoints(app) {
   });
 
   app.get("/v1/system/vector-count", [validApiKey], async (_, response) => {
-    /* 
+    /*
     #swagger.tags = ['System Settings']
     #swagger.description = 'Number of all vectors in connected vector database'
     #swagger.responses[200] = {
@@ -79,9 +79,9 @@ function apiSystemEndpoints(app) {
              "vectorCount": 5450
             }
           }
-        }           
+        }
       }
-    }  
+    }
     #swagger.responses[403] = {
       schema: {
         "$ref": "#/definitions/InvalidAPIKey"
@@ -90,7 +90,7 @@ function apiSystemEndpoints(app) {
     */
     try {
       const VectorDb = getVectorDbClass();
-      const vectorCount = await VectorDb.totalIndicies();
+      const vectorCount = await VectorDb.totalVectors();
       response.status(200).json({ vectorCount });
     } catch (e) {
       console.log(e.message, e);
@@ -102,7 +102,7 @@ function apiSystemEndpoints(app) {
     "/v1/system/update-env",
     [validApiKey],
     async (request, response) => {
-      /* 
+      /*
       #swagger.tags = ['System Settings']
       #swagger.description = 'Update a system setting or preference.'
       #swagger.requestBody = {
@@ -128,9 +128,9 @@ function apiSystemEndpoints(app) {
                 error: 'error goes here, otherwise null'
               }
             }
-          }           
+          }
         }
-      }  
+      }
       #swagger.responses[403] = {
         schema: {
           "$ref": "#/definitions/InvalidAPIKey"
diff --git a/server/endpoints/system.js b/server/endpoints/system.js
index f7fa13cbc..5ce3a7ed6 100644
--- a/server/endpoints/system.js
+++ b/server/endpoints/system.js
@@ -166,7 +166,7 @@ function systemEndpoints(app) {
   app.get("/system/system-vectors", [validatedRequest], async (_, response) => {
     try {
       const VectorDb = getVectorDbClass();
-      const vectorCount = await VectorDb.totalIndicies();
+      const vectorCount = await VectorDb.totalVectors();
       response.status(200).json({ vectorCount });
     } catch (e) {
       console.log(e.message, e);
diff --git a/server/utils/vectorDbProviders/chroma/index.js b/server/utils/vectorDbProviders/chroma/index.js
index cff592f78..40966e5e1 100644
--- a/server/utils/vectorDbProviders/chroma/index.js
+++ b/server/utils/vectorDbProviders/chroma/index.js
@@ -26,7 +26,7 @@ const Chroma = {
     const { client } = await this.connect();
     return { heartbeat: await client.heartbeat() };
   },
-  totalIndicies: async function () {
+  totalVectors: async function () {
     const { client } = await this.connect();
     const collections = await client.listCollections();
     var totalVectors = 0;
diff --git a/server/utils/vectorDbProviders/lance/index.js b/server/utils/vectorDbProviders/lance/index.js
index 23872ad79..f87e35c34 100644
--- a/server/utils/vectorDbProviders/lance/index.js
+++ b/server/utils/vectorDbProviders/lance/index.js
@@ -28,7 +28,7 @@ const LanceDb = {
     const dirs = fs.readdirSync(client.uri);
     return dirs.map((folder) => folder.replace(".lance", ""));
   },
-  totalIndicies: async function () {
+  totalVectors: async function () {
     const { client } = await this.connect();
     const tables = await this.tables();
     let count = 0;
diff --git a/server/utils/vectorDbProviders/pinecone/index.js b/server/utils/vectorDbProviders/pinecone/index.js
index 1b523b24b..f5a4d2c76 100644
--- a/server/utils/vectorDbProviders/pinecone/index.js
+++ b/server/utils/vectorDbProviders/pinecone/index.js
@@ -24,7 +24,7 @@ const Pinecone = {
     if (!status.ready) throw new Error("Pinecode::Index not ready.");
     return { client, pineconeIndex, indexName: process.env.PINECONE_INDEX };
   },
-  totalIndicies: async function () {
+  totalVectors: async function () {
     const { pineconeIndex } = await this.connect();
     const { namespaces } = await pineconeIndex.describeIndexStats1();
     return Object.values(namespaces).reduce(
diff --git a/server/utils/vectorDbProviders/qdrant/index.js b/server/utils/vectorDbProviders/qdrant/index.js
index eb122d9d6..e61a36888 100644
--- a/server/utils/vectorDbProviders/qdrant/index.js
+++ b/server/utils/vectorDbProviders/qdrant/index.js
@@ -30,7 +30,7 @@ const QDrant = {
     await this.connect();
     return { heartbeat: Number(new Date()) };
   },
-  totalIndicies: async function () {
+  totalVectors: async function () {
     const { client } = await this.connect();
     const { collections } = await client.getCollections();
     var totalVectors = 0;
diff --git a/server/utils/vectorDbProviders/weaviate/index.js b/server/utils/vectorDbProviders/weaviate/index.js
index 99e0859fe..ea1849cba 100644
--- a/server/utils/vectorDbProviders/weaviate/index.js
+++ b/server/utils/vectorDbProviders/weaviate/index.js
@@ -32,7 +32,7 @@ const Weaviate = {
     await this.connect();
     return { heartbeat: Number(new Date()) };
   },
-  totalIndicies: async function () {
+  totalVectors: async function () {
     const { client } = await this.connect();
     const collectionNames = await this.allNamespaces(client);
     var totalVectors = 0;
-- 
GitLab