refactoring of the format

This commit is contained in:
Marco Vinciguerra 2024-10-01 11:13:06 +02:00
parent e88fee9a2b
commit 45f02cd4e2
3 changed files with 9 additions and 4 deletions

View File

@ -67,7 +67,11 @@ class DescriptionNode(BaseNode):
temp_res = {}
for i, (summary, document) in enumerate(zip(batch_results, docs)):
temp_res[summary] = document
temp_res[summary] = {
"id": i,
"summary": summary,
"document": document
}
state["descriptions"] = temp_res

View File

@ -102,6 +102,7 @@ class GenerateAnswerNodeKLevel(BaseNode):
query_text=state["question"]
)
## TODO: from the id get the data
results_db = [elem for elem in state[answer_db]]
chains_dict = {}

View File

@ -49,13 +49,13 @@ class RAGNode(BaseNode):
else:
raise ValueError("client_type provided not correct")
docs = [elem for elem in state.get("descriptions").keys()]
metadata = []
docs = [elem.get("summary") for elem in state.get("descriptions", {})]
ids = [elem.get("id") for elem in state.get("descriptions", {})]
client.add(
collection_name="vectorial_collection",
documents=docs,
metadata=metadata,
ids=ids
)
state["vectorial_db"] = client