Response types
Every method that talks to the API hands you back a typed object, not a bare
dict. These objects give you attribute access and autocomplete over the shapes
the API returns: a chat completion's choices, a task match's type, an eval
run's cost. They are thin: each one wraps the raw server JSON and exposes the
fields you actually use as properties.
This page is the field-by-field reference for those objects. For how the methods that return them work, see Running inference, tasks, and Evaluating models.
The shared base: every object keeps the raw JSON
All response objects inherit from one base. Two things are true of every object on this page:
.to_dict()returns the exact JSON the server sent, losslessly. The typed properties are a convenience layer over it; nothing is dropped.obj["some_key"]andobj.get("some_key", default)read raw fields directly. This is the escape hatch for any field the platform adds before the typed layer catches up.
from pareta import Pareta
pa = Pareta.from_env() # reads PARETA_API_KEY (+ optional PARETA_BASE_URL)
resp = pa.chat.completions.create(
model="auto",
messages=[{"role": "user", "content": "ping"}],
)
resp.choices[0].message.content # typed access
resp.to_dict() # the full raw JSON, lossless
resp["id"] # raw-key access for anything not yet typed
Properties return None (or an empty list) when a field is absent rather than
raising, so reading an optional field is always safe.
Inference types
These come back from chat.completions.create (route POST /v1/chat/completions).
Inference is OpenAI-compatible, so the schema matches the OpenAI chat objects.
ChatCompletion
The non-streaming result of chat.completions.create(...).
| Property | Type | Notes |
|---|---|---|
id | str | None | Completion id |
model | str | None | The model id on the completion |
created | int | None | Unix timestamp |
choices | list[Choice] | One entry per generated choice |
usage | Usage | Token counts |
resp = pa.chat.completions.create(
model="auto",
messages=[{"role": "user", "content": "Extract the effective date."}],
temperature=0,
)
print(resp.choices[0].message.content)
print(resp.usage.total_tokens)
ChatCompletionChunk
One delta from a streaming completion. Returned (one per SSE event) when you pass
stream=True. It has the same schema as ChatCompletion; it is a distinct type
purely for hinting. The incremental text lives on choices[0].delta.content, not
choices[0].message.
for chunk in pa.chat.completions.create(
model="auto",
messages=[{"role": "user", "content": "Summarize this contract."}],
stream=True,
):
print(chunk.choices[0].delta.content or "", end="", flush=True)
The or "" guard matters: the first and last chunks often carry no content (role
preamble, finish marker), so delta.content can be None mid-stream.
Choice
One element of completion.choices.
| Property | Type | Notes |
|---|---|---|
index | int | None | Position in the choices list |
finish_reason | str | None | "stop", "length", etc. |
message | Message | The full message. Populated on non-streaming results |
delta | Message | The incremental token. Populated on streaming chunks |
message and delta always return a Message (empty if absent), so reading
choice.delta.content on a non-streaming result, or vice versa, returns None
rather than blowing up.
Message
The content of a Choice.
| Property | Type | Notes |
|---|---|---|
role | str | None | "assistant", "user", etc. |
content | str | None | The text |
Usage
Token accounting on a ChatCompletion.
| Property | Type |
|---|---|
prompt_tokens | int | None |
completion_tokens | int | None |
total_tokens | int | None |
Model listing types
Returned from models.list() (route GET /v1/models). This is the
OpenAI-compatible model listing: it returns exactly one entry, "auto", so
any OpenAI-style tooling pointed at Pareta gets a sensible /models response
with the one id you send.
ModelList
| Property | Type |
|---|---|
data | list[Model] |
ModelList is directly iterable and has a length, so you usually skip .data:
models = pa.models.list()
print(len(models))
for m in models: # iterates m in models.data
print(m.id, m.owned_by)
Model
One element of a ModelList.
| Property | Type | Notes |
|---|---|---|
id | str | None | "auto". Pass straight into chat.completions.create(model=...) |
owned_by | str | None | "pareta" |
created | int | None | Unix timestamp |
Scoring types
These come from the tasks namespace and describe how your data will be scored before you
send traffic.
Task
Returned from tasks.list() and tasks.retrieve(id). One benchmarked job.
| Property | Type | Notes |
|---|---|---|
id | str | None | Stable task id, e.g. "contract-key-fields" |
default_scorer | str | None | The function that grades model output for this task |
has_blob_input | bool | True when the task takes documents or images, not just text |
for t in pa.tasks.list():
print(t.id, t.default_scorer, "doc" if t.has_blob_input else "text")
has_blob_input tells you whether you will need
evals.sets.upload_document(...) to attach binaries when you evaluate on this
task.
TaskMatch
Returned from tasks.match(query, top_k=...). The ranked result of matching
a free-text description to a task.
| Property | Type | Notes |
|---|---|---|
query | str | None | The query, echoed back |
type | str | None | "task", "capability", "unsupported", or "none" |
matched | bool | True when a high-confidence match was found |
chosen | TaskMatchCandidate | None | The best candidate, or None if nothing matched confidently |
capability | Capability | None | The general lane, when type == "capability" |
candidates | list[TaskMatchCandidate] | Top-K ranked alternates |
reasoning | str | None | The router's rationale (reasoning matcher only) |
confidence | str | None | "high" / "medium" / "low" (reasoning matcher only) |
ambiguous | bool | True when the top two scores are close |
matcher | str | None | Which strategy answered: "reason" (LLM router) or "keyword" (fallback) |
m = pa.tasks.match("pull totals and dates out of vendor invoices", top_k=5)
if m.type == "task" and m.chosen:
print("best:", m.chosen.task_id, m.chosen.score, m.chosen.confidence)
elif m.type == "capability" and m.capability:
print("capability:", m.capability.id, m.capability.label)
else:
print(m.type, "—", m.reasoning) # "unsupported" / "none"
print("via", m.matcher)
See tasks.match for the full matching semantics.
Capability
The general capability lane a match resolved to — on TaskMatch.capability when
TaskMatch.type == "capability".
| Property | Type | Notes |
|---|---|---|
id | str | None | The lane id (chat/coding/agentic/vision/asr/tts) |
label | str | None | Human-readable label |
category | str | None | Catalog category name |
category_id | str | None | Catalog category id |
desc | str | None | One-line description |
TaskMatchCandidate
An element of match.candidates (and the type of match.chosen).
| Property | Type | Notes |
|---|---|---|
task_id | str | None | The candidate task's id |
score | float | None | Match score in [0, 1] |
confidence | str | None | "high", "medium", or "low" |