Skip to content

Commit 67d83cf

Browse files
committed
fix: getter
1 parent 3629215 commit 67d83cf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

scrapegraphai/nodes/generate_answer_node.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,35 +83,35 @@ def execute(self, state: dict) -> dict:
8383

8484
# Use tqdm to add progress bar
8585
for i, chunk in enumerate(tqdm(doc, desc="Processing chunks", disable=not self.verbose)):
86-
if self.node_config("schema", None) is None and len(doc) == 1:
86+
if self.node_config.get("schema", None) is None and len(doc) == 1:
8787
prompt = PromptTemplate(
8888
template=template_no_chunks,
8989
input_variables=["question"],
9090
partial_variables={"context": chunk.page_content,
9191
"format_instructions": format_instructions})
92-
elif self.node_config("schema", None) is not None and len(doc) == 1:
92+
elif self.node_config.get("schema", None) is not None and len(doc) == 1:
9393
prompt = PromptTemplate(
9494
template=template_no_chunks_with_schema,
9595
input_variables=["question"],
9696
partial_variables={"context": chunk.page_content,
9797
"format_instructions": format_instructions,
98-
"schema": self.node_config("schema", None)
98+
"schema": self.node_config.get("schema", None)
9999
})
100-
elif self.node_config("schema", None) is None and len(doc) > 1:
100+
elif self.node_config.get("schema", None) is None and len(doc) > 1:
101101
prompt = PromptTemplate(
102102
template=template_chunks,
103103
input_variables=["question"],
104104
partial_variables={"context": chunk.page_content,
105105
"chunk_id": i + 1,
106106
"format_instructions": format_instructions})
107-
elif self.node_config("schema", None) is not None and len(doc) > 1:
107+
elif self.node_config.get("schema", None) is not None and len(doc) > 1:
108108
prompt = PromptTemplate(
109109
template=template_chunks_with_schema,
110110
input_variables=["question"],
111111
partial_variables={"context": chunk.page_content,
112112
"chunk_id": i + 1,
113113
"format_instructions": format_instructions,
114-
"schema": self.node_config("schema", None)})
114+
"schema": self.node_config.get("schema", None)})
115115

116116
# Dynamically name the chains based on their index
117117
chain_name = f"chunk{i+1}"

0 commit comments

Comments
 (0)