bstraehle commited on
Commit
e946a29
·
1 Parent(s): e672c28

Update rag_llamaindex.py

Browse files
Files changed (1) hide show
  1. rag_llamaindex.py +5 -5
rag_llamaindex.py CHANGED
@@ -23,7 +23,7 @@ logging.basicConfig(stream = sys.stdout, level = logging.INFO)
23
  logging.getLogger().addHandler(logging.StreamHandler(stream = sys.stdout))
24
 
25
  class LlamaIndexRAG:
26
- def load_documents():
27
  docs = []
28
 
29
  # PDF
@@ -58,7 +58,7 @@ class LlamaIndexRAG:
58
 
59
  return docs
60
 
61
- def store_documents(config, docs):
62
  storage_context = StorageContext.from_defaults(
63
  vector_store = get_vector_store())
64
 
@@ -67,7 +67,7 @@ class LlamaIndexRAG:
67
  storage_context = storage_context
68
  )
69
 
70
- def get_vector_store():
71
  return MongoDBAtlasVectorSearch(
72
  MongoClient(MONGODB_ATLAS_CLUSTER_URI),
73
  db_name = MONGODB_DB_NAME,
@@ -75,12 +75,12 @@ class LlamaIndexRAG:
75
  index_name = MONGODB_INDEX_NAME
76
  )
77
 
78
- def rag_ingestion_llamaindex(config):
79
  docs = load_documents()
80
 
81
  store_documents(config, docs)
82
 
83
- def rag_retrieval(config, prompt):
84
  index = VectorStoreIndex.from_vector_store(
85
  vector_store = get_vector_store())
86
 
 
23
  logging.getLogger().addHandler(logging.StreamHandler(stream = sys.stdout))
24
 
25
  class LlamaIndexRAG:
26
+ def load_documents(self):
27
  docs = []
28
 
29
  # PDF
 
58
 
59
  return docs
60
 
61
+ def store_documents(self, config, docs):
62
  storage_context = StorageContext.from_defaults(
63
  vector_store = get_vector_store())
64
 
 
67
  storage_context = storage_context
68
  )
69
 
70
+ def get_vector_store(self):
71
  return MongoDBAtlasVectorSearch(
72
  MongoClient(MONGODB_ATLAS_CLUSTER_URI),
73
  db_name = MONGODB_DB_NAME,
 
75
  index_name = MONGODB_INDEX_NAME
76
  )
77
 
78
+ def ingestion(self, config):
79
  docs = load_documents()
80
 
81
  store_documents(config, docs)
82
 
83
+ def retrieval(self, config, prompt):
84
  index = VectorStoreIndex.from_vector_store(
85
  vector_store = get_vector_store())
86