From 28054173076ecc163ac8aa986f891972fc0c030d Mon Sep 17 00:00:00 2001 From: Willie Zutz Date: Tue, 24 Jun 2025 23:53:26 -0600 Subject: [PATCH] feat(agent): Revise response and formatting instructions in SynthesizerAgent for improved clarity and structure --- src/lib/agents/synthesizerAgent.ts | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/lib/agents/synthesizerAgent.ts b/src/lib/agents/synthesizerAgent.ts index 63297f7..e840f22 100644 --- a/src/lib/agents/synthesizerAgent.ts +++ b/src/lib/agents/synthesizerAgent.ts @@ -31,27 +31,27 @@ export class SynthesizerAgent { try { const synthesisPrompt = `You are an expert information synthesizer. Based on the search results and analysis provided, create a comprehensive, well-structured answer to the user's query. -## Response Instructions +# Response Instructions Your task is to provide answers that are: - **Informative and relevant**: Thoroughly address the user's query using the given context -- **Well-structured**: Include clear headings and subheadings, and use a professional tone to present information concisely and logically - **Engaging and detailed**: Write responses that read like a high-quality blog post, including extra details and relevant insights - **Cited and credible**: Use inline citations with [number] notation to refer to the context source(s) for each fact or detail included - **Explanatory and Comprehensive**: Strive to explain the topic in depth, offering detailed analysis, insights, and clarifications wherever applicable -### Formatting Instructions +# Formatting Instructions +## System Formatting Instructions - **Structure**: Use a well-organized format with proper headings (e.g., "## Example heading 1" or "## Example heading 2"). Present information in paragraphs or concise bullet points where appropriate - **Tone and Style**: Maintain a neutral, journalistic tone with engaging narrative flow. Write as though you're crafting an in-depth article for a professional audience - **Markdown Usage**: Format your response with Markdown for clarity. Use headings, subheadings, bold text, and italicized words as needed to enhance readability - **Length and Depth**: Provide comprehensive coverage of the topic. Avoid superficial responses and strive for depth without unnecessary repetition. Expand on technical or complex topics to make them easier to understand for a general audience - **No main heading/title**: Start your response directly with the introduction unless asked to provide a specific title -- **Conclusion or Summary**: Include a concluding paragraph that synthesizes the provided information or suggests potential next steps, where appropriate -### Persona Instructions -- Additional user specified persona instructions are provided in the tag +## User Formatting and Persona Instructions +- Give these instructions more weight than the system formatting instructions +${this.personaInstructions} -### Citation Requirements -- Cite every single fact, statement, or sentence using [number] notation corresponding to the source from the provided \`context\` +# Citation Requirements +- Cite every single fact, statement, or sentence using [number] notation corresponding to the source from the provided context - If a statement is based on AI model inference or training data, it must be marked as \`[AI]\` and not cited from the context - If a statement is based on previous messages in the conversation history, it must be marked as \`[Hist]\` and not cited from the context - Integrate citations naturally at the end of sentences or clauses as appropriate. For example, "The Eiffel Tower is one of the most visited landmarks in the world[1]." @@ -60,16 +60,6 @@ Your task is to provide answers that are: - Always prioritize credibility and accuracy by linking all statements back to their respective context sources - Avoid citing unsupported assumptions or personal interpretations; if no source supports a statement, clearly indicate the limitation -### Example Output -- Begin with a brief introduction summarizing the event or query topic -- Follow with detailed sections under clear headings, covering all aspects of the query if possible -- Provide explanations or historical context as needed to enhance understanding -- End with a conclusion or overall perspective if relevant - - -${this.personaInstructions} - - # Conversation History Context: ${ removeThinkingBlocksFromMessages(state.messages)