nisargvp commited on
Commit
dd99f5c
1 Parent(s): 02ba261

update vectorestore path

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -24,12 +24,9 @@ load_dotenv()
24
  """
25
  We will load our environment variables here.
26
  """
27
- try:
28
- HF_LLM_ENDPOINT = os.getenv('HF_LLM_ENDPOINT')
29
- HF_EMBED_ENDPOINT = os.getenv('HF_EMBED_ENDPOINT')
30
- HF_TOKEN = os.getenv('HF_TOKEN')
31
- except KeyError as e:
32
- raise EnvironmentError(f"Missing environment variable: {e}")
33
 
34
  # ---- GLOBAL DECLARATIONS ---- #
35
 
@@ -56,7 +53,7 @@ hf_embeddings = HuggingFaceEndpointEmbeddings(
56
  huggingfacehub_api_token=HF_TOKEN,
57
  )
58
 
59
- if os.path.exists("./data/vectorstore"):
60
  vectorstore = FAISS.load_local(
61
  "./data/vectorstore",
62
  hf_embeddings,
@@ -66,7 +63,7 @@ if os.path.exists("./data/vectorstore"):
66
  print("Loaded Vectorstore")
67
  else:
68
  print("Indexing Files")
69
- os.makedirs("./data/vectorstore", exist_ok=True)
70
  ### 4. INDEX FILES
71
  ### NOTE: REMEMBER TO BATCH THE DOCUMENTS WITH MAXIMUM BATCH SIZE = 32
72
  for i in range(0, len(split_documents), 32):
 
24
  """
25
  We will load our environment variables here.
26
  """
27
+ HF_LLM_ENDPOINT = os.environ["HF_LLM_ENDPOINT"]
28
+ HF_EMBED_ENDPOINT = os.environ["HF_EMBED_ENDPOINT"]
29
+ HF_TOKEN = os.environ["HF_TOKEN"]
 
 
 
30
 
31
  # ---- GLOBAL DECLARATIONS ---- #
32
 
 
53
  huggingfacehub_api_token=HF_TOKEN,
54
  )
55
 
56
+ if os.path.exists("./vectorstore"):
57
  vectorstore = FAISS.load_local(
58
  "./data/vectorstore",
59
  hf_embeddings,
 
63
  print("Loaded Vectorstore")
64
  else:
65
  print("Indexing Files")
66
+ os.makedirs("./vectorstore", exist_ok=True)
67
  ### 4. INDEX FILES
68
  ### NOTE: REMEMBER TO BATCH THE DOCUMENTS WITH MAXIMUM BATCH SIZE = 32
69
  for i in range(0, len(split_documents), 32):