Spaces:
Running
Running
Rivalcoder
commited on
Commit
Β·
ea49415
1
Parent(s):
ff4ad88
Update The Model issues and Prompt
Browse files
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
|
34 |
|
35 |
-
π―
|
36 |
-
-
|
37 |
-
-
|
38 |
-
-
|
39 |
-
- Always write like an insurance advisor addressing a customer clearly.
|
40 |
|
41 |
π INSTRUCTIONS:
|
42 |
-
1.
|
43 |
-
2.
|
44 |
-
3.
|
45 |
-
4.
|
46 |
-
5.
|
47 |
-
|
48 |
-
- "
|
49 |
-
- "Yes,
|
|
|
50 |
- "Not Found"
|
51 |
|
52 |
π€ RETURN FORMAT:
|
53 |
-
Respond
|
54 |
|
55 |
{{
|
56 |
"answers": [
|
@@ -66,12 +66,13 @@ Respond strictly using this JSON structure:
|
|
66 |
β QUESTIONS:
|
67 |
{questions_text}
|
68 |
|
69 |
-
Your task:
|
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")
|