From 1f683582c0f6c9f940b1f99a93f065119fe244c0 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 20 Feb 2023 11:25:39 +0000 Subject: [PATCH] fix formatting --- application/app.py | 4 ++-- application/combine_prompt.txt | 4 ++-- application/combine_prompt_hist.txt | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/application/app.py b/application/app.py index a241183..b6360ae 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 ced95a8..5eaccb7 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 a98bf6a..be75ea1 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