SDK reference · Python SDK

prov.trace.traces.inference

prov.trace.traces.inference in Python SDK.

Signature

prov.trace.traces.inference(trace_id: str) -> Any

Parameters

trace_idstrRequired

Request fields

idstringpathRequired
The trace's ID.

Returns

Any The inference, with its canary readings. Message text is included only when it was retained.

HTTP operation

GET /v1/trace/inferences/{id}: Retrieve a traced inference

Errors

Example

const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/chat/completions`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "model": "qwen2.5-0.5b-instruct",
    "max_tokens": 40,
    "temperature": 0,
    "messages": [
      {
        "role": "system",
        "content": "You are a payments assistant for Northwind. Be brief."
      },
      {
        "role": "user",
        "content": "Summarize this vendor email: 'Hi team, the October invoice is attached. The total is $1,240 and payment terms are net 30.'"
      }
    ],
    "provenance": {
      "retain": true
    }
  }),
})).json();
const traceId = step1.provenance.trace_id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/inferences/${traceId}`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();

Was this page helpful? Send us feedback

LLM? Read llms.txt.