sabazo commited on
Commit
42c70fb
2 Parent(s): 429c288 eb3ce64

Merge pull request #20 from almutareb/fix_fetch_s3_vs

Browse files
app_gui.py CHANGED
@@ -1,7 +1,10 @@
1
  # Import Gradio for UI, along with other necessary libraries
2
  import gradio as gr
 
3
  from rag_app.agents.react_agent import agent_executor
4
 
 
 
5
 
6
  if __name__ == "__main__":
7
 
 
1
  # Import Gradio for UI, along with other necessary libraries
2
  import gradio as gr
3
+ from rag_app.loading_data.load_S3_vector_stores import get_chroma_vs
4
  from rag_app.agents.react_agent import agent_executor
5
 
6
+ get_chroma_vs()
7
+
8
 
9
  if __name__ == "__main__":
10
 
rag_app/loading_data/load_S3_vector_stores.py CHANGED
@@ -32,7 +32,7 @@ embeddings = SentenceTransformerEmbeddings(model_name=model_name)
32
 
33
  ## FAISS
34
  def get_faiss_vs():
35
- if os.listdir(FAISS_INDEX_PATH) == 0:
36
  # Initialize an S3 client with unsigned configuration for public access
37
  s3 = boto3.client('s3', config=Config(signature_version=UNSIGNED))
38
 
@@ -56,7 +56,7 @@ def get_faiss_vs():
56
 
57
  ## Chroma DB
58
  def get_chroma_vs():
59
- if os.listdir(CHROMA_DIRECTORY) == 0:
60
  # Initialize an S3 client with unsigned configuration for public access
61
  s3 = boto3.client('s3', config=Config(signature_version=UNSIGNED))
62
 
 
32
 
33
  ## FAISS
34
  def get_faiss_vs():
35
+ if not os.path.exists(FAISS_INDEX_PATH):
36
  # Initialize an S3 client with unsigned configuration for public access
37
  s3 = boto3.client('s3', config=Config(signature_version=UNSIGNED))
38
 
 
56
 
57
  ## Chroma DB
58
  def get_chroma_vs():
59
+ if not os.path.exists(CHROMA_DIRECTORY):
60
  # Initialize an S3 client with unsigned configuration for public access
61
  s3 = boto3.client('s3', config=Config(signature_version=UNSIGNED))
62
 
rag_app/structured_tools/structured_tools.py CHANGED
@@ -23,7 +23,7 @@ import os
23
 
24
  persist_directory = os.getenv('VECTOR_DATABASE_LOCATION')
25
  embedding_model = os.getenv("EMBEDDING_MODEL")
26
- if os.listdir(persist_directory) == 0:
27
  get_chroma_vs()
28
 
29
  @tool
 
23
 
24
  persist_directory = os.getenv('VECTOR_DATABASE_LOCATION')
25
  embedding_model = os.getenv("EMBEDDING_MODEL")
26
+ if not os.path.exists(persist_directory):
27
  get_chroma_vs()
28
 
29
  @tool