Spaces:
Running
Running
Upload llm.py
Browse files- src/apps/utils/llm.py +4 -1
src/apps/utils/llm.py
CHANGED
|
@@ -20,6 +20,8 @@ Current Active Role: {role}
|
|
| 20 |
|
| 21 |
You MUST fully embody the role of **{role}** — not just in content, but in TONE, VOCABULARY, and PERSONALITY. Every response must feel like it is coming from a real expert in that exact role. Do not sound generic. Think, speak, and reason AS that person.
|
| 22 |
|
|
|
|
|
|
|
| 23 |
|
| 24 |
---
|
| 25 |
|
|
@@ -92,6 +94,7 @@ You are **Aadhar**, a trusted community legal advisor who helps ordinary people
|
|
| 92 |
## Mandatory Rules:
|
| 93 |
- Stay 100% in character for role: **{role}**. Every word should feel like it comes from that persona.
|
| 94 |
- Do NOT switch roles, break character, or mention "context" to the user.
|
|
|
|
| 95 |
- **Only if** you used the provided context, cite at the very end in this EXACT format:
|
| 96 |
**Title**: [Name]
|
| 97 |
**Page Number**: [Number]
|
|
@@ -184,7 +187,7 @@ Chat History: {chat_history}
|
|
| 184 |
messages=messages,
|
| 185 |
temperature=0,
|
| 186 |
stream=True,
|
| 187 |
-
max_tokens=
|
| 188 |
)
|
| 189 |
# ── Eager validation: peek at the first chunk to confirm the model
|
| 190 |
# is actually responding. With streaming, 404/errors only surface
|
|
|
|
| 20 |
|
| 21 |
You MUST fully embody the role of **{role}** — not just in content, but in TONE, VOCABULARY, and PERSONALITY. Every response must feel like it is coming from a real expert in that exact role. Do not sound generic. Think, speak, and reason AS that person.
|
| 22 |
|
| 23 |
+
IMPORTANT: You MUST always finish your thought and provide a definitive closing statement. Do NOT leave sentences unfinished or truncate your legal reasoning.
|
| 24 |
+
|
| 25 |
|
| 26 |
---
|
| 27 |
|
|
|
|
| 94 |
## Mandatory Rules:
|
| 95 |
- Stay 100% in character for role: **{role}**. Every word should feel like it comes from that persona.
|
| 96 |
- Do NOT switch roles, break character, or mention "context" to the user.
|
| 97 |
+
- IMPORTANT: You MUST always finish your thought and provide a definitive closing statement. Do NOT leave sentences unfinished or truncate your legal reasoning.
|
| 98 |
- **Only if** you used the provided context, cite at the very end in this EXACT format:
|
| 99 |
**Title**: [Name]
|
| 100 |
**Page Number**: [Number]
|
|
|
|
| 187 |
messages=messages,
|
| 188 |
temperature=0,
|
| 189 |
stream=True,
|
| 190 |
+
max_tokens=2048
|
| 191 |
)
|
| 192 |
# ── Eager validation: peek at the first chunk to confirm the model
|
| 193 |
# is actually responding. With streaming, 404/errors only surface
|