mud_server.api.models_lab ========================= .. py:module:: mud_server.api.models_lab .. autoapi-nested-parse:: Lab-facing API models for DB-first policy and translation workflows. This module intentionally exports only models that back active ``/api/lab/*`` routes. Legacy file-authoring draft models were removed as part of the DB-only runtime transition, so clients interacting with this contract should assume: 1. Canonical policy state is resolved from SQLite policy tables. 2. Effective runtime behavior is selected through policy activations by scope. 3. Lab endpoints are diagnostic/authoring helpers on top of canonical DB data. Classes ------- .. autoapisummary:: mud_server.api.models_lab.LabAxisValue mud_server.api.models_lab.LabWorldConfig mud_server.api.models_lab.LabWorldSummary mud_server.api.models_lab.LabWorldsResponse mud_server.api.models_lab.LabImagePolicyBundleResponse mud_server.api.models_lab.LabTranslateRequest mud_server.api.models_lab.LabTranslateResponse mud_server.api.models_lab.LabImageCompileRequest mud_server.api.models_lab.LabImageCompileResponse Module Contents --------------- .. py:class:: LabAxisValue(/, **data) Bases: :py:obj:`pydantic.BaseModel` One axis value supplied by a lab client. ``label`` carries the user-facing categorical name and ``score`` carries the deterministic numeric value used by downstream policy compilation. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: label :type: str .. py:attribute:: score :type: float .. py:class:: LabWorldConfig(/, **data) Bases: :py:obj:`pydantic.BaseModel` Translation layer configuration snapshot for one world. Returned to clients so they can inspect which runtime translation settings were actually applied by the server for the selected world. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: world_id :type: str .. py:attribute:: name :type: str .. py:attribute:: model :type: str .. py:attribute:: active_axes :type: list[str] .. py:attribute:: strict_mode :type: bool .. py:attribute:: max_output_chars :type: int .. py:attribute:: timeout_seconds :type: float .. py:attribute:: translation_enabled :type: bool .. py:class:: LabWorldSummary(/, **data) Bases: :py:obj:`pydantic.BaseModel` One world entry shown in the lab world-selector. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: world_id :type: str .. py:attribute:: name :type: str .. py:attribute:: translation_enabled :type: bool .. py:class:: LabWorldsResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Response payload for ``GET /api/lab/worlds``. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: worlds :type: list[LabWorldSummary] .. py:class:: LabImagePolicyBundleResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` DB-resolved image policy bundle for one world scope. This payload mirrors the canonical image policy bundle contract consumed by integration clients. Path-like fields are informational identifiers retained for compatibility with existing clients; canonical resolution happens in DB. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: world_id :type: str .. py:attribute:: policy_schema :type: str | None .. py:attribute:: policy_bundle_id :type: str | None .. py:attribute:: policy_bundle_version :type: int | str | None .. py:attribute:: policy_hash :type: str .. py:attribute:: composition_order :type: list[str] .. py:attribute:: required_runtime_inputs :type: list[str] .. py:attribute:: descriptor_layer_path :type: str | None .. py:attribute:: tone_profile_path :type: str | None .. py:attribute:: species_registry_path :type: str | None .. py:attribute:: clothing_registry_path :type: str | None .. py:attribute:: missing_components :type: list[str] .. py:class:: LabTranslateRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Request payload for ``POST /api/lab/translate``. ``prompt_template_override`` is request-local and never mutates canonical prompt policy rows. It exists to support one-off lab experimentation. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: session_id :type: str .. py:attribute:: world_id :type: str .. py:attribute:: axes :type: dict[str, LabAxisValue] .. py:attribute:: channel :type: str :value: 'say' .. py:attribute:: ooc_message :type: str .. py:attribute:: character_name :type: str :value: 'Lab Subject' .. py:attribute:: seed :type: int :value: -1 .. py:attribute:: temperature :type: float :value: 0.7 .. py:attribute:: prompt_template_override :type: str | None :value: None .. py:class:: LabTranslateResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Response payload for ``POST /api/lab/translate``. Includes both generated text and debugging context (rendered prompt, active prompt template, and world config) so operators can audit behavior. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: ic_text :type: str | None .. py:attribute:: status :type: str .. py:attribute:: profile_summary :type: str .. py:attribute:: rendered_prompt :type: str .. py:attribute:: prompt_template :type: str .. py:attribute:: model :type: str .. py:attribute:: world_config :type: LabWorldConfig .. py:class:: LabImageCompileRequest(/, **data) Bases: :py:obj:`pydantic.BaseModel` Request payload for ``POST /api/lab/compile-image-prompt``. The request combines fixed traits, runtime axis values, and optional contextual tags. The server composes these inputs against activated policy objects to produce a deterministic image prompt bundle output. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: session_id :type: str .. py:attribute:: world_id :type: str .. py:attribute:: species :type: str .. py:attribute:: gender :type: str .. py:attribute:: axes :type: dict[str, LabAxisValue] .. py:attribute:: world_context :type: list[str] :value: None .. py:attribute:: occupation_signals :type: list[str] :value: None .. py:attribute:: model_id :type: str | None :value: None .. py:attribute:: aspect_ratio :type: str | None :value: None .. py:attribute:: seed :type: int | None :value: None .. py:method:: validate_gender() Normalize and validate fixed-trait gender values for phase-1 compile. .. py:class:: LabImageCompileResponse(/, **data) Bases: :py:obj:`pydantic.BaseModel` Response payload for ``POST /api/lab/compile-image-prompt``. Returns selected policy object identities and deterministic hashes so downstream tools can trace exactly which canonical variants were used. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: world_id :type: str .. py:attribute:: policy_schema :type: str | None .. py:attribute:: policy_bundle_id :type: str | None .. py:attribute:: policy_bundle_version :type: int | str | None .. py:attribute:: policy_hash :type: str .. py:attribute:: axis_hash :type: str .. py:attribute:: required_runtime_inputs :type: list[str] .. py:attribute:: selected_descriptor_layer_id :type: str | None .. py:attribute:: selected_tone_profile_id :type: str | None .. py:attribute:: selected_species_block_id :type: str | None .. py:attribute:: selected_clothing_profile_id :type: str | None .. py:attribute:: selected_clothing_slot_ids :type: dict[str, str | None] .. py:attribute:: compiled_prompt :type: str .. py:attribute:: generation_defaults :type: dict[str, Any] .. py:attribute:: missing_components :type: list[str]