maxent_grpo.training.generation.errors

Shared service error payloads for external generation backends.

Functions

log_generation_service_error(logger, stage, ...)

Emit a structured log entry for a failed generation call.

Classes

ServiceErrorPayload(service, endpoint, ...)

Structured metadata capturing a failed external service request.

Exceptions

GenerationServiceError(message, payload)

Raised when external generation services exhaust their retries.

exception maxent_grpo.training.generation.errors.GenerationServiceError(message, payload)[source]

Bases: RuntimeError

Raised when external generation services exhaust their retries.

Parameters:
Return type:

None

to_dict()[source]

Structured representation including the human-readable message.

Return type:

dict[str, object]

to_json()[source]

JSON string suitable for structured log/event ingestion.

Return type:

str

class maxent_grpo.training.generation.errors.ServiceErrorPayload(service, endpoint, model, prompt_count, payload_chars, payload_size_bytes, status_code, attempt, max_attempts, exception_type, exception_message, request_id=None, extra=<factory>)[source]

Bases: object

Structured metadata capturing a failed external service request.

Parameters:
  • service (str)

  • endpoint (str)

  • model (str | None)

  • prompt_count (int)

  • payload_chars (int)

  • payload_size_bytes (int | None)

  • status_code (int | None)

  • attempt (int)

  • max_attempts (int)

  • exception_type (str)

  • exception_message (str)

  • request_id (str | None)

  • extra (dict[str, object])

service: str
endpoint: str
model: str | None
prompt_count: int
payload_chars: int
payload_size_bytes: int | None
status_code: int | None
attempt: int
max_attempts: int
exception_type: str
exception_message: str
request_id: str | None = None
extra: dict[str, object]
to_dict()[source]

Return a JSON-friendly dictionary for structured logging.

Return type:

dict[str, object]

to_json()[source]

Serialize the payload to JSON for log aggregation.

Return type:

str

copy_with(**updates)[source]

Return a shallow copy with the provided field overrides.

Parameters:

updates (object)

Return type:

ServiceErrorPayload

maxent_grpo.training.generation.errors.log_generation_service_error(logger, stage, error)[source]

Emit a structured log entry for a failed generation call.

Parameters:
Return type:

None