osanseviero commited on
Commit
8fb8b32
1 Parent(s): c0e384e

Upload with huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +32 -0
  2. prompt.json +10 -0
README.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+ tags:
4
+ - langchain
5
+ - prompt
6
+ ---
7
+
8
+ # Description of QA Refine
9
+
10
+ Prompts designed to be used to refine original answers during question answering chains using the refine method.
11
+
12
+ ## Inputs
13
+
14
+ This is a description of the inputs that the prompt expects.
15
+
16
+ 1. question: Original question to be answered.
17
+ 2. existing_answer: Existing answer from previous documents.
18
+ 3. context_str: New piece of context to use to refine the existing answer.
19
+
20
+ ## Usage
21
+
22
+ Below is a code snippet for how to use the prompt.
23
+
24
+ ```python
25
+ from langchain.prompts import load_prompt
26
+ from langchain.chains.question_answering import load_qa_chain
27
+
28
+ llm = ...
29
+ prompt = load_prompt('lc://prompts/qa/refine/<file-name>')
30
+ chain = load_qa_chain(llm, chain_type="refine", refine_prompt=prompt)
31
+ ```
32
+
prompt.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "input_variables": [
3
+ "question",
4
+ "existing_answer",
5
+ "context_str"
6
+ ],
7
+ "output_parser": null,
8
+ "template": "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.",
9
+ "template_format": "f-string"
10
+ }