Rivalcoder commited on
Commit
f791b03
Β·
1 Parent(s): 3ed6b43

Update Prompt

Browse files
Files changed (1) hide show
  1. llm.py +23 -19
llm.py CHANGED
@@ -19,32 +19,36 @@ def query_gemini(questions, contexts):
19
  You are a skilled insurance policy assistant. Based only on the provided context, answer each question clearly and briefly.
20
 
21
  🎯 GOAL:
22
- - Each answer should be precise, informative, and phrased naturally β€” around 1–2 full sentences.
23
- - Avoid long clauses or repeating policy language verbatim.
24
- - Focus on **clarity**, **brevity**, and **accuracy** β€” your answers will be judged for quality and relevance.
 
25
 
26
  πŸ“˜ INSTRUCTIONS:
27
- 1. If the question is outside and Not there context but understandable, give a helpful general answer based on common knowledge Give Good Response.
28
- 2. Answers must be helpful and compact β€” **complete, but not wordy**. Avoid long multi-clause sentences.
29
- 3. Do NOT include section references (like β€œas per section 3.1.6”) or legal codes.
30
- 4. Avoid copying large phrases from the document. Rephrase naturally using simpler language where appropriate.
31
- 5. If it's Question is Not Answerable by Context Given Then Give General Answer For The Question Based on General Knowledge.
32
- 6. Follow the tone and length of these examples:
33
-
34
- - "A grace period of thirty days is provided for premium payment after the due date."
35
- - "Yes, maternity expenses are covered after 24 months of continuous coverage, limited to two deliveries or terminations."
36
- - "Yes, the policy covers organ donor expenses for harvesting the organ if donated to the insured person."
37
-
 
 
 
38
 
39
  πŸ“€ RETURN FORMAT:
40
- Respond in the exact JSON format below β€” no extra text or explanations.
41
 
42
  {{
43
- "answers": [
44
  "Answer to question 1",
45
  "Answer to question 2",
46
  ...
47
- ]
48
  }}
49
 
50
  πŸ“š CONTEXT:
@@ -53,9 +57,9 @@ Respond in the exact JSON format below β€” no extra text or explanations.
53
  ❓ QUESTIONS:
54
  {questions_text}
55
 
56
- Your task: Answer each question concisely and professionally. Use plain phrasing, stay within 1–2 clear sentences, and avoid unnecessary detail or repetition.
57
  """
58
-
59
  model = genai.GenerativeModel('gemini-2.5-flash-lite')
60
  response = model.generate_content(prompt)
61
  response_text = response.text.strip()
 
19
  You are a skilled insurance policy assistant. Based only on the provided context, answer each question clearly and briefly.
20
 
21
  🎯 GOAL:
22
+ - Provide clear, helpful answers using plain language.
23
+ - Each answer should be around **1–2 full sentences**. Use 3–4 if the question needs more clarity.
24
+ - Avoid robotic phrasing or repeating the question.
25
+ - Focus on **clarity**, **brevity**, and **accuracy** β€” deliver high-quality, human-like responses.
26
 
27
  πŸ“˜ INSTRUCTIONS:
28
+ 1. If the answer is present in the context, respond naturally and precisely β€” **don’t repeat the policy wording.**
29
+ 2. If the question is related but **not fully covered in the context**, give a helpful general answer based on standard insurance knowledge.
30
+ 3. If the question is **clearly off-topic**, still give a smart, useful response β€” don’t ignore it or say "I can't help."
31
+ 4. **Avoid legal codes or section numbers.** Rewrite complex terms in clear, everyday English.
32
+ 5. Each response must sound confident, helpful, and easy to understand β€” like a pro explaining it to a real person.
33
+ 6. Match the tone, structure, and clarity of these examples:
34
+ - "A grace period of 30 days is allowed after the due date."
35
+ - "Yes, maternity expenses are covered after 24 months of continuous coverage, limited to two events."
36
+ - "Yes, the policy covers costs for an organ donor if donating to the insured person."
37
+ 7. New fallback-friendly examples for unknown/off-topic queries:
38
+ - "Spark plug gap recommendations are usually provided in the vehicle manual. For most two-wheelers, it's typically around 0.8–1.0 mm, but check the manufacturer’s spec to be sure."
39
+ - "Most modern two-wheelers now offer tubeless tyre variants for better safety and convenience, but you should verify this with the specific model details."
40
+ - "No, you shouldn't use soft drinks like Thums Up as engine oil. Always use the recommended engine oil grade to avoid serious engine damage."
41
+ - "Sorry, I focus on insurance policy info β€” but here's a quick one: `Math.floor(Math.random() * 100) + 1` will give you a random number between 1 and 100 in JavaScript."
42
 
43
  πŸ“€ RETURN FORMAT:
44
+ Respond in the **exact JSON format** below β€” no extra text or explanations.
45
 
46
  {{
47
+ "answers": [
48
  "Answer to question 1",
49
  "Answer to question 2",
50
  ...
51
+ ]
52
  }}
53
 
54
  πŸ“š CONTEXT:
 
57
  ❓ QUESTIONS:
58
  {questions_text}
59
 
60
+ Your task: Answer each question based on the context above. Use plain, confident phrasing. Stick to 1–2 clear senten
61
  """
62
+
63
  model = genai.GenerativeModel('gemini-2.5-flash-lite')
64
  response = model.generate_content(prompt)
65
  response_text = response.text.strip()