Skip to main content
When using LLM rerankers, you can customize the prompts used for ranking to better suit your specific use case and domain.

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 the scoring_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

  1. Be Specific: Clearly define what makes a memory relevant for your use case
  2. Use 0.0-1.0 Scale: The score extractor expects values between 0.0 and 1.0
  3. Request Only the Score: Ask for just the numerical score to improve extraction reliability
  4. Test Iteratively: Refine your prompt based on actual ranking performance
  5. 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