mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-06-23 21:00:30 +08:00
fix: getter
This commit is contained in:
parent
36292150da
commit
67d83cff46
@ -83,35 +83,35 @@ class GenerateAnswerNode(BaseNode):
|
||||
|
||||
# Use tqdm to add progress bar
|
||||
for i, chunk in enumerate(tqdm(doc, desc="Processing chunks", disable=not self.verbose)):
|
||||
if self.node_config("schema", None) is None and len(doc) == 1:
|
||||
if self.node_config.get("schema", None) is None and len(doc) == 1:
|
||||
prompt = PromptTemplate(
|
||||
template=template_no_chunks,
|
||||
input_variables=["question"],
|
||||
partial_variables={"context": chunk.page_content,
|
||||
"format_instructions": format_instructions})
|
||||
elif self.node_config("schema", None) is not None and len(doc) == 1:
|
||||
elif self.node_config.get("schema", None) is not None and len(doc) == 1:
|
||||
prompt = PromptTemplate(
|
||||
template=template_no_chunks_with_schema,
|
||||
input_variables=["question"],
|
||||
partial_variables={"context": chunk.page_content,
|
||||
"format_instructions": format_instructions,
|
||||
"schema": self.node_config("schema", None)
|
||||
"schema": self.node_config.get("schema", None)
|
||||
})
|
||||
elif self.node_config("schema", None) is None and len(doc) > 1:
|
||||
elif self.node_config.get("schema", None) is None and len(doc) > 1:
|
||||
prompt = PromptTemplate(
|
||||
template=template_chunks,
|
||||
input_variables=["question"],
|
||||
partial_variables={"context": chunk.page_content,
|
||||
"chunk_id": i + 1,
|
||||
"format_instructions": format_instructions})
|
||||
elif self.node_config("schema", None) is not None and len(doc) > 1:
|
||||
elif self.node_config.get("schema", None) is not None and len(doc) > 1:
|
||||
prompt = PromptTemplate(
|
||||
template=template_chunks_with_schema,
|
||||
input_variables=["question"],
|
||||
partial_variables={"context": chunk.page_content,
|
||||
"chunk_id": i + 1,
|
||||
"format_instructions": format_instructions,
|
||||
"schema": self.node_config("schema", None)})
|
||||
"schema": self.node_config.get("schema", None)})
|
||||
|
||||
# Dynamically name the chains based on their index
|
||||
chain_name = f"chunk{i+1}"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user