SDK reference · Python SDK
prov.trace.labels.create
prov.trace.labels.create in Python SDK. Label neurons of a trace you opened (Pro and up).
Signature
prov.trace.labels.create(trace_id: str, neurons: list[str]) -> AnyParameters
trace_idstrRequiredneuronslist[str]Required
Request fields
idstringpathRequired- The trace's ID.
neuronsarray of stringsRequired- Neuron IDs from the trace's graph (
L<layer>.<idx>.<pole>), at most 20 per request by default.
Returns
Any One item per neuron named: labelled (new, billed), cached (yours already, free), masked, not_in_trace, no_examples (the registry has no examples for it) or error (the labeller failed for it; not billed). credits is what this request billed.
HTTP operation
POST /v1/trace/traces/{id}/labels: Label neurons in a trace
Errors
- invalid_json
- parameter_invalid
- parameter_missing
- plan_required
- rate_limit_exceeded
- resource_missing
- spend_cap_reached
- trace_labeler_not_configured
Example
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/traces/trc_b9a77ee9e4b8ac4ae4335862ce6bdf85/labels`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "neurons": ["L13.1053.pos", "L20.648.neg"] }),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/trace/traces/trc_b9a77ee9e4b8ac4ae4335862ce6bdf85/labels", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"neurons": [
"L13.1053.pos",
"L20.648.neg"
]
}).json()