Spaces:
Sleeping
Sleeping
seperated template from app.py
Browse files- app.py +3 -16
- prompt_template.py +15 -0
app.py
CHANGED
@@ -27,6 +27,8 @@ import dotenv
|
|
27 |
|
28 |
import os
|
29 |
|
|
|
|
|
30 |
dotenv.load_dotenv()
|
31 |
|
32 |
|
@@ -86,22 +88,7 @@ def pdf_changes(pdf_doc):
|
|
86 |
# PROMPT = PromptTemplate(
|
87 |
# template=prompt_template, input_variables=["context", "question"]
|
88 |
# )
|
89 |
-
|
90 |
-
template = """
|
91 |
-
You are the friendly documentation buddy Arti, who helps the Human in using RAY, the open-source unified framework for scaling AI and Python applications.\
|
92 |
-
Use the following context (delimited by <ctx></ctx>) and the chat history (delimited by <hs></hs>) to answer the question :
|
93 |
-
------
|
94 |
-
<ctx>
|
95 |
-
{context}
|
96 |
-
</ctx>
|
97 |
-
------
|
98 |
-
<hs>
|
99 |
-
{history}
|
100 |
-
</hs>
|
101 |
-
------
|
102 |
-
{question}
|
103 |
-
Answer:
|
104 |
-
"""
|
105 |
prompt = PromptTemplate(input_variables=["chat_history", "human_input", "context"], template=template)
|
106 |
chain_type_kwargs = {"prompt": prompt}
|
107 |
global qa
|
|
|
27 |
|
28 |
import os
|
29 |
|
30 |
+
from prompt_template import template
|
31 |
+
|
32 |
dotenv.load_dotenv()
|
33 |
|
34 |
|
|
|
88 |
# PROMPT = PromptTemplate(
|
89 |
# template=prompt_template, input_variables=["context", "question"]
|
90 |
# )
|
91 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
prompt = PromptTemplate(input_variables=["chat_history", "human_input", "context"], template=template)
|
93 |
chain_type_kwargs = {"prompt": prompt}
|
94 |
global qa
|
prompt_template.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
template = """
|
2 |
+
You are the friendly documentation buddy Arti, who helps the Human in using RAY, the open-source unified framework for scaling AI and Python applications.\
|
3 |
+
Use the following context (delimited by <ctx></ctx>) and the chat history (delimited by <hs></hs>) to answer the question :
|
4 |
+
------
|
5 |
+
<ctx>
|
6 |
+
{context}
|
7 |
+
</ctx>
|
8 |
+
------
|
9 |
+
<hs>
|
10 |
+
{history}
|
11 |
+
</hs>
|
12 |
+
------
|
13 |
+
{question}
|
14 |
+
Answer:
|
15 |
+
"""
|