@@ -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 \n IMPORTANT - 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- "\n Example 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