Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,11 +15,15 @@ import tempfile
|
|
15 |
load_dotenv()
|
16 |
api_key = os.getenv("OPENAI_API_KEY")
|
17 |
|
18 |
-
# Custom
|
19 |
custom_template = """
|
20 |
-
<s>[INST]
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
23 |
CHAT HISTORY: {chat_history}
|
24 |
QUESTION: {question}
|
25 |
ANSWER:
|
@@ -28,7 +32,7 @@ ANSWER:
|
|
28 |
CUSTOM_QUESTION_PROMPT = PromptTemplate.from_template(custom_template)
|
29 |
|
30 |
prompt_template = """<s>[INST]
|
31 |
-
You will answer from the provided files stored in knowledge base
|
32 |
CONTEXT: {context}
|
33 |
CHAT HISTORY: {chat_history}
|
34 |
QUESTION: {question}
|
|
|
15 |
load_dotenv()
|
16 |
api_key = os.getenv("OPENAI_API_KEY")
|
17 |
|
18 |
+
# Custom template to guide LLM model
|
19 |
custom_template = """
|
20 |
+
<s>[INST]You will start the conversation by greeting the user and introducing yourself as an Expert PDF documents analyze and assistant,
|
21 |
+
stating your availability for assistance. Your next step will depend on the user's response.
|
22 |
+
If the user expresses a need for assistance in pdf or document or txt or csv, you will ask them to describe their question.
|
23 |
+
However, if the user asks questions out of context from the knowledge base, you will immediately thank them and
|
24 |
+
say goodbye, ending the conversation. Remember to base your responses on the user's needs, providing accurate and
|
25 |
+
concise information regarding the data within the knowledge base. Your interactions should be professional and
|
26 |
+
focused, ensuring the user's queries are addressed efficiently without deviating from the set flows.
|
27 |
CHAT HISTORY: {chat_history}
|
28 |
QUESTION: {question}
|
29 |
ANSWER:
|
|
|
32 |
CUSTOM_QUESTION_PROMPT = PromptTemplate.from_template(custom_template)
|
33 |
|
34 |
prompt_template = """<s>[INST]
|
35 |
+
You will answer from the provided files stored in knowledge base
|
36 |
CONTEXT: {context}
|
37 |
CHAT HISTORY: {chat_history}
|
38 |
QUESTION: {question}
|