mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-06-28 21:01:55 +08:00
refactoring of the format
This commit is contained in:
parent
e88fee9a2b
commit
45f02cd4e2
@ -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
|
||||
|
||||
|
||||
@ -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 = {}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user