99from tqdm import tqdm
1010from ..utils .logging import get_logger
1111from .base_node import BaseNode
12- from ..prompts .generate_answer_node_csv_prompts import TEMPLATE_CHUKS_CSV , TEMPLATE_NO_CHUKS_CSV , TEMPLATE_MERGE_CSV
12+ from ..prompts .generate_answer_node_csv_prompts import (TEMPLATE_CHUKS_CSV ,
13+ TEMPLATE_NO_CHUKS_CSV , TEMPLATE_MERGE_CSV )
1314
1415class GenerateAnswerCSVNode (BaseNode ):
1516 """
@@ -95,22 +96,22 @@ def execute(self, state):
9596 else :
9697 output_parser = JsonOutputParser ()
9798
98- TEMPLATE_NO_CHUKS_CSV_prompt = TEMPLATE_NO_CHUKS_CSV
99- TEMPLATE_CHUKS_CSV_prompt = TEMPLATE_CHUKS_CSV
100- TEMPLATE_MERGE_CSV_prompt = TEMPLATE_MERGE_CSV
99+ TEMPLATE_NO_CHUKS_CSV_PROMPT = TEMPLATE_NO_CHUKS_CSV
100+ TEMPLATE_CHUKS_CSV_PROMPT = TEMPLATE_CHUKS_CSV
101+ TEMPLATE_MERGE_CSV_PROMPT = TEMPLATE_MERGE_CSV
101102
102103 if self .additional_info is not None :
103- TEMPLATE_NO_CHUKS_CSV_prompt = self .additional_info + TEMPLATE_NO_CHUKS_CSV
104- TEMPLATE_CHUKS_CSV_prompt = self .additional_info + TEMPLATE_CHUKS_CSV
105- TEMPLATE_MERGE_CSV_prompt = self .additional_info + TEMPLATE_MERGE_CSV
104+ TEMPLATE_NO_CHUKS_CSV_PROMPT = self .additional_info + TEMPLATE_NO_CHUKS_CSV
105+ TEMPLATE_CHUKS_CSV_PROMPT = self .additional_info + TEMPLATE_CHUKS_CSV
106+ TEMPLATE_MERGE_CSV_PROMPT = self .additional_info + TEMPLATE_MERGE_CSV
106107
107108 format_instructions = output_parser .get_format_instructions ()
108109
109110 chains_dict = {}
110111
111112 if len (doc ) == 1 :
112113 prompt = PromptTemplate (
113- template = TEMPLATE_NO_CHUKS_CSV_prompt ,
114+ template = TEMPLATE_NO_CHUKS_CSV_PROMPT ,
114115 input_variables = ["question" ],
115116 partial_variables = {
116117 "context" : doc ,
@@ -127,7 +128,7 @@ def execute(self, state):
127128 tqdm (doc , desc = "Processing chunks" , disable = not self .verbose )
128129 ):
129130 prompt = PromptTemplate (
130- template = TEMPLATE_CHUKS_CSV_prompt ,
131+ template = TEMPLATE_CHUKS_CSV_PROMPT ,
131132 input_variables = ["question" ],
132133 partial_variables = {
133134 "context" : chunk ,
@@ -144,7 +145,7 @@ def execute(self, state):
144145 batch_results = async_runner .invoke ({"question" : user_prompt })
145146
146147 merge_prompt = PromptTemplate (
147- template = TEMPLATE_MERGE_CSV_prompt ,
148+ template = TEMPLATE_MERGE_CSV_PROMPT ,
148149 input_variables = ["context" , "question" ],
149150 partial_variables = {"format_instructions" : format_instructions },
150151 )
@@ -153,4 +154,4 @@ def execute(self, state):
153154 answer = merge_chain .invoke ({"context" : batch_results , "question" : user_prompt })
154155
155156 state .update ({self .output [0 ]: answer })
156- return state
157+ return state
0 commit comments