Every gate in this repo compares a client to the document, and every build proves the client is well-formed. Neither answers the question a user actually has: does it work against a server. Seven languages now answer it -- go, python, typescript, dart, php, ruby, rust -- against the local cloud by default and against anything HANZO_BASE_URL names. Each probe asserts a 200 whose body decodes AND a 403 that arrives as an error, because a client that swallows a refusal and returns a zero value looks exactly like one that works. It earned its place on the first run: GET /v1/models is AiAPI.GetModels in Go and ai_api::get_models in Rust but ModelsApi.getModels in TypeScript. One document, three groupings, and nothing but a call finds it.
23 lines
903 B
Python
23 lines
903 B
Python
import os, sys
|
|
sys.path.insert(0, "/home/z/work/hanzo/python-sdk/pkg")
|
|
import hanzoai.cloud as c
|
|
cfg = c.Configuration(host=os.environ["HANZO_BASE_URL"])
|
|
fail = 0
|
|
with c.ApiClient(cfg) as api:
|
|
ai = c.AiApi(api)
|
|
try:
|
|
r = ai.get_models_with_http_info()
|
|
n = len((r.data or {}).get("data", [])) if isinstance(r.data, dict) else -1
|
|
print(f" ok GET /v1/models {r.status_code}")
|
|
except Exception as e:
|
|
print(" FAIL models:", type(e).__name__, str(e)[:80]); fail += 1
|
|
try:
|
|
c.EngineApi(api).engine_status()
|
|
print(" FAIL engine: unauthenticated call reported success"); fail += 1
|
|
except c.ApiException as e:
|
|
print(f" ok GET /v1/engine/status refused: {e.status}")
|
|
except Exception as e:
|
|
print(" ok refused:", type(e).__name__)
|
|
print("PASS python" if not fail else f"FAIL python ({fail})")
|
|
sys.exit(1 if fail else 0)
|