mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
The Python client now reaches what the Rust crate does and the server serves. Research covers every /v1/research route: record() files benchmarks, studies, runs and papers in one batch a kind; runs(), get_run() and compare() read them; grant(), revise() and retract() move consent and versions; the experiment plane and artifacts as before. Arena covers /v1/benchmark: catalog, leaderboard, claims (written with protocol and source), history, compare, presets, and runs, which queue a paid execution and are refused without confirm=True. wire holds the crate's Run, Benchmark, Measure, Study, Paper and Comparison field for field; canonical writes RFC 8785 bytes equal to the crate's (tests/vectors/rust.json, written by the crate); lineage and wal are the crate's records, and a WAL the crate wrote verifies here. capture() reads the harness commit (the diff's SHA-256 when dirty), the weights' SHA-256, host, CPU, GPU, device, dtype and packages, and apply() folds them into a run. runs(org=) sends no credential: the server answers ?org= only to a caller with no org. An org the token does not belong to is refused before the request, since the server would act in the home org. The command is hanzo-research; the native CLI owns `hanzo`.
27 lines
892 B
Python
27 lines
892 B
Python
"""Reads of api.hanzo.ai that need no credential: `pytest -m integration`."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
from hanzo_research import Run, Arena, Research
|
|
|
|
pytestmark = pytest.mark.integration
|
|
|
|
|
|
def test_the_public_runs_of_hanzo():
|
|
r = Research(api_key="", repo=".")
|
|
page = r.runs(org="hanzo")
|
|
assert page.total == len(page.data) > 0
|
|
assert all(isinstance(x, Run) and x.visibility == "public" and x.canonical for x in page.data)
|
|
c = page.completion
|
|
assert c.complete + c.partial + c.inconsistent + c.unknown == page.total
|
|
first = page.data[0]
|
|
assert r.get_run(first.id, org="hanzo").id == first.id
|
|
|
|
|
|
def test_the_arena_reads():
|
|
a = Arena(api_key="")
|
|
assert any(e.id == "gpqa_diamond" for e in a.catalog())
|
|
assert a.leaderboard().benchmark == "gpqa_diamond"
|
|
assert all(c.source for c in a.claims(benchmark="gpqa_diamond"))
|