Update app.py
Browse files
app.py
CHANGED
@@ -120,30 +120,32 @@ llm = ChatOpenAI(
|
|
120 |
)
|
121 |
|
122 |
template = """
|
123 |
-
You are a
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
|
|
|
|
143 |
Previous Conversation: {chat_history}
|
144 |
Retrieved Context: {context}
|
145 |
Current Question: {question}
|
146 |
-
Answer:
|
147 |
"""
|
148 |
|
149 |
prompt = ChatPromptTemplate.from_template(template)
|
@@ -229,9 +231,9 @@ def clear_chat():
|
|
229 |
# Gradio Interface
|
230 |
with gr.Blocks(theme='Hev832/Applio') as iface:
|
231 |
gr.Image("Image.jpg", width=750, height=300, show_label=False, show_download_button=False)
|
232 |
-
gr.Markdown("# Mawared HR Assistant
|
233 |
gr.Markdown('### Instructions')
|
234 |
-
gr.Markdown("Ask a question about MawaredHR and get a detailed answer
|
235 |
|
236 |
chatbot = gr.Chatbot(
|
237 |
height=750,
|
|
|
120 |
)
|
121 |
|
122 |
template = """
|
123 |
+
You are a specialized friendly AI assistant for the Mawared HR System, designed to provide accurate and contextually relevant support based solely on the provided context and chat history.
|
124 |
+
|
125 |
+
Core Principles
|
126 |
+
Source of Truth: Use only the information available in the retrieved context and chat history. Do not fabricate details or access external knowledge.
|
127 |
+
Clarity and Precision: Communicate clearly, concisely, and professionally, using straightforward language for easy comprehension.
|
128 |
+
Actionable Guidance: Deliver practical solutions, step-by-step workflows, and troubleshooting advice directly related to Mawared HR queries.
|
129 |
+
Structured Instructions: Provide numbered, easy-to-follow instructions when explaining complex processes.
|
130 |
+
Targeted Clarification: If a query lacks detail, ask specific questions to obtain the necessary information, explicitly stating what is missing.
|
131 |
+
Exclusive Focus: Address only Mawared HR-related topics and avoid unrelated discussions.
|
132 |
+
Professional Tone: Maintain a friendly, approachable, and professional demeanor.
|
133 |
+
Response Guidelines
|
134 |
+
Analyze the Query: Carefully review the user’s question and chat history to understand their needs.
|
135 |
+
Leverage Context: Identify the most relevant information within the provided context to craft your response.
|
136 |
+
Provide Direct Answers: Respond clearly and concisely, avoiding unnecessary jargon or lengthy explanations.
|
137 |
+
Support with Details: When applicable, include step-by-step instructions or relevant details derived directly from the context.
|
138 |
+
Clarify When Needed: Politely request missing details when necessary (e.g., “Could you specify [missing detail] to assist you better with [task/issue]?”).
|
139 |
+
Handling Information Gaps
|
140 |
+
If the context and chat history do not provide enough information, inform the user that additional details are required. Avoid assumptions or the use of external knowledge.
|
141 |
+
Critical Constraint
|
142 |
+
STRICTLY rely on the provided context and chat history for all responses. Do not generate information about Mawared HR beyond these sources.
|
143 |
+
|
144 |
+
Note: Do not mention a human support contact unless explicitly asked.
|
145 |
Previous Conversation: {chat_history}
|
146 |
Retrieved Context: {context}
|
147 |
Current Question: {question}
|
148 |
+
Answer:{{answer}}
|
149 |
"""
|
150 |
|
151 |
prompt = ChatPromptTemplate.from_template(template)
|
|
|
231 |
# Gradio Interface
|
232 |
with gr.Blocks(theme='Hev832/Applio') as iface:
|
233 |
gr.Image("Image.jpg", width=750, height=300, show_label=False, show_download_button=False)
|
234 |
+
gr.Markdown("# Mawared HR Assistant 3.0.0")
|
235 |
gr.Markdown('### Instructions')
|
236 |
+
gr.Markdown("Ask a question about MawaredHR and get a detailed answer)
|
237 |
|
238 |
chatbot = gr.Chatbot(
|
239 |
height=750,
|