Skip to content

[P0 CRITICAL] Fix Reranking System Failure - Missing Template Parameter #510

@manavgup

Description

@manavgup

Problem

The reranking system is completely broken, causing the RAG to return irrelevant document chunks despite having 731 chunks from the IBM annual report containing revenue data.

Error: ValueError: Template is required for batch generation
Duration: 4.21 seconds wasted (23:52:44.939 → 23:52:49.155)
Impact: BLOCKING - No accurate retrieval without working reranking

Root Cause

backend/rag_solution/retrieval/reranker.py

The reranker calls generate_text() in batch mode but fails to pass the required template parameter.

Fix Strategy

  1. Fetch RERANKING template from PromptTemplateService
  2. Pass template to generate_text() for batch operations
  3. Handle batch scoring properly

Success Criteria

  • ✅ No ValueError: Template is required errors
  • ✅ Reranking completes in <1 second
  • ✅ Top 5-10 results have relevance scores >0.8
  • ✅ Revenue-related chunks appear in top results

Files to Modify

  • backend/rag_solution/retrieval/reranker.py (~20-30 LOC)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingphase-0Phase 0: Critical blocking fixespriority:criticalCritical priority - blocks productionrag-qualityRAG system quality and accuracy issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions