AMRYB's picture
Upload 91 files
287f3d3 verified
Raw
History Blame Contribute Delete
1.44 kB
"""Structured output of the DevOps Agent."""
from __future__ import annotations
from pydantic import Field
from .limits import CappedListModel
def _length_hint(chars: int) -> dict[str, int]:
"""Publish a ``maxLength`` ceiling into the JSON Schema without enforcing it.
The config files are the largest single block of output in the workflow
(``github_actions`` alone measured 9.9K chars). Truncating a YAML or
Dockerfile string after the fact would corrupt it, so the ceiling is shown to
the model as guidance and never validated.
"""
return {"maxLength": chars}
class DevopsOutput(CappedListModel):
dockerfile: str = Field(..., json_schema_extra=_length_hint(1200))
docker_compose: str = Field(default="", json_schema_extra=_length_hint(1600))
ci_cd_pipeline: str = Field(default="", json_schema_extra=_length_hint(800))
github_actions: str = Field(default="", json_schema_extra=_length_hint(2000))
environment_variables: dict[str, str] = Field(default_factory=dict)
deployment_strategy: str = Field(default="", json_schema_extra=_length_hint(400))
health_checks: list[str] = Field(default_factory=list, max_length=3)
logging: list[str] = Field(default_factory=list, max_length=2)
monitoring: list[str] = Field(default_factory=list, max_length=2)
secrets_management: str = Field(default="", json_schema_extra=_length_hint(400))