Skip to content

Commit

Permalink
feat(backend): improve prompt about attaching files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mati365 committed Dec 26, 2024
1 parent 2451771 commit 4a09f3a
Showing 1 changed file with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ export function createRelevantEmbeddingsPrompt(
'\n--\n',
'CRITICAL: EMBEDDINGS USAGE REQUIREMENTS',
'1. NEVER use raw filenames - ALWAYS use #embedding:<id>',
'2. EVERY file reference MUST use #embedding:<id> format',
'2. EVERY reference MUST use #embedding:<id> format',
'3. NO EXCEPTIONS - even in examples or short mentions',
'4. NO EXCEPTIONS - mention the source of the information from Context using #embedding:<id> format. Always do that.',
'4. NO EXCEPTIONS - when referencing content, always cite specific fragments using #embedding:<id> format',
'5. When referencing content: Always say "fragment #embedding:<id>" or "according to fragment #embedding:<id>"',
'6. For images only: Use "image #embedding:<id>" - no need to mention fragments',
'',
'Core Instructions:',
'1. Respond in the same language as the user\'s prompt',
Expand All @@ -55,27 +57,30 @@ export function createRelevantEmbeddingsPrompt(
'',
'Text Format Rules:',
'- ❌ WRONG: "In config.ts we see..."',
'- ✅ CORRECT: "In #embedding:123 we see..."',
'- ✅ CORRECT: "In fragment #embedding:123 we see..."',
'- ❌ WRONG: "Check the utils folder"',
'- ✅ CORRECT: "Check #embedding:456 which contains utilities"',
'- ❌ WRONG: "[#embedding:789] shows..."',
'- ❌ WRONG: "(#embedding:789) contains..."',
'- ✅ CORRECT: "#embedding:789 shows..."',
'- ✅ CORRECT: "Fragment #embedding:456 shows utilities"',
'- ❌ WRONG: "File #embedding:789 shows..."',
'- ❌ WRONG: "According to file #embedding:789..."',
'- ✅ CORRECT: "Fragment #embedding:789 shows..."',
'- ✅ CORRECT for images only: "Image #embedding:789 shows..."',
'',
'List Guidelines:',
'- When listing files, ALWAYS use #embedding:<id> for each file reference',
'- Always refer to content as fragments: "Fragment #embedding:<id> shows..."',
'- Exception for images: "Image #embedding:<id> shows..."',
'- Never include empty or meaningless items in lists',
'- Each list item must contain meaningful content and proper file references',
'- Each item must contain meaningful content',
'- Remove or combine items that are too short or redundant',
'- Ensure each item adds unique value',
'',
'Reference Format:',
'- ALWAYS use #embedding:<id> instead of raw filenames in text',
'- File references in lists: #embedding:<id>',
'- Direct quotes: #embedding:<id> "quoted text"',
'- Paraphrasing: #embedding:<id> explains that... or According to #embedding:<id>...',
'- Multiple sources: Maintain proper #embedding:<id> prefixes for each source',
'- Example: Instead of "in file.ts we see..." write "in #embedding:<id> we see..."',
'- Text content: Always refer to fragments, not files',
'- Images: Refer to them as images, not fragments',
'- Direct quotes: "Fragment #embedding:<id> states: \'quoted text\'"',
'- Paraphrasing: "Fragment #embedding:<id> explains that..."',
'- Multiple fragments: Cite each fragment separately',
'- Example text: "Fragment #embedding:<id> shows..."',
'- Example image: "Image #embedding:<id> shows..."',
'',
'Response Guidelines:',
'- Be concise and focused',
Expand Down

0 comments on commit 4a09f3a

Please sign in to comment.