airflow.providers.common.ai.utils.validation¶
Validation helpers for common.ai decorators.
Functions¶
|
Validate the prompt returned by a decorator's python_callable. |
|
Preflight check raised before the agent runs. |
Module Contents¶
- airflow.providers.common.ai.utils.validation.validate_prompt(value, *, decorator_name)[source]¶
Validate the prompt returned by a decorator’s python_callable.
- Accepted (mirrors pydantic-ai’s
Agent.run_syncuser_prompt): non-empty, non-whitespace
strnon-empty
Sequence(other thanstr/bytes/bytearray) of pydantic-aiUserContentitems; item-level validation is delegated to pydantic-ai atAgent.run_synctime.
Raises
TypeErrorwith an actionable message on any other shape.- Accepted (mirrors pydantic-ai’s
- airflow.providers.common.ai.utils.validation.reject_sequence_with_unsupported_feature(value, *, decorator_name, feature_name, feature_enabled)[source]¶
Preflight check raised before the agent runs.
Raises
TypeErrorwhen value is a non-string Sequence and feature_enabled is True. Used to fail fast on combinations (e.g.,enable_hitl_review=True+ Sequence prompt) that would otherwise fail later – after the LLM call – when the downstream HITL/approval consumer tries to stringify the prompt.