An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
feat: improve output format flexibility in search mode prompts
Yoshiki Miura61c6a3c9b7ac
diff --git a/lib/agents/prompts/search-mode-prompts.ts b/lib/agents/prompts/search-mode-prompts.tsindex 22f00505..e6a06f03 100644--- a/lib/agents/prompts/search-mode-prompts.ts+++ b/lib/agents/prompts/search-mode-prompts.ts@@ -50,25 +50,21 @@ Rule precedence:OUTPUT FORMAT (MANDATORY):- You MUST always format responses as Markdown.-- Start with a level-2 heading (\`##\`) summarizing the answer.-- Include 2–3 level-3 subheadings (\`###\`), typically: Summary, Key Points, and Next Steps (or Caveats).-- Use bullets with bolded keywords: concise descriptions (e.g., \`- **Point:** detail\`).+- Start with a descriptive level-2 heading (\`##\`) that captures the main topic.+- Use level-3 subheadings (\`###\`) as needed to organize content naturally - let the topic guide the structure.+- Use bullets with bolded keywords for key points: \`- **Point:** concise explanation\`.+- Focus on delivering clear, actionable information rather than following a rigid template.- Only use fenced code blocks if the user explicitly asks for code or commands.-- Do NOT output unsolicited shell/CLI commands (e.g., curl, bash, npm, wget) or scripts; suggest plain-language steps and/or provide links instead.-- Even for straightforward questions, keep the structure and include 3–6 bullets total.-- Prefer compact paragraphs but provide enough context (aim for ~120–200 words).--Minimal Example:-## Summary-### Key Points-- **Conclusion:** Provide the direct answer with one-sentence context [1](#toolu_abc123)-- **Evidence:** Briefly state the strongest support [2](#toolu_abc123)-- **Implication:** Note a practical impact for the user-### Next Steps-- **Action:** Open the official page to verify details (link) — avoid shell commands-- **Alternative:** If Y applies, consider Z [3](#toolu_abc123)-### Caveats-- **Limitations:** Mention a key assumption or uncertainty [2](#toolu_abc123)+- Prefer natural, conversational tone while maintaining informativeness.+- Aim for ~120–200 words with content that directly answers the user's question.++Example approach:+## **Topic Response**+### Most Important Aspect+- **Key Point:** Direct answer with context [1](#toolu_abc123)+- **Detail:** Supporting information [2](#toolu_abc123)+### Additional Context (if relevant)+- **Consideration:** Practical implications`export const PLANNING_MODE_PROMPT = `@@ -129,25 +125,21 @@ Citation Format (MANDATORY):OUTPUT FORMAT (MANDATORY):- You MUST always format responses as Markdown.-- Start with a level-2 heading (\`##\`) for the overall title/summary.-- Include at least one level-3 subheading (\`###\`) per section.-- Use bullets with bolded keywords: concise descriptions (e.g., \`- **Finding:** ...\`).-- Use fenced code blocks for commands or code; use tables when comparing items.-- Typical structure (adapt if needed):- * \`## Overview\`- * \`### Key Findings\` (bulleted)- * \`### Analysis / Comparison\` (use tables if helpful)- * \`### Conclusion\` (1–3 lines)+- Start with a descriptive level-2 heading (\`##\`) that reflects the main topic.+- Use level-3 subheadings (\`###\`) to organize content logically - structure should emerge from the content, not be imposed.+- Use bullets with bolded keywords for clarity: \`- **Point:** explanation\`.+- Use tables for comparisons when they add value, fenced code blocks only when requested.+- Focus on delivering comprehensive, well-researched information that thoroughly addresses the query.- Every statement derived from search results MUST have citations at the sentence end.-- Length guidance: Aim for ~250–500 words depending on complexity. Keep sections focused and scannable.--Minimal Example:-## Overview-### Key Findings-- **Summary:** Concisely state the main conclusion [1](#toolu_abc123)-- **Comparison:** A has higher X than B [2](#toolu_def456)-### Conclusion-- **Takeaway:** In practice, adopting A is reasonable+- Aim for ~250–500 words depending on complexity, prioritizing thoroughness and clarity.++Natural structure example:+## **Main Topic**+### Core Information+- **Key Finding:** Primary insight with evidence [1](#toolu_abc123)+- **Important Detail:** Supporting facts [2](#toolu_abc123)+### Comparative Analysis (if relevant)+- **Advantage:** Specific benefit with source [3](#toolu_abc123)`export const ADAPTIVE_MODE_PROMPT = `@@ -280,17 +272,17 @@ Example task patterns:OUTPUT FORMAT (MANDATORY):- You MUST always format responses as Markdown.-- Start with a level-2 heading (\`##\`) and at least one level-3 subheading (\`###\`).-- Use bullets with bolded keywords for scannability.-- Use fenced code blocks and tables when appropriate.-- Simple queries: keep it very brief but DO NOT drop the structure.-- Medium/Complex: add sections as needed, ending with a short summary.+- Start with a descriptive level-2 heading (\`##\`) that captures the essence of the response.+- Use level-3 subheadings (\`###\`) to organize information naturally based on the topic.+- Use bullets with bolded keywords for key points and easy scanning.+- Use tables and code blocks when they genuinely improve clarity.+- Adapt length and structure to query complexity: simple topics can be concise, complex topics should be thorough.- Place all citations at the end of the sentence they support.-- Length guidance: scale with complexity (simple ~150–250 words; medium ~200–350; complex ~300–600).+- Length scales with complexity (simple ~150–250 words; medium ~200–350; complex ~300–600).-Minimal Example:-## Summary-### Key Points-- **Conclusion:** State the core point briefly [1](#toolu_abc123)-- **Note:** One practical consideration in one line+Flexible example:+## **Response Topic**+### Primary Information+- **Core Answer:** Direct response with evidence [1](#toolu_abc123)+- **Context:** Relevant supporting details`