From 3d40de75c55ad9f2a1b0b1a59b8d7cf43f6694f8 Mon Sep 17 00:00:00 2001 From: Roman Shaptala Date: Fri, 22 Sep 2023 11:04:28 -0400 Subject: [PATCH] Fix default refine prompt template bug (#10928) **Description:** Default refine template does not actually use the refine template defined above, it uses a string with the variable name. @baskaryan, @eyurtsev, @hwchase17 --- .../langchain/chains/question_answering/refine_prompts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langchain/langchain/chains/question_answering/refine_prompts.py b/libs/langchain/langchain/chains/question_answering/refine_prompts.py index bec5fa4f57..d375b948e4 100644 --- a/libs/langchain/langchain/chains/question_answering/refine_prompts.py +++ b/libs/langchain/langchain/chains/question_answering/refine_prompts.py @@ -33,7 +33,7 @@ refine_template = ( "If the context isn't useful, return the original answer." ) CHAT_REFINE_PROMPT = ChatPromptTemplate.from_messages( - [("human", "{question}"), ("ai", "{existing_answer}"), ("human", "refine_template")] + [("human", "{question}"), ("ai", "{existing_answer}"), ("human", refine_template)] ) REFINE_PROMPT_SELECTOR = ConditionalPromptSelector( default_prompt=DEFAULT_REFINE_PROMPT,