Merge branch 'dev' into dev

This commit is contained in:
Timothy Jaeryang Baek
2024-10-17 13:25:39 -07:00
committed by GitHub
89 changed files with 3413 additions and 1183 deletions

View File

@@ -709,8 +709,8 @@ def save_docs_to_vector_db(
if overwrite:
VECTOR_DB_CLIENT.delete_collection(collection_name=collection_name)
log.info(f"deleting existing collection {collection_name}")
if add is False:
elif add is False:
log.info(f"collection {collection_name} already exists, overwrite is False and add is False")
return True
log.info(f"adding to collection {collection_name}")

View File

@@ -385,6 +385,8 @@ def get_rag_context(
extracted_collections.extend(collection_names)
if context:
if "data" in file:
del file["data"]
relevant_contexts.append({**context, "file": file})
contexts = []
@@ -401,11 +403,8 @@ def get_rag_context(
]
)
)
contexts.append(
(", ".join(file_names) + ":\n\n")
if file_names
else ""
((", ".join(file_names) + ":\n\n") if file_names else "")
+ "\n\n".join(
[text for text in context["documents"][0] if text is not None]
)
@@ -423,7 +422,9 @@ def get_rag_context(
except Exception as e:
log.exception(e)
print(contexts, citations)
print("contexts", contexts)
print("citations", citations)
return contexts, citations