target
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| FormCancelledError promptantic.form.target The user closed the form without submitting it. |
||
| FormTarget promptantic.form.target The schema a form is built from, and how its result is validated. |
||
| FormValidationError promptantic.form.target The finished value doesn't validate. |
||
| Issue promptantic.form.target One problem with a finished value, at a path into it (``()``: the whole value). |
🛈 DocStrings¶
What a form fills: a JSON Schema, or a Python type (pydantic model, dataclass, ...).
A target gives the schema the form is built from and validates the finished
value: JSON Schemas with :mod:jsonschema (Draft 2020-12, formats checked),
Python types with pydantic, which also turns the value into an instance.
FormCancelledError
¶
FormTarget
dataclass
¶
The schema a form is built from, and how its result is validated.
Source code in src/promptantic/form/target.py
validate
¶
The validated result (a model instance for Python types).
Raises:
| Type | Description |
|---|---|
FormValidationError
|
With every issue found, not only the first. |
FormValidationError
¶
Bases: ValueError
The finished value doesn't validate.
Source code in src/promptantic/form/target.py
Issue
dataclass
¶
target_for
¶
target_for(target: type[T]) -> FormTarget[T]
target_for(target: Mapping[str, Any]) -> FormTarget[dict[str, Any]]
target_for(target: type[Any] | Mapping[str, Any]) -> FormTarget[Any]
The form target for a JSON Schema (as a mapping) or a Python type.