Skip to content

backend

backend

Abstract base class for inference backends.

Classes

InferenceBackend

Bases: ABC

Base class for all inference backends used in evaluation.

Attributes
framework_commit_value property
framework_commit_value: str

Default: empty (subclasses override). Used by runner.py error paths.

Methods:
generate abstractmethod
generate(
    prompt: str,
    *,
    model: str,
    system: str = "",
    temperature: float = 0.0,
    max_tokens: int = 2048,
) -> str

Generate a response and return just the text content.

Source code in src/diapason/evals/core/backend.py
@abstractmethod
def generate(
    self,
    prompt: str,
    *,
    model: str,
    system: str = "",
    temperature: float = 0.0,
    max_tokens: int = 2048,
) -> str:
    """Generate a response and return just the text content."""
generate_full abstractmethod
generate_full(
    prompt: str,
    *,
    model: str,
    system: str = "",
    temperature: float = 0.0,
    max_tokens: int = 2048,
) -> Dict[str, Any]

Generate a response and return full details.

Returns dict with keys: content, usage, model, latency_seconds, cost_usd.

Source code in src/diapason/evals/core/backend.py
@abstractmethod
def generate_full(
    self,
    prompt: str,
    *,
    model: str,
    system: str = "",
    temperature: float = 0.0,
    max_tokens: int = 2048,
) -> Dict[str, Any]:
    """Generate a response and return full details.

    Returns dict with keys: content, usage, model, latency_seconds, cost_usd.
    """
close
close() -> None

Release resources.

Source code in src/diapason/evals/core/backend.py
def close(self) -> None:
    """Release resources."""