Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/omnibase_infra/enums/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@
from omnibase_infra.enums.enum_dedupe_strategy import EnumDedupeStrategy
from omnibase_infra.enums.enum_dispatch_status import EnumDispatchStatus
from omnibase_infra.enums.enum_environment import EnumEnvironment
from omnibase_infra.enums.enum_eval_finding_category import EnumEvalFindingCategory
from omnibase_infra.enums.enum_eval_finding_severity import EnumEvalFindingSeverity
from omnibase_infra.enums.enum_eval_task_status import EnumEvalTaskStatus
from omnibase_infra.enums.enum_eval_task_type import EnumEvalTaskType
from omnibase_infra.enums.enum_execution_shape_violation import (
EnumExecutionShapeViolation,
)
Expand Down Expand Up @@ -151,6 +155,10 @@
"EnumDedupeStrategy",
"EnumDispatchStatus",
"EnumEnvironment",
"EnumEvalFindingCategory",
"EnumEvalFindingSeverity",
"EnumEvalTaskStatus",
"EnumEvalTaskType",
Comment thread
jonahgabriel marked this conversation as resolved.
"EnumExecutionShapeViolation",
"EnumHandlerErrorType",
"EnumHandlerLoaderError",
Expand Down
28 changes: 28 additions & 0 deletions src/omnibase_infra/enums/enum_eval_finding_category.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc.
# SPDX-License-Identifier: MIT
"""Eval finding category enum.

Related:
- OMN-6795: Define eval task models and enums

.. versionadded:: 0.29.0
"""

from __future__ import annotations

from enum import Enum


class EnumEvalFindingCategory(str, Enum):
"""Category of an evaluation finding."""

BUG = "bug"
TECH_DEBT = "tech_debt"
DOC_STALE = "doc_stale"
REGRESSION_RISK = "regression_risk"
SECURITY = "security"
PERFORMANCE = "performance"
STYLE = "style"


__all__: list[str] = ["EnumEvalFindingCategory"]
Comment thread
coderabbitai[bot] marked this conversation as resolved.
25 changes: 25 additions & 0 deletions src/omnibase_infra/enums/enum_eval_finding_severity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc.
# SPDX-License-Identifier: MIT
"""Eval finding severity enum.

Related:
- OMN-6795: Define eval task models and enums

.. versionadded:: 0.29.0
"""

from __future__ import annotations

from enum import Enum


class EnumEvalFindingSeverity(str, Enum):
"""Severity level of an evaluation finding."""

HIGH = "high"
MEDIUM = "medium"
LOW = "low"
INFO = "info"


__all__: list[str] = ["EnumEvalFindingSeverity"]
26 changes: 26 additions & 0 deletions src/omnibase_infra/enums/enum_eval_task_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc.
# SPDX-License-Identifier: MIT
"""Eval task status enum.

Related:
- OMN-6795: Define eval task models and enums

.. versionadded:: 0.29.0
"""

from __future__ import annotations

from enum import Enum


class EnumEvalTaskStatus(str, Enum):
"""Status of an evaluation task."""

PENDING = "pending"
RUNNING = "running"
COMPLETED = "completed"
FAILED = "failed"
BUDGET_EXHAUSTED = "budget_exhausted"


__all__: list[str] = ["EnumEvalTaskStatus"]
41 changes: 41 additions & 0 deletions src/omnibase_infra/enums/enum_eval_task_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc.
# SPDX-License-Identifier: MIT
"""Eval task type enum for autonomous off-peak evaluations.

Defines the types of evaluation tasks that can be dispatched to
cheap LLM providers (Gemini Flash, GLM, local small models) during
off-peak periods.

Related:
- OMN-6795: Define eval task models and enums

.. versionadded:: 0.29.0
"""

from __future__ import annotations

from enum import Enum


class EnumEvalTaskType(str, Enum):
"""Types of autonomous evaluation tasks.

Each type maps to a specific prompt template and evaluation
strategy in ``ServiceEvalRunner``.

Attributes:
CODE_REVIEW: Automated code review of recently changed files.
TECH_DEBT_SCAN: Scan for tech debt patterns and anti-patterns.
DOC_FRESHNESS: Check documentation freshness against code changes.
REGRESSION_TEST: Run regression test analysis on changed paths.
HOSTILE_REVIEW: Adversarial review looking for subtle bugs.
"""

CODE_REVIEW = "code_review"
TECH_DEBT_SCAN = "tech_debt_scan"
DOC_FRESHNESS = "doc_freshness"
REGRESSION_TEST = "regression_test"
HOSTILE_REVIEW = "hostile_review"


