AI Improvement Round Result (execution/improvement_results.py)

autocontext · autocontext/src/autocontext/execution/improvement_results.py · python · Apache-2.0
ai, lang:python, tag:optimization, tag:dataclass

A data contract representing the outcome of an AI-driven improvement iteration. Use this to track scores, reasoning, and termination reasons during automated optimization tasks.

# Source: https://github.com/greyhaven-ai/autocontext | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""Result contracts shared by improvement execution and its consumers."""

from __future__ import annotations

from dataclasses import dataclass, field
from typing import Any, Literal

TerminationReason = Literal[
    "threshold_met",
    "max_rounds",
    "plateau_stall",
    "unchanged_output",
    "consecutive_failures",
]


@dataclass(slots=True)
class RoundResult:
    """Result from a single improvement round."""

    round_number: int
    output: str
    score: float
    reasoning: str
    dimension_scores: dict[str, float] = field(default_factory=dict)
    is_revision: bool 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key