Skip to main content

Syvain Metrics API Client

Use this typed Python client to find experiments and read stored metrics from Syvain Metrics. To send metrics from a training or evaluation job, use syvain-metrics-collector instead.

create_annotation() accepts text up to 16,000 characters and metadata up to 64 KiB, or 65,536 UTF-8 bytes, of compact JSON. Keys, nested values, and JSON punctuation count toward the metadata limit. Validation fails before any HTTP request. The SDK counts bytes using the API's JavaScript number formatting. The API also enforces the cap. Store larger data in an artifact and include its path or URL in the annotation. Existing larger annotations remain readable.

Install

uv add syvain-metrics-api-client

Read experiment metrics

Authenticate with the credentials saved by the Syvain Metrics CLI. Then find an experiment and query one metric:

from syvain_metrics_api_client import SyvainMetricsApiClient

with SyvainMetricsApiClient("local", timeout=60.0) as client:
	experiments = client.list_experiments(
		slug="mamba-run-001",
		limit=1,
	).experiments
	if not experiments:
		raise RuntimeError("No matching experiment found")

	experiment = experiments[0]
	catalog = client.query_metrics_catalog([experiment.id])
	batches = client.query_metric_series(
		[
			{
				"experiment_id": experiment.id,
				"metric_name": "loss",
				"metadata_filter": [
					{"key": "split", "value": "valid"},
				],
			}
		],
		order={"axis": "step", "direction": "asc"},
	)

for item in catalog:
	print(item.metric_name, item.metadata_keys)

for batch in batches:
	for step, timestamp, value in zip(
		batch.data.steps,
		batch.data.timestamp,
		batch.data.value,
		strict=True,
	):
		print(batch.metric_name, batch.metadata, step, timestamp, value)

Each MetricSeriesColumnBatch contains one experiment, metric name, and exact metadata mapping. Its steps, timestamp, and value arrays are parallel and have equal lengths.

query_metrics_catalog() returns the available metric names and metadata keys. It does not return values. Omit metric_name from a series selection to query every metric in an experiment. In a metadata filter, omit value to select every series that contains the key.

Set stream=True to parse an NDJSON response incrementally. The method still returns a complete list[MetricSeriesColumnBatch]. It requests application/vnd.syvain.metric-series+ndjson and verifies the final completion record against the received batch and row counts. A stream that ends before completion raises MetricsApiRequestError; partial results are not returned. Deploy the API support for this media type before upgrading streaming clients.

Authentication

SyvainMetricsApiClient("local") reads the credentials written by the Syvain Metrics CLI. Pass an API key directly when CLI credentials are unavailable:

client = SyvainMetricsApiClient("ak_org_...")

The client defaults to https://metrics.syvain.com. Pass host= only when you need another Metrics deployment.

Errors

Package errors inherit from MetricsApiError:

  • MetricsApiRequestError reports an HTTP failure or an unreachable API.
  • MetricsApiResponseError reports a successful response that violates the expected schema.
  • MetricsApiAuthError reports missing or invalid local CLI credentials.

Public methods and key response models carry API details in their docstrings. Use help(SyvainMetricsApiClient.query_metric_series) or your editor's Python documentation view to inspect a method.

Release files for syvain-metrics-api-client 0.0.353

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for syvain-metrics-api-client 0.0.353
File Size Uploaded
syvain_metrics_api_client-0.0.353.tar.gz 17.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for syvain-metrics-api-client 0.0.353
File Interpreter ABI Platform
syvain_metrics_api_client-0.0.353-py3-none-any.whl Python 3 none any Details

Total release size: 36.9 kB

Release files / syvain_metrics_api_client-0.0.353.tar.gz

Download URL syvain_metrics_api_client-0.0.353.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
97e76661235d3ccb4bc697536292a1f8f139f8bb644ad83361b0c2921fc3f033
BLAKE2b-256 checksum
How to use checksums
cd67e35bc52b9b7c7fa2b6d04832e3f883a17e3aa7ce538e61f628ae2e535ac9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / syvain_metrics_api_client-0.0.353-py3-none-any.whl

Download URL syvain_metrics_api_client-0.0.353-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e1191d1aa68dc478a36770f24b233eb4758a6983c5c89a0fa0d5be4a8531907
BLAKE2b-256 checksum
How to use checksums
c6dab07c589eff2d37beb12f045c70740a80f46b45411b863b8fab5ed86e71a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page