Spaces:
Running
Running
Rivalcoder
commited on
Commit
Β·
9fc012d
1
Parent(s):
7acce36
[Edit] Udpate Prompt New
Browse files- .gitignore +1 -1
- llm.py +22 -20
.gitignore
CHANGED
@@ -25,7 +25,7 @@ wheels/
|
|
25 |
.installed.cfg
|
26 |
*.egg
|
27 |
MANIFEST
|
28 |
-
|
29 |
# Virtual environments
|
30 |
venv/
|
31 |
env/
|
|
|
25 |
.installed.cfg
|
26 |
*.egg
|
27 |
MANIFEST
|
28 |
+
.cache
|
29 |
# Virtual environments
|
30 |
venv/
|
31 |
env/
|
llm.py
CHANGED
@@ -16,29 +16,30 @@ def query_gemini(questions, contexts):
|
|
16 |
context = "\n\n".join(contexts)
|
17 |
questions_text = "\n".join([f"{i+1}. {q}" for i, q in enumerate(questions)])
|
18 |
prompt = f"""
|
19 |
-
You are an expert insurance assistant
|
20 |
|
21 |
-
|
22 |
-
-
|
23 |
-
-
|
24 |
-
-
|
25 |
-
-
|
|
|
|
|
|
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
5. Never leave the answer empty β say something helpful or general if the exact info isn't available.
|
33 |
-
6. Follow this tone and format style:
|
34 |
|
35 |
-
β
|
36 |
-
-
|
37 |
-
-
|
38 |
-
-
|
39 |
|
40 |
-
π€
|
41 |
-
Respond
|
42 |
|
43 |
{{
|
44 |
"answers": [
|
@@ -54,10 +55,11 @@ Respond in the exact JSON format below β no extra comments or explanation.
|
|
54 |
β QUESTIONS:
|
55 |
{questions_text}
|
56 |
|
57 |
-
Your task: For each question, provide a
|
58 |
"""
|
59 |
|
60 |
|
|
|
61 |
|
62 |
model = genai.GenerativeModel('gemini-2.5-flash-lite')
|
63 |
response = model.generate_content(prompt)
|
|
|
16 |
context = "\n\n".join(contexts)
|
17 |
questions_text = "\n".join([f"{i+1}. {q}" for i, q in enumerate(questions)])
|
18 |
prompt = f"""
|
19 |
+
You are an expert insurance assistant generating formal yet user-facing answers to policy questions. Your goal is to write professional, structured answers that reflect the language of policy documents β but are still human-readable and easy to understand.
|
20 |
|
21 |
+
π§ FORMAT & TONE GUIDELINES:
|
22 |
+
- Write in **professional third-person language** (no "you", no "we").
|
23 |
+
- Use **clear sentence structure** with proper punctuation and spacing.
|
24 |
+
- Do NOT write in legalese or robotic passive constructions.
|
25 |
+
- Include eligibility, limits, and waiting periods explicitly where relevant.
|
26 |
+
- Keep it factual, neutral, and easy to follow.
|
27 |
+
- Dont be Too Long or Repeats Unnecessary Information In the response.
|
28 |
+
- Answer Question Based On The Context and If Not Context Matches Then Answer Based On General Knowledge.
|
29 |
|
30 |
+
π DO NOT:
|
31 |
+
- Use words like "context", "document", or "text".
|
32 |
+
- Output markdown, bullets, emojis, or markdown code blocks.
|
33 |
+
- Say "helpful", "available", "allowed", "indemnified", "excluded", etc.
|
34 |
+
- Use overly robotic passive constructions like "shall be indemnified".
|
|
|
|
|
35 |
|
36 |
+
β
DO:
|
37 |
+
- Write in clean, informative language.
|
38 |
+
- Give complete answers in 2β3 sentences maximum.
|
39 |
+
- Provide fallback answers if exact info is not available.
|
40 |
|
41 |
+
π€ OUTPUT FORMAT (strict):
|
42 |
+
Respond with **only** the following JSON β no explanations, no comments, no markdown:
|
43 |
|
44 |
{{
|
45 |
"answers": [
|
|
|
55 |
β QUESTIONS:
|
56 |
{questions_text}
|
57 |
|
58 |
+
Your task: For each question, provide a complete, professional, and clearly written answer in 2β3 sentences using a formal but readable tone.
|
59 |
"""
|
60 |
|
61 |
|
62 |
+
|
63 |
|
64 |
model = genai.GenerativeModel('gemini-2.5-flash-lite')
|
65 |
response = model.generate_content(prompt)
|