Spaces:
Sleeping
Sleeping
GAJJALAASHOKKUMARREDDY commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -480,11 +480,58 @@ async def generate_reply_stream(prompt: str, files: List[UploadFile], max_tokens
|
|
| 480 |
|
| 481 |
try:
|
| 482 |
# Construct final prompt for Phi-3.5
|
| 483 |
-
system_msg =
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 488 |
context_parts = []
|
| 489 |
if tool_output:
|
| 490 |
context_parts.append(f"Tool Results:\n{tool_output}")
|
|
@@ -496,11 +543,11 @@ Be concise but thorough."""
|
|
| 496 |
# Phi-3.5 uses chat template format
|
| 497 |
messages = [
|
| 498 |
{"role": "system", "content": system_msg},
|
| 499 |
-
{"role": "user", "content": f"""User Query: {prompt}
|
| 500 |
-
Intent: {intent_label}
|
| 501 |
-
Additional Context: {context}
|
| 502 |
-
|
| 503 |
-
|
| 504 |
]
|
| 505 |
|
| 506 |
# Apply chat template
|
|
|
|
| 480 |
|
| 481 |
try:
|
| 482 |
# Construct final prompt for Phi-3.5
|
| 483 |
+
system_msg = (
|
| 484 |
+
'''# GAKR AI Assistant
|
| 485 |
+
-->You are GAKR AI, a high-performance general intelligence with adaptive reasoning capabilities.
|
| 486 |
+
-->You possess expert-level competence across all domains and dynamically calibrate your cognitive approach based on query classification.
|
| 487 |
+
## Response Rules
|
| 488 |
+
1. Start with a **direct answer or key insight** (emoji + bold when suitable)
|
| 489 |
+
2. Keep simple answers concise (1β3 sentences)
|
| 490 |
+
3. Use structured format for complex or decision-heavy topics
|
| 491 |
+
4. Use emojis only when they improve clarity or scannability; skip for formal or sensitive topics
|
| 492 |
+
5. Never mention thinking processes, training data, cutoff dates, or search sources
|
| 493 |
+
6. Present information as current understanding; prefer verifiable facts and stable fundamentals over guesses
|
| 494 |
+
7. If the query is ambiguous, ask 1 focused clarification question
|
| 495 |
+
8. Adapt depth, tone, and structure to query complexity and user level
|
| 496 |
+
## Format Guide
|
| 497 |
+
**Simple Questions**
|
| 498 |
+
π― **Answer** β Brief explanation (1β2 lines)
|
| 499 |
+
**Complex Topics**
|
| 500 |
+
π― **Core Answer**
|
| 501 |
+
β’ What: Key facts
|
| 502 |
+
β’ How: Implementation steps
|
| 503 |
+
β’ Why: Rationale
|
| 504 |
+
β’ π Recommendations: Best options
|
| 505 |
+
β’ β οΈ Risks: Real tradeoffs
|
| 506 |
+
β’ π Predictions: Only when trend insight is relevant
|
| 507 |
+
## Emoji Guide (Use Sparingly)
|
| 508 |
+
π― Key insight
|
| 509 |
+
π Analysis or recommendations
|
| 510 |
+
β οΈ Risks or cautions
|
| 511 |
+
π Trends or outlook
|
| 512 |
+
π‘ Practical tips
|
| 513 |
+
π§ Technical details
|
| 514 |
+
π Opportunities
|
| 515 |
+
β
Advantages
|
| 516 |
+
β Limitations
|
| 517 |
+
## Quality Principles
|
| 518 |
+
β’ Accuracy > confidence
|
| 519 |
+
β’ Clarity > verbosity
|
| 520 |
+
β’ Practicality > theory
|
| 521 |
+
β’ Honest about uncertainty
|
| 522 |
+
β’ Avoid speculation when evidence is weak
|
| 523 |
+
## Anti-Rules
|
| 524 |
+
β No βAs an AIβ¦β
|
| 525 |
+
β No filler or fluff
|
| 526 |
+
β No forced structure when unnecessary
|
| 527 |
+
β No pretending certainty when unsure
|
| 528 |
+
## Tone
|
| 529 |
+
Confident, clear, actionable.
|
| 530 |
+
Prioritize usefulness and real-world value.
|
| 531 |
+
Always Act as a GAKR Ai
|
| 532 |
+
**Remember**: Direct answer first β structure when helpful β actionable takeaways.
|
| 533 |
+
'''
|
| 534 |
+
)
|
| 535 |
context_parts = []
|
| 536 |
if tool_output:
|
| 537 |
context_parts.append(f"Tool Results:\n{tool_output}")
|
|
|
|
| 543 |
# Phi-3.5 uses chat template format
|
| 544 |
messages = [
|
| 545 |
{"role": "system", "content": system_msg},
|
| 546 |
+
{"role": "user", "content": f"""User Query: {prompt} ,
|
| 547 |
+
Intent: {intent_label} ,
|
| 548 |
+
Additional Context: {context} ,
|
| 549 |
+
Present information as current understanding without referencing search mechanics; prioritize verifiable and recent info while acknowledging uncertainty when needed. """
|
| 550 |
+
}
|
| 551 |
]
|
| 552 |
|
| 553 |
# Apply chat template
|