Feature: Time to First Result (TTFR) estimator integrated into agent pipeline#86
Open
Feature: Time to First Result (TTFR) estimator integrated into agent pipeline#86
Conversation
Made-with: Cursor
- Compute TTFR per fused result; expose ttfr_estimates in chat response metadata - VertexRetriever: implement is_enabled as property for ABC compatibility (Python 3.14) - Dockerfile: use service-account.json.example when key file absent - Add verification script for TTFR milestones Made-with: Cursor
4 tasks
Author
|
@QuantumByte-01 Would love your feedback when you have a moment. |
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.
Relates to #26.
Summary
Integrates the TTFR (Time to First Result) estimator into the agent pipeline and exposes estimated retrieval time in chat response metadata. Tests are located under
tests/as requested.Changes
backend/ttfr_estimator.py): Core estimation logic with datasource defaults, modality inference, and three-phase breakdown (access, preprocessing, first output). Code-quality fixes applied (docstrings, rounding/singular forms, optional types).tests/test_ttfr_estimator.py): 39 unit tests; run withpytest tests/ -vfrom repo root. Pytest configured inpyproject.toml(pythonpath, testpaths); pytest remains a dev dependency only.backend/agents.py): TTFR computed per fused result infuse_results;ttfr_estimates(id, title, ttfr_summary) stored per session and exposed viaget_last_response_metadata(session_id).backend/main.py): Chat response metadata includesttfr_estimatesfor the returned results.backend/retrieval.py):VertexRetriever.is_enabledimplemented as a property for ABC compatibility (Python 3.14).backend/Dockerfile,backend/service-account.json.example): Build works without a real GCP key file by using an example placeholder.scripts/verify_ttfr_m1_m2.sh): Local verification for M1 and M2 without GCP.Verification
cd backend && python3 -c "from ttfr_estimator import estimate_ttfr; print(estimate_ttfr(datasource_id='scr_005031_openneuro'))"andpython3 demo_ttfr.pypytest tests/ -v(from repo root)POST /api/chatwith a search query returnsmetadata.ttfr_estimatesin the JSON response.Checklist
tests/directory