-
-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for use of Pydantic v1 as well as v2. #147
Conversation
Use v1-style configuration. While this is officially deprecated (https://docs.pydantic.dev/latest/usage/model_config/), it is supported by v2. I would assume this support will remain for a while, this will help ease the transition to v2
@simonw any chance you could take a look at this? The rest of the ecosystem has yet to move over to pydantic v2, e.g. chromadb is pinning to <2, which means that currently chromadb and llm can't be used together... |
I've been bitten by this issue myself - https://github.com/simonw/llm-replicate almost couldn't use the official Replicate client library because it depended on Pydantic v1. I submitted a PR to help with that: Then the I think you're right: this needs to be fixed in LLM itself. I want Having it depend on just |
One catch: LLM plugins will have to learn to not depend on Pydantic v1 v.s. v2 either. I'll need to document that in the plugin documentation I think. Also I should set up CI tests that exercise both versions of Pydantic to make sure one of them doesn't accidentally break in the future. |
Thanks! I love pydantic, but version 2 is causing a lot of churn in my ecosystem right now. |
Does look like supporting both is the best approach right now, during this crossover period. Libraries who've upgraded get asked for v1 compat (this PR), and those still on v1 get asked for v2 compat (anthropics/anthropic-sdk-python#115). Where's the |
Anthropic went cross compatible in anthropics/anthropic-sdk-python#121 So I was able to unvendor them in the latest llm-claude release. |
Use v1-style configuration. While this is officially
deprecated (https://docs.pydantic.dev/latest/usage/model_config/),
it is supported by v2. I would assume this support will remain
for a while, this will help ease the transition to v2.
Background: llm may be used in combination with other libraries that may directly or indirectly depend on pydantic v1, this PR is designed to give groups the ability to combine llm with their other libraries and have some breathing space to transition