🖇️ refactor: Improve prompt for Better Citation Formatting (#10858)

* 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 <danny@librechat.ai>
This commit is contained in:
Michael Ludvig 2025-12-10 14:06:26 +13:00 committed by GitHub
parent b68d16bdea
commit a07cc11cd6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -317,14 +317,22 @@ const loadTools = async ({
requestedTools[tool] = async () => { requestedTools[tool] = async () => {
toolContextMap[tool] = `# \`${tool}\`: toolContextMap[tool] = `# \`${tool}\`:
Current Date & Time: ${replaceSpecialVars({ text: '{{iso_datetime}}' })} 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. **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.
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. **CITATION FORMAT - INVISIBLE UNICODE ANCHORS ONLY:**
5. **Tailor your approach to the query type** (academic, news, coding, etc.) while maintaining an expert, journalistic, unbiased tone. Use these Unicode characters: \\ue202 (before each anchor), \\ue200 (group start), \\ue201 (group end), \\ue203 (highlight start), \\ue204 (highlight end)
6. **Provide comprehensive information** with specific details, examples, and as much relevant context as possible from search results.
7. **Avoid moralizing language.** Anchor pattern: turn{N}{type}{index} where N=turn number, type=search|news|image|ref, index=0,1,2...
`.trim();
**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({ return createSearchTool({
...result.authResult, ...result.authResult,
onSearchResults, onSearchResults,