__all__: list[str] = ["EnumEvalTaskType"]
24 changes: 18 additions & 6 deletions src/omnibase_infra/models/eval/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc.
# SPDX-License-Identifier: MIT
"""Auto-eval models for autonomous LLM evaluation (OMN-6795).
"""Eval models for autonomous evaluation tasks.

Exports:
ModelAutoEvalTask: Defines a single evaluation task to run against an LLM endpoint.
ModelAutoEvalResult: Result of executing an eval task, with scores and cost.
ModelAutoEvalBudgetCap: Budget constraints for eval execution windows.
ModelAutoEvalTask: Defines a single auto-evaluation task to run against an LLM endpoint.
ModelAutoEvalResult: Result of executing an auto-eval task, with scores and cost.
ModelAutoEvalBudgetCap: Budget constraints for auto-eval execution windows.
ModelEvalBudgetCap: Budget cap for eval tasks.
ModelEvalFinding: Individual eval finding.
ModelEvalResult: Result of an eval run.
ModelEvalTask: Eval task definition.
"""

from omnibase_infra.models.eval.model_auto_eval_budget_cap import (
ModelAutoEvalBudgetCap,
)
from omnibase_infra.models.eval.model_auto_eval_result import ModelAutoEvalResult
from omnibase_infra.models.eval.model_auto_eval_task import ModelAutoEvalTask
from omnibase_infra.models.eval.model_eval_budget_cap import ModelEvalBudgetCap
from omnibase_infra.models.eval.model_eval_finding import ModelEvalFinding
from omnibase_infra.models.eval.model_eval_result import ModelEvalResult
from omnibase_infra.models.eval.model_eval_task import ModelEvalTask

__all__: list[str] = [
"ModelAutoEvalTask",
"ModelAutoEvalResult",
"ModelAutoEvalBudgetCap",
"ModelAutoEvalResult",
"ModelAutoEvalTask",
"ModelEvalBudgetCap",
"ModelEvalFinding",
"ModelEvalResult",
"ModelEvalTask",
]
47 changes: 47 additions & 0 deletions src/omnibase_infra/models/eval/model_eval_budget_cap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc.
# SPDX-License-Identifier: MIT
"""Budget cap model for autonomous off-peak evaluations.

Related:
- OMN-6795: Define eval task models and enums

.. versionadded:: 0.29.0
"""

from __future__ import annotations

from pydantic import BaseModel, ConfigDict, Field


class ModelEvalBudgetCap(BaseModel):
"""Budget cap for autonomous evaluation tasks.

Controls spending across evaluation windows to prevent runaway costs.

Attributes:
max_tokens_per_window: Maximum total tokens across all tasks in a window.
max_cost_usd_per_window: Maximum total cost in USD per window.
window_hours: Duration of the budget window in hours.
"""

model_config = ConfigDict(frozen=True, extra="forbid")

max_tokens_per_window: int = Field(
default=500_000,
ge=1000,
description="Max tokens per budget window.",
)
max_cost_usd_per_window: float = Field(
default=1.0,
ge=0.01,
description="Max cost in USD per budget window.",
)
window_hours: int = Field(
default=24,
ge=1,
le=168,
description="Budget window duration in hours.",
)


__all__: list[str] = ["ModelEvalBudgetCap"]
41 changes: 41 additions & 0 deletions src/omnibase_infra/models/eval/model_eval_finding.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc.
# SPDX-License-Identifier: MIT
"""Eval finding model for autonomous off-peak evaluations.

Related:
- OMN-6795: Define eval task models and enums

.. versionadded:: 0.29.0
"""

from __future__ import annotations

from pydantic import BaseModel, ConfigDict, Field

from omnibase_infra.enums.enum_eval_finding_category import EnumEvalFindingCategory
from omnibase_infra.enums.enum_eval_finding_severity import EnumEvalFindingSeverity


class ModelEvalFinding(BaseModel):
"""A single finding from an evaluation task.

