kk20krishna commited on
Commit
5fec409
·
verified ·
1 Parent(s): a1c6b06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -80
app.py CHANGED
@@ -262,50 +262,6 @@ def ask_question(message, history):
262
  if agent_executor is None:
263
  return "❗ Chatbot not ready. Please upload and process a PDF first."
264
 
265
- # advisory_prompt = (
266
- # "Reterive policy information using PolicyRetrievalRAG tool and answer the user questions."
267
- # "Always use data returned by the policy. Do not makeup information."
268
- # )
269
- # advisory_prompt = (
270
- # "Use the PolicyRetrievalRAG tool to extract the most relevant clauses from the policy document. "
271
- # "Always base your response strictly on the actual policy content—do not fabricate or assume.\n\n"
272
-
273
- # "Respond strictly in this structured format:\n\n"
274
-
275
- # "Policy Details: \n"
276
- # "- Quote or paraphrase the most relevant clauses from the policy.\n\n"
277
-
278
- # "Simplified Explanation:\n"
279
- # "- Translate the policy language into simple, user-friendly language.\n\n"
280
-
281
- # "Advisor’s Practical Tip:\n"
282
- # "- Give actionable tips to help the user get the most from their policy.\n\n"
283
-
284
- # "Caveats and Exclusions:\n"
285
- # "- Mention any exclusions, limitations, or waiting periods.\n\n"
286
-
287
- # "Your tone should be empathetic and clear—like a smart, helpful insurance advisor.\n"
288
- # "Respond with text only. Do not use Emoji."
289
- # "Always include all four sections in the output.\n\n"
290
-
291
- # "---\n"
292
- # "### Example Response Format:\n"
293
- # "Policy Details:\n"
294
- # "- ...\n\n"
295
- # "Simplified Explanation:\n"
296
- # "- ...\n\n"
297
- # "Advisor’s Practical Tip:\n"
298
- # "- ...\n\n"
299
- # "Caveats and Exclusions:\n"
300
- # "- ...\n"
301
- # "---"
302
- # "---\n"
303
- # "### Example Response:\n"
304
- # "Policy Details:\n- The policy offers 24-month waiting period for pre-existing conditions.\n\n"
305
- # "Simplified Explanation:\n- You have to wait 2 years before claims related to past illnesses are covered.\n\n"
306
- # "Advisor’s Practical Tip:\n- Consider a top-up or rider that waives this waiting period.\n\n"
307
- # "Caveats and Exclusions:\n- Diabetes and hypertension are included in pre-existing illnesses list.\n\n"
308
- # )
309
  advisory_prompt = (
310
  "Use the PolicyRetrievalRAG tool to extract the most relevant clauses from the policy document. "
311
  "Always base your response strictly on the actual policy content — do not fabricate or assume.\n\n"
@@ -372,43 +328,26 @@ with gr.Blocks(theme='shivi/calm_seafoam', title="📄 Insurance Policy AIdvisor
372
  )
373
 
374
  with gr.Tab("💬 Chatbot"):
375
- with gr.Row():
376
- with gr.Column(scale=3):
377
- chat = gr.ChatInterface(fn=ask_question,
378
- title = "🤖 AIdvisor",
379
- chatbot=gr.Chatbot(
380
- avatar_images=(
381
- "https://em-content.zobj.net/source/twitter/141/parrot_1f99c.png", # User
382
- "https://em-content.zobj.net/source/twitter/141/robot-face_1f916.png" # Bot
383
- )
384
  )
385
- )
386
- with gr.Column(scale=1):
387
- gr.Examples(
388
- examples=[
389
- "In what forms are the certificate avalaible?",
390
- "How many employees should enroll if the member is to not contribute premium?",
391
- "Can insurer contest this policy?",
392
- "when can insurer make changes to the policy?",
393
- "I gave incorrect age in the policy, what to do now?",
394
- "Can the data I filled in the application form to get the insurance policy be used against me?",
395
- "What are the eligibility criteria for dependent life insurance?",
396
- "When does the life insurance coverage terminate for a member?",
397
- "Is the insurer allowed to contest the policy after two years?",
398
- "Can I convert my group policy to an individual life insurance plan?",
399
- "How is the death benefit amount affected if I receive accelerated benefits?",
400
- "What happens if my dependent child turns 26 but is physically handicapped?",
401
- "Is proof of good health required if I request insurance after 31 days of eligibility?",
402
- "What is the process for reinstating my policy after a leave of absence?",
403
- "What support services are included along with the insurance plan?",
404
- "What happens if I stop paying my premium?",
405
- "Can the insurer make changes to the policy without my consent?",
406
- "How are premium rates determined and can they change?",
407
- "Are there any benefits if I die in an accident while wearing a seatbelt?",
408
- "What information does the insurer need from the policyholder?"
409
- ],
410
- inputs=chat.textbox
411
- )
412
 
413
  with gr.Tab("System Design"):
414
  gr.Image(value="AIdvisor_devcon.png")
 
262
  if agent_executor is None:
263
  return "❗ Chatbot not ready. Please upload and process a PDF first."
264
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  advisory_prompt = (
266
  "Use the PolicyRetrievalRAG tool to extract the most relevant clauses from the policy document. "
267
  "Always base your response strictly on the actual policy content — do not fabricate or assume.\n\n"
 
328
  )
329
 
330
  with gr.Tab("💬 Chatbot"):
331
+ chat = gr.ChatInterface(fn=ask_question,
332
+ title = "🤖 AIdvisor",
333
+ chatbot=gr.Chatbot(
334
+ avatar_images=(
335
+ "https://em-content.zobj.net/source/twitter/141/parrot_1f99c.png", # User
336
+ "https://em-content.zobj.net/source/twitter/141/robot-face_1f916.png" # Bot
 
 
 
337
  )
338
+ )
339
+ )
340
+
341
+ gr.Examples(
342
+ examples=[
343
+ "In what forms are the certificate avalaible?",
344
+ "How many employees should enroll if the member is to not contribute premium?",
345
+ "Can insurer contest this policy?",
346
+ "when can insurer make changes to the policy?",
347
+ "I gave incorrect age in the policy, what to do now?",
348
+ "Can the data I filled in the application form to get the insurance policy be used against me?",
349
+ inputs=chat.textbox
350
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
 
352
  with gr.Tab("System Design"):
353
  gr.Image(value="AIdvisor_devcon.png")