airflow.providers.common.ai.utils.tool_definition

Version-tolerant helpers for building pydantic-ai ToolDefinition objects.

Functions

return_schema_kwargs(schema)

Return {"return_schema": schema} when pydantic-ai supports the field, else {}.

Module Contents

airflow.providers.common.ai.utils.tool_definition.return_schema_kwargs(schema)[source]

Return {"return_schema": schema} when pydantic-ai supports the field, else {}.

return_schema lets CodeMode (the Monty sandbox) render a typed function signature for a tool (-> str) instead of -> Any, which helps the model write correct code. It has no effect outside code mode.

Parameters:

schema (dict[str, Any]) – A JSON Schema fragment describing the tool’s return value.

Was this entry helpful?