judgevet.domain.response

Status: draft.

judgevet.domain.response

Response types from Jev API.

The SystemOneResponse container holds answers with model and usage metadata. Frozen instances prevent attribute reassignment. The answers dictionary and nested answer dictionaries remain mutable. Typed accessors return fresh shallow dictionaries containing the same answer objects.

Examples:

from judgevet.domain.answers import NoulAnswer
from judgevet.domain.response import SystemOneResponse
from judgevet.domain.usage import Usage

response = SystemOneResponse(
    model="jev-latest",
    usage=Usage(input_tokens=100, output_tokens=50),
    answers={"q1": NoulAnswer(noul=0.75)},
)
assert response.model == "jev-latest"
assert response.nouls["q1"].noul == 0.75
See Also

SystemOneResponse dataclass

Answers grouped by question type with model and usage metadata.

See: https://docs.typesafe.ai/concepts/system-one

Frozen instances prevent attribute reassignment. The original answers dictionary remains mutable. Each typed property filters its current contents into a fresh dictionary. Editing that returned mapping leaves answers unchanged; the answer objects and their nested dictionaries remain shared. Missing or wrong-variant keys raise normal KeyError when indexed.

Attributes:

Name Type Description
model str

The model used to answer the request.

usage Usage

Token usage for the request.

answers dict[str, Answer]

All answer objects keyed by question name.

nouls dict[str, NoulAnswer]

Current Noul answers in a fresh dictionary.

choices dict[str, ChoiceAnswer]

Current Choice answers in a fresh dictionary.

scores dict[str, ScoreAnswer]

Current Score answers in a fresh dictionary.

Examples:

from judgevet.domain.answers import NoulAnswer
from judgevet.domain.usage import Usage

response = SystemOneResponse(
    model="jev-latest",
    usage=Usage(input_tokens=100, output_tokens=50),
    answers={"q1": NoulAnswer(noul=0.75)},
)
assert response.model == "jev-latest"
See Also

answers = field(default_factory=dict) class-attribute instance-attribute

All answer objects keyed by question name.

The field is always a dict (empty if no answers were provided).

choices property

Return a fresh plain dict of ChoiceAnswer entries from self.answers.

Returns:

Type Description
dict[str, ChoiceAnswer]

A new dict preserving insertion order with exact ChoiceAnswer object references.

dict[str, ChoiceAnswer]

Empty if no matching entries; KeyError on wrong-variant indexing.

nouls property

Return a fresh plain dict of NoulAnswer entries from self.answers.

Returns:

Type Description
dict[str, NoulAnswer]

A new dict preserving insertion order with exact NoulAnswer object references.

dict[str, NoulAnswer]

Empty if no matching entries; KeyError on wrong-variant indexing.

scores property

Return a fresh plain dict of ScoreAnswer entries from self.answers.

Returns:

Type Description
dict[str, ScoreAnswer]

A new dict preserving insertion order with exact ScoreAnswer object references.

dict[str, ScoreAnswer]

Empty if no matching entries; KeyError on wrong-variant indexing.

__repr__()

Return a string representation of the SystemOneResponse.

Returns:

Type Description
str

A string representation including model, usage, and answers.