olivlawolivlaw

Author

Pydantic (documentația oficială)

1 reading card from 1 book · 2026.

1 card

  1. Pydantic AI — documentația modelului TypeSafe (Jev) · 2026

    With Jev, the question sits on the typed output field, and the text you send is only what is being judged.

    Two paths in Python, one model. The company's SDK (`typesafe-sdk`, Python 3.10+) exposes a single call, `system_one(state, questions)`, with the Choice, Score and Noul objects; it reads the key from the TYPESAFE_API_KEY environment variable, retries rate limits automatically and raises typed exceptions. The second path is Pydantic AI, which treats Jev as an ordinary model (`typesafe:jev-latest`) but with one rule turned around: you do not write a prompt containing the question, you write an `output_type` whose fields are the questions, and the text you send is only what is being judged. The type table is the contract. `bool` or `Literal[True, False]` = yes/no, decided at `typesafe_boolean_threshold` (default 0.5); `Literal[...]` or `Enum` = pick one; `float` with `ge=0, le=1` = a probability; `IntEnum` with docstrings = a scoring rubric; `list[Literal]` = yes/no per option; a nested model = composed questions. `str`, unbounded `int`, `datetime` or unions of models raise `UserError` — the model generates no text and the documentation refuses to pretend otherwise. What comes back beyond the object: `result.response.provider_details` carries `confidence` (the margin from the threshold, 0–1), `probabilities` (the distribution over options) and `scores` (the unrounded rubric position). When `output_type` is a list of types or the agent has tools, Jev makes two requests: the first picks the route, the second fills that route's fields; `provider_details['requests']` says how many there were. For cases it cannot judge there is `FallbackModel`, with an LLM behind it.

    “The prompt is only what is being judged, and the question belongs on the output type.”

    Open the card →