feat(parameters): describe Parameters TypedDicts and Constraint base#261
Merged
Kamilbenkirane merged 1 commit intomainfrom Apr 18, 2026
Merged
feat(parameters): describe Parameters TypedDicts and Constraint base#261Kamilbenkirane merged 1 commit intomainfrom
Kamilbenkirane merged 1 commit intomainfrom
Conversation
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.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Annotate every field in the modality
ParametersTypedDicts withAnnotated[T, Field(description=...)]and add an optionaldescription: str | None = Noneslot to theConstraintbase.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/EmbeddingsParameterscarry 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
parameter_constraintsentry (Choice, Range, Dimensions, etc.) continues to own valid-value enumeration; the TypedDict annotation tells you what the field means.description=on the constraint instance in itsparameter_constraints={...}dict.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.