annas4421 commited on
Commit
fd911f4
·
verified ·
1 Parent(s): a52e98e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -15,11 +15,15 @@ import tempfile
15
  load_dotenv()
16
  api_key = os.getenv("OPENAI_API_KEY")
17
 
18
- # Custom Prompt Template
19
  custom_template = """
20
- <s>[INST] You are an Expert PDF and document assistant. Follow these instructions:
21
- 1. Greet the user and introduce yourself as a professional document assistant.
22
- 2. Answer user queries based on the document content. If a question is out of scope, politely end the conversation.
 
 
 
 
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. You should only give response or answers from the attached file. If the user input or question seems unclear you should say 'Please provide more specifics about question related to attached files'
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}