diff --git a/application/app.py b/application/app.py index a241183a..b6360aee 100644 --- a/application/app.py +++ b/application/app.py @@ -107,9 +107,9 @@ def api_answer(): if history: history = json.loads(history) template_temp = template_hist.replace("{historyquestion}", history[0]).replace("{historyanswer}", history[1]) - c_prompt = PromptTemplate(input_variables=["summaries", "question"], template=template_temp) + c_prompt = PromptTemplate(input_variables=["summaries", "question"], template=template_temp, template_format="jinja2") else: - c_prompt = PromptTemplate(input_variables=["summaries", "question"], template=template) + c_prompt = PromptTemplate(input_variables=["summaries", "question"], template=template, template_format="jinja2") if llm_choice == "openai": llm = OpenAI(openai_api_key=api_key, temperature=0) diff --git a/application/combine_prompt.txt b/application/combine_prompt.txt index ced95a82..5eaccb70 100644 --- a/application/combine_prompt.txt +++ b/application/combine_prompt.txt @@ -20,8 +20,8 @@ Source: 0-pl FINAL ANSWER: You can't eat vegetables using pandas. You can only eat them using your mouth. SOURCES: -QUESTION: {question} +QUESTION: {{ question }} ========= -{summaries} +{{ summaries }} ========= FINAL ANSWER: \ No newline at end of file diff --git a/application/combine_prompt_hist.txt b/application/combine_prompt_hist.txt index a98bf6ab..be75ea1c 100644 --- a/application/combine_prompt_hist.txt +++ b/application/combine_prompt_hist.txt @@ -12,16 +12,16 @@ Source: 30-pl FINAL ANSWER: To merge two tables in pandas, you can use the pd.merge() function. The basic syntax is: \n\npd.merge(left, right, on, how) \n\nwhere left and right are the two tables to merge, on is the column to merge on, and how is the type of merge to perform. \n\nFor example, to merge the two tables df1 and df2 on the column 'id', you can use: \n\npd.merge(df1, df2, on='id', how='inner') SOURCES: 28-pl 30-pl -QUESTION: {historyquestion} +QUESTION: {{ historyquestion }} ========= CONTENT: SOURCE: ========= -FINAL ANSWER: {historyanswer} +FINAL ANSWER: {{ historyanswer }} SOURCES: -QUESTION: {question} +QUESTION: {{ question }} ========= -{summaries} +{{ summaries }} ========= FINAL ANSWER: \ No newline at end of file