Skip to content

Add top-level Model ID field to PydanticAI connection#62818

Merged
kaxil merged 1 commit intoapache:mainfrom
astronomer:fix/pydanticai-model-field
Mar 3, 2026
Merged

Add top-level Model ID field to PydanticAI connection#62818
kaxil merged 1 commit intoapache:mainfrom
astronomer:fix/pydanticai-model-field

Conversation

@kaxil
Copy link
Member

@kaxil kaxil commented Mar 3, 2026

Summary

The LLM model identifier (e.g., anthropic:claude-sonnet-4-20250514) was previously only configurable via the JSON extra field on the connection, requiring users to edit raw JSON. This repurposes the connection schema field as "Model ID" so users can set it directly in the connection form UI.

Design

The schema field is a natural fit — it's a string field on every Airflow connection, was previously hidden for this connection type, and no AI provider needs it for its original purpose.

Priority order for model resolution:

  1. model_id parameter on the hook (highest)
  2. schema field on the connection (shown as "Model ID" in the UI)
  3. extra["model"] on the connection (legacy, backward compatible)

Changes

  • provider.yaml: Unhide schema, relabel as "Model ID", add placeholder
  • hooks/pydantic_ai.py: get_conn() reads conn.schema between model_id param and extra["model"]
  • docs/connections/pydantic_ai.rst: Document "Model ID" field and backward compatibility
  • tests: 3 new tests (schema field, precedence over extra, model_id param override)

Replace the repurposed `schema` field with a proper `conn-fields`
entry in provider.yaml. This renders a dedicated "Model" input in
the connection form that stores to `extra_dejson["model"]` — the
same pattern used by 23+ providers (Google, Slack, Snowflake, etc.).
@kaxil kaxil force-pushed the fix/pydanticai-model-field branch from 2040442 to 0d46b6f Compare March 3, 2026 21:49
@kaxil kaxil moved this from Backlog to In review in AIP-99 Common Data Access Pattern + AI Mar 3, 2026
@kaxil kaxil marked this pull request as ready for review March 3, 2026 21:49
@kaxil kaxil merged commit 0b5b873 into apache:main Mar 3, 2026
80 of 81 checks passed
@kaxil kaxil deleted the fix/pydanticai-model-field branch March 3, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

2 participants