Skip to main content

hackagent.models.response

Normalized responses returned by model backends.

ModelResponse Objects​

@dataclass
class ModelResponse()

Backend-independent view of a model completion response.

latency_ms​

How long the call took, in milliseconds, when its caller timed it.

failed​

@classmethod
def failed(cls, error: Exception) -> "ModelResponse"

Represent provider failures without losing their status or category.

reasoning​

@property
def reasoning() -> Optional[str]

Return reasoning content using a backend-independent name.

from_value​

@classmethod
def from_value(cls, value: Any) -> "ModelResponse"

Normalize common values, including LiteLLM ModelResponse objects.

from_litellm​

@classmethod
def from_litellm(cls, value: Any) -> "ModelResponse"

Normalize a LiteLLM ModelResponse without discarding its metadata.