Default Prompt
The default LLM reranker prompt scores each memory individually on a 0.0-1.0 scale:Custom Prompt Configuration
You can provide a custom prompt template using thescoring_prompt parameter:
Prompt Variables
Your custom prompt can use the following variables:Both
{query} and {document} are required in your custom prompt. The LLM reranker scores each memory individually against the query, so the prompt is called once per candidate memory.Domain-Specific Examples
Customer Support
Educational Content
Personal Assistant
Advanced Prompt Techniques
Multi-Criteria Scoring
Chain-of-Thought Scoring
Best Practices
- Be Specific: Clearly define what makes a memory relevant for your use case
- Use 0.0-1.0 Scale: The score extractor expects values between 0.0 and 1.0
- Request Only the Score: Ask for just the numerical score to improve extraction reliability
- Test Iteratively: Refine your prompt based on actual ranking performance
- Consider Token Limits: Keep prompts concise while being comprehensive
Prompt Testing
You can test different prompts by comparing ranking results:Common Issues
- Too Long: Keep prompts under token limits for your chosen LLM
- Too Vague: Be specific about scoring criteria
- Wrong Scale: Use 0.0-1.0 scale to match the default score extractor
- Extra Output: Ask for only the numeric score: extra text can confuse score extraction