Skip to content

Commit 45f02cd

Browse files
committed
refactoring of the format
1 parent e88fee9 commit 45f02cd

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

scrapegraphai/nodes/description_node.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ def execute(self, state: dict) -> dict:
6767
temp_res = {}
6868

6969
for i, (summary, document) in enumerate(zip(batch_results, docs)):
70-
temp_res[summary] = document
70+
temp_res[summary] = {
71+
"id": i,
72+
"summary": summary,
73+
"document": document
74+
}
7175

7276
state["descriptions"] = temp_res
7377

scrapegraphai/nodes/generate_answer_node_k_level.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def execute(self, state: dict) -> dict:
102102
query_text=state["question"]
103103
)
104104

105+
## TODO: from the id get the data
105106
results_db = [elem for elem in state[answer_db]]
106107

107108
chains_dict = {}

scrapegraphai/nodes/rag_node.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ def execute(self, state: dict) -> dict:
4949
else:
5050
raise ValueError("client_type provided not correct")
5151

52-
docs = [elem for elem in state.get("descriptions").keys()]
53-
metadata = []
52+
docs = [elem.get("summary") for elem in state.get("descriptions", {})]
53+
ids = [elem.get("id") for elem in state.get("descriptions", {})]
5454

5555
client.add(
5656
collection_name="vectorial_collection",
5757
documents=docs,
58-
metadata=metadata,
58+
ids=ids
5959
)
6060

6161
state["vectorial_db"] = client

0 commit comments

Comments
 (0)