94 lines
2.8 KiB
Python
94 lines
2.8 KiB
Python
"""模型能力矩阵相关 Pydantic 模型"""
|
||
|
||
from typing import Literal, Optional
|
||
|
||
from pydantic import BaseModel, Field
|
||
|
||
|
||
class ValidateMatchRequest(BaseModel):
|
||
"""模型-需求匹配校验请求"""
|
||
|
||
truth_node_id: int = Field(..., description="宪章节点 ID")
|
||
model_version_id: int = Field(..., description="模型版本 ID")
|
||
project_id: Optional[int] = Field(default=None, description="项目 ID(用于交叉校验)")
|
||
|
||
|
||
class CostTrackingQuery(BaseModel):
|
||
"""成本跟踪查询参数"""
|
||
|
||
period: str = Field(default="weekly", description="周期: daily/weekly/monthly/project")
|
||
|
||
|
||
class CostOptimizationQuery(BaseModel):
|
||
"""成本优化查询参数"""
|
||
|
||
period: str = Field(default="weekly", description="周期: daily/weekly/monthly/project")
|
||
|
||
|
||
class LifecycleImpactRequest(BaseModel):
|
||
"""模型生命周期影响评估请求"""
|
||
|
||
old_model_version_id: int = Field(..., description="旧模型版本 ID")
|
||
new_model_version_id: int = Field(..., description="新模型版本 ID")
|
||
|
||
|
||
class GenerateMigrationTasksRequest(BaseModel):
|
||
"""生成迁移任务请求"""
|
||
|
||
max_tasks: int = Field(default=5, ge=1, le=20, description="最多生成任务数")
|
||
|
||
|
||
class ExperimentSyncRequest(BaseModel):
|
||
"""实验结果同步请求"""
|
||
|
||
experiment_id: int = Field(..., description="实验 ID")
|
||
truth_node_id: int = Field(..., description="目标宪章 ID")
|
||
project_id: Optional[int] = Field(default=None, description="项目 ID(用于交叉校验)")
|
||
sync_type: Literal["result_sync", "metric_update", "conclusion_sync"] = Field(
|
||
default="result_sync",
|
||
description="同步类型",
|
||
)
|
||
auto_apply_threshold: float = Field(
|
||
default=0.8, ge=0.0, le=1.0, description="自动应用阈值"
|
||
)
|
||
|
||
|
||
class ExperimentSyncReviewRequest(BaseModel):
|
||
"""实验同步审核请求"""
|
||
|
||
action: Literal["approve", "reject"] = Field(..., description="审核动作")
|
||
review_notes: Optional[str] = Field(default=None, description="审核备注")
|
||
|
||
|
||
class ExperimentSyncRollbackRequest(BaseModel):
|
||
"""实验同步回滚请求"""
|
||
|
||
rollback_notes: Optional[str] = Field(default=None, description="回滚备注")
|
||
|
||
|
||
class CostOptimizationAnalyzeRequest(BaseModel):
|
||
"""成本优化分析请求"""
|
||
|
||
truth_node_id: int = Field(..., description="宪章 ID")
|
||
project_id: Optional[int] = Field(default=None, description="项目 ID(用于交叉校验)")
|
||
period: str = Field(default="weekly", description="周期: daily/weekly/monthly/project")
|
||
|
||
|
||
class ProjectTruthNodeContextItem(BaseModel):
|
||
"""项目上下文中的宪章项"""
|
||
|
||
id: int
|
||
title: str
|
||
status: str
|
||
node_type: str
|
||
|
||
|
||
class ProjectExperimentContextItem(BaseModel):
|
||
"""项目上下文中的实验项"""
|
||
|
||
id: int
|
||
title: str
|
||
status: str
|
||
target_metric: Optional[str] = None
|
||
|