Add `dataset_leaderboard` method to HfApi (#3953)
* Add `dataset_leaderboard()` method to HfApi
Wraps GET /api/datasets/{dataset_id}/leaderboard to fetch ranked model
evaluation scores for benchmark datasets. Returns a list of typed
LeaderboardEntry objects.
Ref: https://github.com/huggingface/hub-docs/pull/2306#discussion_r2959558712
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Use [!TIP] callout format for Raises section in docstring
Matches the style used by neighboring methods (dataset_info, model_info).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Address code review: stricter types, better tests, richer docstrings
- Use dict[str, Any] instead of bare dict for source/author fields
- Document expected keys for author dict in docstring
- Use RepositoryNotFoundError instead of generic Exception in test
- Add assertions for optional fields (pull_request, notes)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Update src/huggingface_hub/hf_api.py
Co-authored-by: célina <hanouticelina@gmail.com>
* Update src/huggingface_hub/hf_api.py
Co-authored-by: célina <hanouticelina@gmail.com>
* Address review: rename, fix typo, type author as User | Organization
- Rename LeaderboardEntry → DatasetLeaderboardEntry
- Rename dataset_leaderboard → get_dataset_leaderboard (fix typo from suggestion)
- Parse author field into User or Organization based on type
- Update all exports, aliases, docstrings, and tests
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix __all__ ordering to pass check_all_variable CI check
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add cross-references to EvalResultEntry and ModelInfo.eval_results
Address Julien's review: link to the model-centric eval results API
so users understand both directions of the data.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: célina <hanouticelina@gmail.com>