Attributes:
severity: Finding severity level.
category: Finding category.
file_path: File path where the finding was detected.
line_number: Line number (0 if not applicable).
description: Human-readable description of the finding.
suggestion: Suggested fix or action.
"""

model_config = ConfigDict(frozen=True, extra="forbid")

severity: EnumEvalFindingSeverity = Field(..., description="Severity level.")
category: EnumEvalFindingCategory = Field(..., description="Finding category.")
file_path: str = Field(default="", description="File path of the finding.")
line_number: int = Field(default=0, ge=0, description="Line number.")
description: str = Field(..., description="Description of the finding.")
suggestion: str = Field(default="", description="Suggested fix.")


__all__: list[str] = ["ModelEvalFinding"]
55 changes: 55 additions & 0 deletions src/omnibase_infra/models/eval/model_eval_result.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc.
# SPDX-License-Identifier: MIT
"""Eval result model for autonomous off-peak evaluations.

Related:
- OMN-6795: Define eval task models and enums
- OMN-6796: Build eval runner service

.. versionadded:: 0.29.0
"""

from __future__ import annotations

from uuid import UUID

from pydantic import BaseModel, ConfigDict, Field

from omnibase_infra.models.eval.model_eval_finding import ModelEvalFinding


class ModelEvalResult(BaseModel):
"""Result of an evaluation task execution.

Attributes:
task_id: The ID of the completed task.
findings: List of findings from the evaluation.
high_count: Number of high-severity findings.
medium_count: Number of medium-severity findings.
low_count: Number of low-severity findings.
tokens_used: Total tokens consumed.
actual_cost_usd: Actual cost in USD.
duration_ms: Execution duration in milliseconds.
llm_model_label: Human-readable label of model used.
llm_provider_label: Human-readable label of the provider that served the request.
"""

model_config = ConfigDict(frozen=True, extra="forbid")

task_id: UUID = Field(..., description="Task identifier.")
findings: tuple[ModelEvalFinding, ...] = Field(
default_factory=tuple, description="Findings from the evaluation."
)
high_count: int = Field(default=0, ge=0, description="High-severity count.")
medium_count: int = Field(default=0, ge=0, description="Medium-severity count.")
low_count: int = Field(default=0, ge=0, description="Low-severity count.")
tokens_used: int = Field(default=0, ge=0, description="Total tokens consumed.")
actual_cost_usd: float = Field(default=0.0, ge=0.0, description="Actual cost.")
duration_ms: int = Field(default=0, ge=0, description="Execution duration in ms.")
llm_model_label: str = Field(default="", description="Model used.")
llm_provider_label: str = Field(
default="", description="Provider that served request."
)


__all__: list[str] = ["ModelEvalResult"]
63 changes: 63 additions & 0 deletions src/omnibase_infra/models/eval/model_eval_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# SPDX-FileCopyrightText: 2025 OmniNode.ai Inc.
# SPDX-License-Identifier: MIT
"""Eval task model for autonomous off-peak evaluations.

Defines the task request model used by ``ServiceEvalRunner``
to dispatch evaluation tasks to cheap LLM providers.

Related:
- OMN-6795: Define eval task models and enums
- OMN-6796: Build eval runner service

.. versionadded:: 0.29.0
"""

from __future__ import annotations

from uuid import UUID, uuid4

from pydantic import BaseModel, ConfigDict, Field

from omnibase_infra.enums.enum_eval_task_status import EnumEvalTaskStatus
from omnibase_infra.enums.enum_eval_task_type import EnumEvalTaskType


class ModelEvalTask(BaseModel):
"""An evaluation task to be dispatched to a cheap LLM provider.

Attributes:
task_id: Unique identifier for this task.
task_type: The type of evaluation to perform.
target_repo: Repository name to evaluate (e.g., "omnibase_infra").
target_path: Specific file or directory path to evaluate.
llm_model_label: Human-readable LLM model label for evaluation.
max_tokens: Maximum token budget for this individual task.
estimated_cost_usd: Estimated cost in USD for this task.
status: Current task status.
"""

model_config = ConfigDict(frozen=True, extra="forbid")

task_id: UUID = Field(default_factory=uuid4, description="Unique task identifier.")
task_type: EnumEvalTaskType = Field(
..., description="Type of evaluation to perform."
)
target_repo: str = Field(..., min_length=1, description="Repository to evaluate.")
target_path: str = Field(
default="", description="File or directory path within the repo."
)
llm_model_label: str = Field(
default="", description="LLM model to use (empty = auto-select via bifrost)."
)
max_tokens: int = Field(
default=4096, ge=256, le=131072, description="Max tokens for this task."
)
estimated_cost_usd: float = Field(
default=0.0, ge=0.0, description="Estimated cost in USD."
)
status: EnumEvalTaskStatus = Field(
default=EnumEvalTaskStatus.PENDING, description="Task status."
)


__all__: list[str] = ["ModelEvalTask"]
Loading
Loading