input_variables
sequence
output_parser
null
template
stringclasses
1 value
template_format
stringclasses
1 value
[ "question", "existing_answer", "context_str" ]
null
The original question is as follows: {question}\nWe have provided an existing answer: {existing_answer}\nWe have the opportunity to refine the existing answer(only if needed) with some more context below.\n------------\n{context_str}\n------------\nGiven the new context, refine the original answer to better answer the question. If the context isn't useful, return the original answer.
f-string

Description of QA Refine

Prompts designed to be used to refine original answers during question answering chains using the refine method.

Inputs

This is a description of the inputs that the prompt expects.

  1. question: Original question to be answered.
  2. existing_answer: Existing answer from previous documents.
  3. context_str: New piece of context to use to refine the existing answer.

Usage

Below is a code snippet for how to use the prompt.

from langchain.prompts import load_prompt
from langchain.chains.question_answering import load_qa_chain

llm = ...
prompt = load_prompt('lc://prompts/qa/refine/<file-name>')
chain = load_qa_chain(llm, chain_type="refine", refine_prompt=prompt)
Downloads last month
43