Skip to main content

hackagent.models.config

Model configuration.

:class:ModelConfig is the declarative description of a model (name, transport, sampling) used everywhere a campaign names one: the target, the attack roles, and the judges. :class:ModelConnection and :class:ModelGeneration are the resolved LiteLLM arguments built from it.

ConnectionSpec Objects​

class ConnectionSpec(BaseModel)

How to reach a model: which client to use, where it lives, and how to authenticate.

GenerationSpec Objects​

class GenerationSpec(BaseModel)

Sampling settings applied to every request the model receives. All optional: anything left unset uses the provider's own default.

ModelConfig Objects​

class ModelConfig(BaseModel)

A model HackAgent talks to: its name, how to reach it, and how to sample from it.

The same shape describes the target, every attack helper (role), every judge, every guardrail and the goal classifier.

ModelGeneration Objects​

class ModelGeneration(GenerationSpec)

Validated generation defaults shared by model implementations.

validate_extra_kwargs​

@model_validator(mode="after")
def validate_extra_kwargs() -> "ModelGeneration"

Keep transport and unsupported streaming options out of generation.

to_kwargs​

def to_kwargs() -> Dict[str, Any]

Return non-null generation arguments for a completion call.

ModelConnection Objects​

class ModelConnection(BaseModel)

Validated LiteLLM provider and transport settings.

to_litellm​

def to_litellm() -> Dict[str, Any]

Resolve secrets and return LiteLLM connection arguments.