Skip to content

feat(parameters): describe Parameters TypedDicts and Constraint base#261

Merged
Kamilbenkirane merged 1 commit intomainfrom
feat/parameter-introspection
Apr 18, 2026
Merged

feat(parameters): describe Parameters TypedDicts and Constraint base#261
Kamilbenkirane merged 1 commit intomainfrom
feat/parameter-introspection

Conversation

@Kamilbenkirane
Copy link
Copy Markdown
Member

Summary

Annotate every field in the modality Parameters TypedDicts with Annotated[T, Field(description=...)] and add an optional description: str | None = None slot to the Constraint base.

Together, these give downstream consumers (playgrounds, LLM-tool wrappers, OpenAPI generators) access to per-parameter human-readable metadata via the standard Pydantic introspection path (get_type_hints(ImageParameters, include_extras=True) + model.parameter_constraints[name].description).

Why

Today, ImageParameters / AudioParameters / VideoParameters / TextParameters / EmbeddingsParameters carry bare types with no per-field documentation. Constraints are pure validators with no description slot. Consumers hand-label in their own UI/schema code; there's no canonical way to ask "what does this parameter mean?" at the celeste level.

Design

  • Descriptions state semantic meaning, not valid values. Enumerating values (like '16:9' / '1:1' for aspect ratio) would hardcode one provider's choices into every consumer's schema. Instead, each per-model parameter_constraints entry (Choice, Range, Dimensions, etc.) continues to own valid-value enumeration; the TypedDict annotation tells you what the field means.
  • Constraint-level description is a per-model override. When a model wants to narrow or restate the generic semantic (e.g. "this model's aspect_ratio only accepts 16:9 or 1:1"), it sets description= on the constraint instance in its parameter_constraints={...} dict.
  • No new module, no new helper, no new behavior. Primitives only.

Test plan

  • uv run pytest tests/unit_tests — 594 tests pass.
  • uv run ruff check src/celeste tests/unit_tests/test_parameters.py — clean.
  • uv run mypy src/celeste/modalities/*/parameters.py src/celeste/constraints.py — clean.
  • New tests assert every modality's TypedDict has a Field description on every field, base types survive under Annotated, and Constraint.description defaults to None and flows to subclasses.

Annotate every field in ImageParameters, AudioParameters, VideoParameters,
TextParameters, and EmbeddingsParameters with `Annotated[T, Field(description=...)]`.
Descriptions state the semantic meaning of each parameter and leave valid-value
enumeration to per-model parameter_constraints (Choice, Range, Dimensions, etc.)
so downstream consumers render provider-specific enums/bounds without duplicating
them in the TypedDict.

Add an optional `description: str | None = None` slot to the Constraint base so
a model's parameter_constraints can override the generic TypedDict description
with per-model nuance (e.g., "this model only accepts 16:9 or 1:1").

Tests assert every modality TypedDict has a Field description on every field,
base types survive under Annotated, and Constraint.description defaults to
None and flows to subclasses.
@claude
Copy link
Copy Markdown

claude bot commented Apr 18, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@Kamilbenkirane Kamilbenkirane merged commit 4a1e4bf into main Apr 18, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant