mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-21 06:14:37 +00:00
Prompt fix for empty intermediate steps in summarization (#660)
Adding quotation marks around {text} avoids generating empty or completely random responses from OpenAI davinci-003. Empty or completely unrelated intermediate responses in summarization messes up the final result or makes it very inaccurate. The error from OpenAI would be: "The model predicted a completion that begins with a stop sequence, resulting in no output. Consider adjusting your prompt or stop sequences." This fix corrects the prompting for summarization chain. This works on API too, the images are for demonstrative purposes. This approach can be applied to other similar prompts too. Examples: 1) Without quotation marks  2) With quotation marks 
This commit is contained in:
parent
69998b5fad
commit
65f3a341b0
@ -4,7 +4,7 @@ from langchain.prompts import PromptTemplate
|
||||
prompt_template = """Write a concise summary of the following:
|
||||
|
||||
|
||||
{text}
|
||||
"{text}"
|
||||
|
||||
|
||||
CONCISE SUMMARY:"""
|
||||
|
@ -21,7 +21,7 @@ REFINE_PROMPT = PromptTemplate(
|
||||
prompt_template = """Write a concise summary of the following:
|
||||
|
||||
|
||||
{text}
|
||||
"{text}"
|
||||
|
||||
|
||||
CONCISE SUMMARY:"""
|
||||
|
@ -4,7 +4,7 @@ from langchain.prompts import PromptTemplate
|
||||
prompt_template = """Write a concise summary of the following:
|
||||
|
||||
|
||||
{text}
|
||||
"{text}"
|
||||
|
||||
|
||||
CONCISE SUMMARY:"""
|
||||
|
Loading…
Reference in New Issue
Block a user