-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Description
Add explain API endpoint to help developers understand and debug search results by showing the factors that contributed to each result's ranking.
Background
This enhancement extends Issue #58 (hybrid search) by providing debugging capabilities that help developers understand why certain results were returned and how to tune search parameters.
Requirements
- Add
/v1/search/explainendpoint - Show scoring factors: similarity, BM25, freshness, quality
- Display individual factor contributions
- Add debugging information for search tuning
- Include result metadata and processing details
- Add explain API documentation
- Add explain API tests
Implementation Details
Files to modify:
src/contextforge_memory/main.py- Add explain endpointsrc/contextforge_memory/search/- Add explain functionalitysrc/contextforge_memory/explain/- New explain moduletests/- Add explain testsREADME.md- Document explain API
Technical approach:
- Create explain service that breaks down search scoring
- Add detailed result analysis with factor contributions
- Implement debugging information collection
- Add explain response formatting
- Create explain API documentation
Acceptance Criteria
- Explain endpoint returns detailed scoring breakdown
- All scoring factors are explained clearly
- Debugging information is helpful for tuning
- API documentation is complete
- Tests cover explain functionality
Testing Requirements
- Unit tests for explain logic
- Integration tests for explain endpoint
- Performance tests for explain overhead
- Documentation tests for explain API
Documentation Updates
- README.md - Document explain API
- API documentation - Explain endpoint
- Debugging guide - Search tuning
- Examples - Explain API usage
Related Issues
- Extends: [P2] Add hybrid search with BM25 + semantic vectors #58 (hybrid search)
- Depends on: None
- Blocks: None