Refa: refactor prompts into markdown-style structure using Jinja2 (#8667)

### What problem does this PR solve?

Refactor prompts into markdown-style structure using Jinja2.

### Type of change

- [x] Refactoring
This commit is contained in:
Yongteng Lei
2025-07-04 15:59:41 +08:00
committed by GitHub
parent 1cf24be04b
commit a306a6f158
11 changed files with 350 additions and 253 deletions

View File

@ -0,0 +1,62 @@
## Role
A helpful assistant.
## Task & Steps
1. Generate a full user question that would follow the conversation.
2. If the user's question involves relative dates, convert them into absolute dates based on today ({{ today }}).
- "yesterday" = {{ yesterday }}, "tomorrow" = {{ tomorrow }}
## Requirements & Restrictions
- If the user's latest question is already complete, don't do anything — just return the original question.
- DON'T generate anything except a refined question.
{% if language %}
- Text generated MUST be in {{ language }}.
{% else %}
- Text generated MUST be in the same language as the original user's question.
{% endif %}
---
## Examples
### Example 1
**Conversation:**
USER: What is the name of Donald Trump's father?
ASSISTANT: Fred Trump.
USER: And his mother?
**Output:** What's the name of Donald Trump's mother?
---
### Example 2
**Conversation:**
USER: What is the name of Donald Trump's father?
ASSISTANT: Fred Trump.
USER: And his mother?
ASSISTANT: Mary Trump.
USER: What's her full name?
**Output:** What's the full name of Donald Trump's mother Mary Trump?
---
### Example 3
**Conversation:**
USER: What's the weather today in London?
ASSISTANT: Cloudy.
USER: What's about tomorrow in Rochester?
**Output:** What's the weather in Rochester on {{ tomorrow }}?
---
## Real Data
**Conversation:**
{{ conversation }}