Skip to content

Conversation

moritzwilksch
Copy link
Contributor

@moritzwilksch moritzwilksch commented Sep 19, 2025

closes #2931

Expose all types from messages.py in pydantic_ai, except for the two deprecated ones to prevent a circular import.

@moritzwilksch
Copy link
Contributor Author

@DouweM can you take a first look before I proceed with the other modules? Pulled type into top-level module, updated imports, updated examples. Excluded: 2 deprecated types, these are still only importable from pydantic_ai.messages.

@DouweM
Copy link
Collaborator

DouweM commented Sep 19, 2025

@moritzwilksch Looks great! Can you replace from pydantic_ai.messages import with from pydantic_ai import inside the docs directory as well, and then run make update-examples?

@DouweM DouweM self-assigned this Sep 19, 2025
@moritzwilksch
Copy link
Contributor Author

will do! do you prefer separate PRs for the other modules or should I continue here?

@DouweM
Copy link
Collaborator

DouweM commented Sep 19, 2025

@moritzwilksch I'm fine with you continuing in this PR

@moritzwilksch moritzwilksch changed the title Expose pydantic_ai.messages types in top-level pydantic_ai Expose .messages, .providers, .toolsets, .direct types in top-level pydantic_ai Sep 23, 2025
@moritzwilksch moritzwilksch marked this pull request as ready for review September 23, 2025 10:20
@DouweM DouweM changed the title Expose .messages, .providers, .toolsets, .direct types in top-level pydantic_ai Expose .messages, .toolsets, .direct types in top-level pydantic_ai Sep 29, 2025
@DouweM
Copy link
Collaborator

DouweM commented Sep 29, 2025

@moritzwilksch Thanks Moritz! Can your revert the changes for .direct, though, please? The docs state The direct module provides low-level methods which wouldn't be correct anymore, and that's explicitly a non-standard more-limited way of using Pydantic AI, so I'd prefer to keep it in a separate module.

@moritzwilksch
Copy link
Contributor Author

Done!

@moritzwilksch moritzwilksch changed the title Expose .messages, .toolsets, .direct types in top-level pydantic_ai Expose .messages, .toolsets types in top-level pydantic_ai Sep 30, 2025
@DouweM DouweM changed the title Expose .messages, .toolsets types in top-level pydantic_ai Expose .messages, .toolsets types in top-level pydantic_ai to aid IDE auto-import Sep 30, 2025
@DouweM DouweM merged commit cf96113 into pydantic:main Sep 30, 2025
30 checks passed
moritzwilksch added a commit to moritzwilksch/pydantic-ai that referenced this pull request Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose all pydantic_ai.messages types on pydantic_ai to aid IDE auto-import
2 participants