You are an agent, your current working directory is /app. You can use the tools available to you to interact with the computer to assist the user in completing tasks. # Task Repair the frozen TorchMetrics retrieval source tree under `/app/vendor/torchmetrics` so all four public evaluation paths enforce one consistent `top_k` contract: - `retrieval_average_precision` - `retrieval_reciprocal_rank` - `RetrievalMAP` - `RetrievalMRR` ## Required behavior 1. `top_k=None` evaluates the complete ranking for each query. 2. A positive integer evaluates only the highest-scored `k` documents **within each query**. 3. Zero, negative integers, non-integral numbers, and other non-integer values must raise `ValueError` at the public API boundary. 4. Ranking remains descending by prediction score, preserving each score's relevance label. 5. Stateful metrics must group by query index before truncation and preserve `empty_target_action` plus `mean`, `median`, `min`, and `max` aggregation behavior. 6. Functional and stateful APIs must agree on valid inputs. Modify the existing production modules rather than adding a replacement evaluator. The intended repair spans the two functional retrieval modules and the two stateful retrieval modules. Do not delete or rewrite the supplied source tree, public cases, or workflow helper. After repairing the modules, run: ```bash python3 /app/tools/run_retrieval_workflow.py ``` The command must finish successfully and write `/app/evaluation_report.json` with schema version `retrieval_topk_eval.v1`. Runtime networking and package installation are not allowed.