Skip to content

Commit cde12d8

Browse files
committed
Add logging to show which database (Oracle DB or ChromaDB) is being used for retrieval
1 parent bc2fd47 commit cde12d8

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

agentic_rag/OraDBVectorStore.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ def add_repo_chunks(self, chunks: List[Dict[str, Any]], document_id: str):
225225

226226
def query_pdf_collection(self, query: str, n_results: int = 3) -> List[Dict[str, Any]]:
227227
"""Query the PDF documents collection"""
228+
print("🔍 [Oracle DB] Querying PDF Collection")
228229
# Generate Embeddings
229230
embeddings = self.encoder.encode(query, batch_size=32, show_progress_bar=True)
230231
new_vector = array.array("f", embeddings)
@@ -250,10 +251,12 @@ def query_pdf_collection(self, query: str, n_results: int = 3) -> List[Dict[str,
250251
}
251252
formatted_results.append(result)
252253

254+
print(f"🔍 [Oracle DB] Retrieved {len(formatted_results)} chunks from PDF Collection")
253255
return formatted_results
254256

255257
def query_web_collection(self, query: str, n_results: int = 3) -> List[Dict[str, Any]]:
256258
"""Query the web documents collection"""
259+
print("🔍 [Oracle DB] Querying Web Collection")
257260
# Generate Embeddings
258261
embeddings = self.encoder.encode(query, batch_size=32, show_progress_bar=True)
259262
new_vector = array.array("f", embeddings)
@@ -279,10 +282,12 @@ def query_web_collection(self, query: str, n_results: int = 3) -> List[Dict[str,
279282
}
280283
formatted_results.append(result)
281284

285+
print(f"🔍 [Oracle DB] Retrieved {len(formatted_results)} chunks from Web Collection")
282286
return formatted_results
283287

284288
def query_general_collection(self, query: str, n_results: int = 3) -> List[Dict[str, Any]]:
285289
"""Query the general knowledge collection"""
290+
print("🔍 [Oracle DB] Querying General Knowledge Collection")
286291
# Generate Embeddings
287292
embeddings = self.encoder.encode(query, batch_size=32, show_progress_bar=True)
288293
new_vector = array.array("f", embeddings)
@@ -308,10 +313,12 @@ def query_general_collection(self, query: str, n_results: int = 3) -> List[Dict[
308313
}
309314
formatted_results.append(result)
310315

316+
print(f"🔍 [Oracle DB] Retrieved {len(formatted_results)} chunks from General Knowledge Collection")
311317
return formatted_results
312318

313319
def query_repo_collection(self, query: str, n_results: int = 3) -> List[Dict[str, Any]]:
314320
"""Query the repository documents collection"""
321+
print("🔍 [Oracle DB] Querying Repository Collection")
315322
# Generate Embeddings
316323
embeddings = self.encoder.encode(query, batch_size=32, show_progress_bar=True)
317324
new_vector = array.array("f", embeddings)
@@ -337,6 +344,7 @@ def query_repo_collection(self, query: str, n_results: int = 3) -> List[Dict[str
337344
}
338345
formatted_results.append(result)
339346

347+
print(f"🔍 [Oracle DB] Retrieved {len(formatted_results)} chunks from Repository Collection")
340348
return formatted_results
341349

342350
def get_collection_count(self, collection_name: str) -> int:

agentic_rag/local_rag_agent.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,16 @@ def _process_query_with_cot(self, query: str) -> Dict[str, Any]:
292292
try:
293293
# Get context based on collection type
294294
if self.collection == "PDF Collection":
295+
db_type = "Oracle DB" if self.use_oracle_db else "ChromaDB"
296+
print(f"🔄 Using {db_type} for retrieving PDF Collection context")
295297
context = self.vector_store.query_pdf_collection(query)
296298
elif self.collection == "Repository Collection":
299+
db_type = "Oracle DB" if self.use_oracle_db else "ChromaDB"
300+
print(f"🔄 Using {db_type} for retrieving Repository Collection context")
297301
context = self.vector_store.query_repo_collection(query)
298302
elif self.collection == "Web Knowledge Base":
303+
db_type = "Oracle DB" if self.use_oracle_db else "ChromaDB"
304+
print(f"🔄 Using {db_type} for retrieving Web Knowledge Base context")
299305
context = self.vector_store.query_web_collection(query)
300306
else:
301307
context = []
@@ -389,10 +395,16 @@ def _process_query_standard(self, query: str) -> Dict[str, Any]:
389395
try:
390396
# Get context based on collection type
391397
if self.collection == "PDF Collection":
398+
db_type = "Oracle DB" if self.use_oracle_db else "ChromaDB"
399+
print(f"🔄 Using {db_type} for retrieving PDF Collection context")
392400
context = self.vector_store.query_pdf_collection(query)
393401
elif self.collection == "Repository Collection":
402+
db_type = "Oracle DB" if self.use_oracle_db else "ChromaDB"
403+
print(f"🔄 Using {db_type} for retrieving Repository Collection context")
394404
context = self.vector_store.query_repo_collection(query)
395405
elif self.collection == "Web Knowledge Base":
406+
db_type = "Oracle DB" if self.use_oracle_db else "ChromaDB"
407+
print(f"🔄 Using {db_type} for retrieving Web Knowledge Base context")
396408
context = self.vector_store.query_web_collection(query)
397409
else:
398410
context = []

agentic_rag/store.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def add_repo_chunks(self, chunks: List[Dict[str, Any]], document_id: str):
117117

118118
def query_pdf_collection(self, query: str, n_results: int = 3) -> List[Dict[str, Any]]:
119119
"""Query the PDF documents collection"""
120+
print("📊 [ChromaDB] Querying PDF Collection")
120121
results = self.pdf_collection.query(
121122
query_texts=[query],
122123
n_results=n_results
@@ -131,10 +132,12 @@ def query_pdf_collection(self, query: str, n_results: int = 3) -> List[Dict[str,
131132
}
132133
formatted_results.append(result)
133134

135+
print(f"📊 [ChromaDB] Retrieved {len(formatted_results)} chunks from PDF Collection")
134136
return formatted_results
135137

136138
def query_web_collection(self, query: str, n_results: int = 3) -> List[Dict[str, Any]]:
137139
"""Query the web documents collection"""
140+
print("📊 [ChromaDB] Querying Web Collection")
138141
results = self.web_collection.query(
139142
query_texts=[query],
140143
n_results=n_results
@@ -149,10 +152,12 @@ def query_web_collection(self, query: str, n_results: int = 3) -> List[Dict[str,
149152
}
150153
formatted_results.append(result)
151154

155+
print(f"📊 [ChromaDB] Retrieved {len(formatted_results)} chunks from Web Collection")
152156
return formatted_results
153157

154158
def query_general_collection(self, query: str, n_results: int = 3) -> List[Dict[str, Any]]:
155159
"""Query the general knowledge collection"""
160+
print("📊 [ChromaDB] Querying General Knowledge Collection")
156161
results = self.general_collection.query(
157162
query_texts=[query],
158163
n_results=n_results
@@ -167,10 +172,12 @@ def query_general_collection(self, query: str, n_results: int = 3) -> List[Dict[
167172
}
168173
formatted_results.append(result)
169174

175+
print(f"📊 [ChromaDB] Retrieved {len(formatted_results)} chunks from General Knowledge Collection")
170176
return formatted_results
171177

172178
def query_repo_collection(self, query: str, n_results: int = 3) -> List[Dict[str, Any]]:
173179
"""Query the repository documents collection"""
180+
print("📊 [ChromaDB] Querying Repository Collection")
174181
results = self.repo_collection.query(
175182
query_texts=[query],
176183
n_results=n_results
@@ -185,6 +192,7 @@ def query_repo_collection(self, query: str, n_results: int = 3) -> List[Dict[str
185192
}
186193
formatted_results.append(result)
187194

195+
print(f"📊 [ChromaDB] Retrieved {len(formatted_results)} chunks from Repository Collection")
188196
return formatted_results
189197

190198
def main():

0 commit comments

Comments
 (0)