Skip to content

Commit a504260

Browse files
committed
Revert "feat(issue-656): Add explicit Markdown formatting instructions to default prompt template"
This reverts commit 03479c3.
1 parent 03479c3 commit a504260

File tree

2 files changed

+2
-52
lines changed

2 files changed

+2
-52
lines changed

backend/rag_solution/schemas/prompt_template_schema.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,8 @@
1313
Context Documents:
1414
{context}
1515
16-
FORMATTING REQUIREMENTS:
17-
- Use Markdown formatting for your answer (NO HTML)
18-
- For quantitative data (revenue, statistics, year-over-year changes), use Markdown tables
19-
- Use **bold** for key findings and important numbers
20-
- Use bullet lists (- item) for multiple distinct points
21-
- Keep paragraphs concise (3-4 sentences maximum)
22-
23-
MARKDOWN TABLE EXAMPLE:
24-
| Year | Revenue | Change |
25-
|------|---------|-----------|
26-
| 2019 | $1.2B | - |
27-
| 2020 | $975M | -19.8% |
28-
| 2021 | $774M | -20.6% |
29-
| 2023 | $61.9B | +3.0% |
30-
3116
Please provide a structured answer with:
32-
1. A clear, concise Markdown-formatted answer to the question
17+
1. A clear, concise answer to the question
3318
2. A confidence score (0.0-1.0) based on the quality and relevance of the sources
3419
3. Citations to specific documents that support your answer
3520
- Include the document_id, title, and excerpt from the document

backend/rag_solution/services/prompt_template_service.py

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -225,46 +225,11 @@ def format_prompt_with_template(self, template: PromptTemplateBase, variables: d
225225
raise ValidationError(f"Failed to format prompt: {e!s}") from e
226226

227227
def _format_prompt_with_template(self, template: PromptTemplateBase, variables: dict[str, Any]) -> str:
228-
"""Internal method to format prompt with a template object.
229-
230-
For RAG_QUERY templates, automatically appends Markdown formatting instructions
231-
to ensure well-structured, readable responses.
232-
233-
Issue #655: Add explicit Markdown formatting requests to improve LLM output structure.
234-
"""
228+
"""Internal method to format prompt with a template object."""
235229
parts = []
236-
237-
# Add system prompt if present
238230
if template.system_prompt:
239231
parts.append(str(template.system_prompt))
240-
241-
# Add Markdown formatting instructions for RAG_QUERY templates
242-
if template.template_type == PromptTemplateType.RAG_QUERY:
243-
markdown_instructions = (
244-
"\n\nIMPORTANT - Response Formatting Requirements:\n"
245-
"Format your response in clean, well-structured Markdown:\n"
246-
"- Use ## for main sections and ### for subsections\n"
247-
"- Separate paragraphs with blank lines for better readability\n"
248-
"- Keep paragraphs concise (2-4 sentences maximum)\n"
249-
"- Use bullet points (-) for lists of items\n"
250-
"- Use numbered lists (1., 2., 3.) for sequential steps\n"
251-
"- Use **bold** for key concepts and important terms\n"
252-
"- Use *italic* for emphasis or definitions\n"
253-
"- Format tables using Markdown table syntax with | separators\n"
254-
"- Add blank lines before and after tables, lists, and code blocks\n"
255-
"\nExample structure:\n"
256-
"## Main Topic\n\n"
257-
"Brief introduction paragraph.\n\n"
258-
"### Key Points\n\n"
259-
"- First important point\n"
260-
"- Second important point\n\n"
261-
"Explanatory paragraph with **key terms** highlighted."
262-
)
263-
parts.append(markdown_instructions)
264-
265-
# Add formatted template
266232
parts.append(template.template_format.format(**variables))
267-
268233
return "\n\n".join(parts)
269234

270235
# Legacy method for backward compatibility - will be deprecated

0 commit comments

Comments
 (0)