Migrate to Pydantic V2
Problem to solve
AI Gateway is using Pydantic v1 for internal domain modelling. It is also a dependency of FastAPI
library. FastAPI
has added support of Pydantic v2 since 0.100.x
and plan to deprecate support for Pydantic v1 in the near future. Pydantic v2 would also come with some performance boost.
Proposal
Migrate to Pydantic v2.
- Use the officially supported package to help with rewriting code https://github.com/pydantic/bump-pydantic
- Ensure all tests passed and server is operational.
🎉
Further details
Links / references
- FastAPI support https://github.com/tiangolo/fastapi/releases/tag/0.100.0
- Migration guide https://docs.pydantic.dev/2.0/migration/
- Pydantic v2 announcement https://docs.pydantic.dev/latest/blog/pydantic-v2-final/
Edited by Tan Le