Spaces:
Sleeping
Sleeping
JayWadekar
commited on
Commit
·
d995ec7
1
Parent(s):
699fe5f
Improving RAG prompt
Browse files
rag.py
CHANGED
|
@@ -73,10 +73,13 @@ def RAG(llm, docs, embeddings):
|
|
| 73 |
# Adding custom instructions to the prompt
|
| 74 |
template = prompt.messages[0].prompt.template
|
| 75 |
template_parts = template.split("\nQuestion: {question}")
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
"
|
|
|
|
|
|
|
|
|
|
| 80 |
prompt.messages[0].prompt.template = combined_template
|
| 81 |
|
| 82 |
# Create the chain
|
|
|
|
| 73 |
# Adding custom instructions to the prompt
|
| 74 |
template = prompt.messages[0].prompt.template
|
| 75 |
template_parts = template.split("\nQuestion: {question}")
|
| 76 |
+
combined_template = "You are an assistant for question-answering tasks. "\
|
| 77 |
+
+ "Use the following pieces of retrieved context to answer the question. "\
|
| 78 |
+
+ "If you don't know the answer, just say that you don't know. "\
|
| 79 |
+
+ "Use six sentences maximum and keep the answer concise. "\
|
| 80 |
+
+ "Write the names of the relevant functions from the retrived code. "\
|
| 81 |
+
+ "Include the reference IDs in square brackets at the end of your answer."\
|
| 82 |
+
+ template_parts[1]
|
| 83 |
prompt.messages[0].prompt.template = combined_template
|
| 84 |
|
| 85 |
# Create the chain
|