Repository navigation
feat: LLM dispatch wiring, eval models, bifrost config loader [OMN-6785] #1063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
232c4b2
feat: add LLM dispatch wiring, eval models, and bifrost config loader…
jonahgabriel 0da75d9
Merge origin/main — resolve bifrost config, contract, and topic confl…
jonahgabriel 7271c84
fix: resolve CI failures and address review feedback [OMN-6785]
jonahgabriel 4d7e27b
merge: resolve conflict in eval models __init__ after main merge
jonahgabriel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.