Publish curated ITWorx-ModelForge source from 990401737f96c8d46a9f7b0d84994516cadcb6a0
This commit is contained in:
1 parent
7082ab955a
commit
848f0d8f8a
434 files changed
+67298
-4315
No files matched your search
@@ -8,7 +8,7 @@ import uuid
|
||||
from datetime import datetime
|
||||
from typing import Any, Literal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
|
||||
from pydantic import AwareDatetime, BaseModel, ConfigDict, Field, field_validator, model_validator
|
||||
|
||||
CAPABILITY_VERSION_KEY = re.compile(r"^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)+@[1-9][0-9]*$")
|
||||
ServingOperation = Literal["load", "invoke", "health", "drain", "unload"]
|
||||
@@ -119,6 +119,7 @@ class ResidencyResponse(ServingModel):
|
||||
|
||||
class CapabilityDeploymentResponse(ServingModel):
|
||||
id: uuid.UUID
|
||||
route_generation: int = Field(ge=0)
|
||||
capability: str
|
||||
contract_version: int
|
||||
deployment_candidate_id: uuid.UUID
|
||||
@@ -159,7 +160,8 @@ class ServiceClientCreate(ServingModel):
|
||||
project_key: str | None = Field(default=None, pattern=r"^[a-z][a-z0-9-]*$")
|
||||
integration_environment: Literal["production", "shadow", "evaluation", "lab"] | None = None
|
||||
purpose: str | None = Field(default=None, min_length=3, max_length=500)
|
||||
credential_expires_at: datetime | None = None
|
||||
credential_expires_at: AwareDatetime | None = None
|
||||
project_binding_id: uuid.UUID | None = None
|
||||
|
||||
@field_validator("allowed_capabilities")
|
||||
@classmethod
|
||||
@@ -176,9 +178,13 @@ class ServiceClientCreate(ServingModel):
|
||||
if any(value is not None for value in project_fields) and not all(
|
||||
value is not None for value in project_fields
|
||||
):
|
||||
raise ValueError("project_key, integration_environment and purpose are required together")
|
||||
raise ValueError(
|
||||
"project_key, integration_environment and purpose are required together"
|
||||
)
|
||||
if self.project_key is not None and len(self.allowed_capabilities) != 1:
|
||||
raise ValueError("a project service identity must bind exactly one capability")
|
||||
if self.project_binding_id is not None and self.project_key is None:
|
||||
raise ValueError("an explicit binding requires a project identity")
|
||||
return self
|
||||
|
||||
|
||||
@@ -195,6 +201,7 @@ class ServiceClientResponse(ServingModel):
|
||||
integration_environment: str | None
|
||||
purpose: str | None
|
||||
credential_prefix: str | None
|
||||
credential_id: uuid.UUID | None = None
|
||||
credential_created_at: datetime | None
|
||||
credential_expires_at: datetime | None
|
||||
credential_revoked_at: datetime | None
|
||||
@@ -206,20 +213,35 @@ class ServiceClientCreated(ServiceClientResponse):
|
||||
credential: str
|
||||
|
||||
|
||||
class ServiceCredentialRotate(ServingModel):
|
||||
expected_credential_id: uuid.UUID
|
||||
overlap_seconds: int = Field(default=0, strict=True, ge=0, le=86400)
|
||||
expires_at: AwareDatetime
|
||||
|
||||
|
||||
class ServiceCredentialRevoke(ServingModel):
|
||||
expected_credential_id: uuid.UUID
|
||||
confirmation: str = Field(min_length=1, max_length=255)
|
||||
|
||||
|
||||
class ServiceCredentialResponse(ServingModel):
|
||||
id: uuid.UUID
|
||||
secret_prefix: str
|
||||
created_at: datetime
|
||||
expires_at: datetime | None
|
||||
superseded_at: datetime | None
|
||||
revoked_at: datetime | None
|
||||
last_used_at: datetime | None
|
||||
|
||||
|
||||
class ProjectFitEvidenceCreate(ServingModel):
|
||||
project_key: str = Field(pattern=r"^[a-z][a-z0-9-]*$")
|
||||
capability: str = Field(pattern=r"^[a-z][a-z0-9.]*@[1-9][0-9]*$")
|
||||
environment: Literal["production", "shadow", "evaluation", "lab"]
|
||||
recommendation: Literal[
|
||||
"PROMOTION_ELIGIBLE", "KEEP_LAB", "BLOCKED", "REQUIRES_MORE_EVIDENCE"
|
||||
]
|
||||
evidence_class: Literal[
|
||||
"OWNER_PHOTO", "PUBLIC_PHYSICAL_CAPTURE", "CATALOG_REFERENCE"
|
||||
]
|
||||
recommendation: Literal["PROMOTION_ELIGIBLE", "KEEP_LAB", "BLOCKED", "REQUIRES_MORE_EVIDENCE"]
|
||||
evidence_class: Literal["OWNER_PHOTO", "PUBLIC_PHYSICAL_CAPTURE", "CATALOG_REFERENCE"]
|
||||
engineering_integration: Literal["PASS", "INCOMPLETE", "BLOCKED"]
|
||||
production_validation: Literal[
|
||||
"DEFERRED_EXTERNAL_VALIDATION", "REQUIRED", "SATISFIED"
|
||||
]
|
||||
production_validation: Literal["DEFERRED_EXTERNAL_VALIDATION", "REQUIRED", "SATISFIED"]
|
||||
production_action: Literal["NONE"] = "NONE"
|
||||
case_count: int = Field(ge=0, le=1_000_000)
|
||||
metric_values: dict[str, float | int | str | bool | None]
|
||||
@@ -693,6 +715,7 @@ class AgentServingJobLease(ServingModel):
|
||||
top_n: int | None = Field(default=None, ge=1, le=10)
|
||||
modality_payload: dict[str, Any] | None = None
|
||||
request_id: uuid.UUID | None = None
|
||||
lab_run_id: uuid.UUID | None = None
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_capability_payload(self) -> AgentServingJobLease:
|
||||
@@ -736,6 +759,20 @@ class AgentServingJobFailure(ServingModel):
|
||||
details: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class AgentServingJobCancellationCheck(ServingModel):
|
||||
lease_token: str = Field(min_length=32, max_length=512)
|
||||
|
||||
|
||||
class AgentServingJobCancellationStatus(ServingModel):
|
||||
cancel_requested: bool
|
||||
|
||||
|
||||
class AgentServingJobCancellationAck(ServingModel):
|
||||
lease_token: str = Field(min_length=32, max_length=512)
|
||||
worker_instance_id: str = Field(min_length=1, max_length=255)
|
||||
state: Literal["cold", "warm", "busy", "loading", "draining", "unloading", "failed"]
|
||||
|
||||
|
||||
class AgentResidentState(ServingModel):
|
||||
deployment_id: uuid.UUID
|
||||
artifact_set_id: uuid.UUID
|
||||
|
||||
Reference in new issue
Block a user