From a07cc11cd6026ea4d712b3a2e0f6f80e5df165d2 Mon Sep 17 00:00:00 2001 From: Michael Ludvig <745857+mludvig@users.noreply.github.com> Date: Wed, 10 Dec 2025 14:06:26 +1300 Subject: [PATCH] =?UTF-8?q?=F0=9F=96=87=EF=B8=8F=20refactor:=20Improve=20p?= =?UTF-8?q?rompt=20for=20Better=20Citation=20Formatting=20(#10858)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Improve prompt for better citation formatting * Provide format example Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor: Simplify citation guidelines and response structure in tool loading --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Danny Avila --- api/app/clients/tools/util/handleTools.js | 24 +++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/api/app/clients/tools/util/handleTools.js b/api/app/clients/tools/util/handleTools.js index 5692bee8db..032255b64c 100644 --- a/api/app/clients/tools/util/handleTools.js +++ b/api/app/clients/tools/util/handleTools.js @@ -317,14 +317,22 @@ const loadTools = async ({ requestedTools[tool] = async () => { toolContextMap[tool] = `# \`${tool}\`: Current Date & Time: ${replaceSpecialVars({ text: '{{iso_datetime}}' })} -1. **Execute immediately without preface** when using \`${tool}\`. -2. **After the search, begin with a brief summary** that directly addresses the query without headers or explaining your process. -3. **Structure your response clearly** using Markdown formatting (Level 2 headers for sections, lists for multiple points, tables for comparisons). -4. **Cite sources properly** according to the citation anchor format, utilizing group anchors when appropriate. -5. **Tailor your approach to the query type** (academic, news, coding, etc.) while maintaining an expert, journalistic, unbiased tone. -6. **Provide comprehensive information** with specific details, examples, and as much relevant context as possible from search results. -7. **Avoid moralizing language.** -`.trim(); + +**Execute immediately without preface.** After search, provide a brief summary addressing the query directly, then structure your response with clear Markdown formatting (## headers, lists, tables). Cite sources properly, tailor tone to query type, and provide comprehensive details. + +**CITATION FORMAT - INVISIBLE UNICODE ANCHORS ONLY:** +Use these Unicode characters: \\ue202 (before each anchor), \\ue200 (group start), \\ue201 (group end), \\ue203 (highlight start), \\ue204 (highlight end) + +Anchor pattern: turn{N}{type}{index} where N=turn number, type=search|news|image|ref, index=0,1,2... + +**Examples:** +- Single: "Statement.\\ue202turn0search0" +- Multiple: "Statement.\\ue202turn0search0\\ue202turn0news1" +- Group: "Statement. \\ue200\\ue202turn0search0\\ue202turn0news1\\ue201" +- Highlight: "\\ue203Cited text.\\ue204\\ue202turn0search0" +- Image: "See photo\\ue202turn0image0." + +**CRITICAL:** Place anchors AFTER punctuation. Cite every non-obvious fact/quote. NEVER use markdown links, [1], footnotes, or HTML tags.`.trim(); return createSearchTool({ ...result.authResult, onSearchResults,