fix: correct reranker score display and add URL content fetching - #11
Merged
Merged
Conversation
…warning - Change self.model_fields to Settings.model_fields - Fixes PydanticDeprecatedSince211 warning
- Add extract_sources_from_message() to parse sources from API responses - Extract from 'sources' field if available - Fallback to parsing markdown references ([^1], [^2], etc.) from content - Store extracted sources as retrieved_docs for RAG metrics calculation - Fixes reranker_score and other RAG metrics showing 0 when sources are in markdown format
- Add source extraction to /api/chat/completed endpoint handler - Ensures sources are extracted from both async polling and direct response paths - Fixes missing source extraction when response comes via completed endpoint
- Store user query when sending message in chat_page - Pass query to RAG context when storing retrieved docs - Retrieve query from RAG context in collector if not in validation_data - Fixes reranker_score showing 0 when query is missing
…tracted URLs - Update _store_rag_context to merge instead of replace - Preserve test data's retrieved_docs if already set - Prevents extracted URLs from overwriting test context - Fixes context_relevance showing 0 when test data is available
- Fix _load_model() to return True when model/tokenizer are available (not just pipeline) - Update BGE reranker format to use tokenizer's sep_token instead of literal [SEP] - Add debug logging for reranker scoring - Fixes reranker_score showing 0.0 when reranker is actually loaded and working
- Add url_fetcher utility with parallel fetching, retry logic, and content type support - Integrate URL content fetching into RAG metrics calculator - Add configuration settings for URL fetching (timeout, max length, retries, workers) - Update .env.example and README.md with new configuration options
- Remove reranker_score from percentage_metrics list to prevent incorrect conversion - Ensure reranker_score is displayed as 0-1 decimal instead of 0-100 percentage - Fix reranker score normalization to always return 0-1 range - Fix RAG context storage to prioritize test-provided retrieved_docs
- Remove all console.log debug statements from dashboard.js - Update cache-busting version to v=8 to force browser reload - Clean up whitespace and styling issues in dashboard UI
- Clarify that reranker_score is displayed as 0-1 decimal, not percentage - Document URL content fetching feature and configuration options - Update RAG calibration usage documentation with URL fetching details
- Update regex patterns to match closing tags with whitespace (e.g., </script >) - Fixes CodeQL security alert for bad HTML filtering regexp - Use \s* to allow optional whitespace before closing angle bracket
- Change from \s* to [^>]* to match any characters in closing tags - Fixes CodeQL alert for edge cases like </script\t\n bar> - Handles whitespace, text, and any other characters before closing bracket - More robust against malformed HTML injection attempts
…ands - Reorganize help section into logical categories (Setup, Testing, Code Quality, etc.) - Add missing targets: install-hooks, test-unit-cov, test-integration, test-property, format-check, security-scan, dashboard-custom, metrics-raw - Update README Development section to match new Makefile organization - Add reference to 'make help' for complete command list
- Reorganize commands into logical categories matching Makefile help - Add missing commands: install-hooks, test-unit-cov, test-integration, test-property, format-check, security-scan, docs, docs-serve, dashboard-custom, metrics-raw - Add reference to 'make help' for complete command list
- Make VENV_BIN absolute using $(abspath) to fix path resolution after cd - Update docs target to run sphinx from repo root without cd - Update docs-serve target to use -d flag instead of cd - Reorganize .PHONY targets for better maintainability - Clean up docs/conf.py imports and structure Fixes issue where 'make docs' failed with 'No such file or directory' errors when trying to use relative venv paths after changing directories.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes the reranker score display issue in the dashboard and adds URL content fetching to improve reranker accuracy for real chat interactions. The reranker score was incorrectly displaying as a percentage (e.g., 61.36) instead of a 0-1 decimal (e.g., 0.61). Additionally, the framework now fetches content from URLs to provide richer context for reranker scoring, significantly improving accuracy when sources are URLs rather than document text.
Type of Change
Changes Made
reranker_scorefrompercentage_metricslist incollectors.pyanddata_store.pyto prevent incorrect conversion to 0-100 percentage rangeurl_fetcher.pyutility with parallel fetching, retry logic, and support for HTML, PDF, JSON, and plain text contentrag_tester.pyto prioritize test-providedretrieved_docsover extracted URLs_load_model()check to properly detect transformers-based modelschat_page.pyto extract sources from both/api/chat/completedand async polling endpointsconsole.logdebug statements from dashboard JavaScriptTesting
Test Coverage
Test Results
Manual Testing:
Code Quality
Pre-Submission Checks
make checkpasses (linting + type checking)make formathas been runmake test-allpassesCode Standards
Documentation
Related Issues
Fixes reranker score display issue where values > 1 were appearing (e.g., 61.36 instead of 0.61)
Additional Context
Screenshots/Demo
Before: Reranker score displayed as
61.36(incorrect percentage)After: Reranker score displays as
0.61(correct 0-1 decimal)Breaking Changes
None. This is a bug fix and feature addition that maintains backward compatibility.
Performance Impact
Security Considerations
Configuration
New environment variables added:
Checklist