From 2b73b90c153fbc00a9b908a75f8f0e86d539addd Mon Sep 17 00:00:00 2001 From: Phil Leggetter Date: Thu, 19 Sep 2024 17:11:03 +0100 Subject: [PATCH] chore: update vector index script to use config --- create-vector-index.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/create-vector-index.py b/create-vector-index.py index cc9530f..f36bdbc 100644 --- a/create-vector-index.py +++ b/create-vector-index.py @@ -1,13 +1,8 @@ # Inspiration https://www.mongodb.com/developer/products/atlas/how-use-cohere-embeddings-rerank-modules-mongodb-atlas/#programmatically-create-vector-search-and-full-text-search-index +from config import Config from lib.mongo import get_mongo_client from pymongo.operations import SearchIndexModel -from dotenv import load_dotenv - -load_dotenv() - -DB_NAME = "iaat" -COLLECTION_NAME = "assets" # Connect to your Atlas deployment client = get_mongo_client() @@ -15,8 +10,8 @@ raise Exception("Failed to connect to MongoDB") # Access your database and collection -database = client[DB_NAME] -collection = database[COLLECTION_NAME] +database = client[Config.DB_NAME] +collection = database[Config.COLLECTION_NAME] # Create your index model, then create the search index search_index_model = SearchIndexModel(