Rivalcoder commited on
Commit
ea49415
Β·
1 Parent(s): ff4ad88

Update The Model issues and Prompt

Browse files
Files changed (1) hide show
  1. llm.py +17 -16
llm.py CHANGED
@@ -30,27 +30,27 @@ def query_gemini(questions, contexts):
30
  questions_text = "\n".join([f"{i+1}. {q}" for i, q in enumerate(questions)])
31
 
32
  prompt = f"""
33
- You are an intelligent insurance assistant trained to answer questions using insurance documents. Based on the context provided below, respond to each question with a **well-informed, complete, and professionally worded answer**.
34
 
35
- 🎯 SCORING & OUTPUT GOAL:
36
- - Responses are part of an evaluated system.
37
- - Each answer should be **accurate**, **complete**, and **well-phrased** β€” ideally around **1–2 full sentences**.
38
- - Avoid short/fragmented answers or long multi-paragraph explanations.
39
- - Always write like an insurance advisor addressing a customer clearly.
40
 
41
  πŸ“˜ INSTRUCTIONS:
42
- 1. **Only use the provided context** to answer each question. If the answer is not found, respond with exactly: `"Not Found"`.
43
- 2. Keep answers concise **but not vague**. Include all **key points** (such as limits, durations, conditions) in one or two complete sentences.
44
- 3. DO NOT include any section numbers like "as per section 3.1.6"β€” these references must be omitted from the final answers.
45
- 4. DO NOT use bullet points, partial phrases, or excessive legal text. DO NOT repeat the question in the answer.
46
- 5. Match the tone and format of these examples:
47
- - "A grace period of thirty days is provided for premium payment after the due date to renew or continue the policy without losing continuity benefits."
48
- - "Yes, the policy covers maternity expenses, including childbirth and lawful medical termination of pregnancy. To be eligible, the female insured person must have been continuously covered for at least 24 months. The benefit is limited to two deliveries or terminations during the policy period."
49
- - "Yes, the policy indemnifies the medical expenses for the organ donor's hospitalization for the purpose of harvesting the organ, provided the organ is for an insured person and the donation complies with the Transplantation of Human Organs Act, 1994."
 
50
  - "Not Found"
51
 
52
  πŸ“€ RETURN FORMAT:
53
- Respond strictly using this JSON structure:
54
 
55
  {{
56
  "answers": [
@@ -66,12 +66,13 @@ Respond strictly using this JSON structure:
66
  ❓ QUESTIONS:
67
  {questions_text}
68
 
69
- Your task: Provide accurate, refined answers based on the document context above. Use the tone and structure shown. Be concise but thorough. Only include what is supported in the context. Use "Not Found" if the answer is missing.
70
  """
71
 
72
 
73
 
74
 
 
75
  prompt_time = time.time() - prompt_start
76
  print(f"Prompt preparation took: {prompt_time:.2f} seconds")
77
  print(f"Total prompt length: {len(prompt)} characters")
 
30
  questions_text = "\n".join([f"{i+1}. {q}" for i, q in enumerate(questions)])
31
 
32
  prompt = f"""
33
+ You are a skilled insurance policy assistant. Based only on the provided context, answer each question clearly and briefly.
34
 
35
+ 🎯 GOAL:
36
+ - Each answer should be precise, informative, and phrased naturally β€” around 1–2 full sentences.
37
+ - Avoid long clauses or repeating policy language verbatim.
38
+ - Focus on **clarity**, **brevity**, and **accuracy** β€” your answers will be judged for quality and relevance.
 
39
 
40
  πŸ“˜ INSTRUCTIONS:
41
+ 1. Only use the context below. If the answer is not present, respond with exactly: "Not Found".
42
+ 2. Answers must be helpful and compact β€” **complete, but not wordy**. Avoid long multi-clause sentences.
43
+ 3. Do NOT include section references (like β€œas per section 3.1.6”) or legal codes.
44
+ 4. Avoid copying large phrases from the document. Rephrase naturally using simpler language where appropriate.
45
+ 5. Follow the tone and length of these examples:
46
+
47
+ - "A grace period of thirty days is provided for premium payment after the due date."
48
+ - "Yes, maternity expenses are covered after 24 months of continuous coverage, limited to two deliveries or terminations."
49
+ - "Yes, the policy covers organ donor expenses for harvesting the organ if donated to the insured person."
50
  - "Not Found"
51
 
52
  πŸ“€ RETURN FORMAT:
53
+ Respond in the exact JSON format below β€” no extra text or explanations.
54
 
55
  {{
56
  "answers": [
 
66
  ❓ QUESTIONS:
67
  {questions_text}
68
 
69
+ Your task: Answer each question concisely and professionally. Use plain phrasing, stay within 1–2 clear sentences, and avoid unnecessary detail or repetition.
70
  """
71
 
72
 
73
 
74
 
75
+
76
  prompt_time = time.time() - prompt_start
77
  print(f"Prompt preparation took: {prompt_time:.2f} seconds")
78
  print(f"Total prompt length: {len(prompt)} characters")