Skip to content
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

Please make v2 compatible with v1 (langchain use v1, while fastapi use v2) #7919

Closed
1 task done
mokeyish opened this issue Oct 25, 2023 · 7 comments
Closed
1 task done
Assignees
Labels

Comments

@mokeyish
Copy link

mokeyish commented Oct 25, 2023

Initial Checks

  • I confirm that I'm using Pydantic V2

Description

Please make v2 compatible with v1 (langchain use v1, while fastapi use v2). they can't work together.

Example Code

No response

Python, Pydantic & OS Version

pydantic version: 2.4.2
        pydantic-core version: 2.10.1
          pydantic-core build: profile=release pgo=true
                 install path: /home/www/.conda/envs/tmpenv/lib/python3.9/site-packages/pydantic
               python version: 3.9.18 (main, Sep 11 2023, 13:41:44)  [GCC 11.2.0]
                     platform: Linux-5.10.0-26-amd64-x86_64-with-glibc2.31
             related packages: typing_extensions-4.8.0 fastapi-0.103.1
@mokeyish mokeyish added bug V2 Bug related to Pydantic V2 pending Awaiting a response / confirmation labels Oct 25, 2023
@mokeyish mokeyish changed the title Please make v2 compatible with v1 (langchian use v1, while fastapi use v2) Please make v2 compatible with v1 (langchain use v1, while fastapi use v2) Oct 25, 2023
@Luca-Blight
Copy link
Contributor

Seems like the onus is on langchain.

@sydney-runkle sydney-runkle self-assigned this Oct 25, 2023
@sydney-runkle sydney-runkle added question and removed bug V2 Bug related to Pydantic V2 pending Awaiting a response / confirmation labels Oct 25, 2023
@sydney-runkle
Copy link
Member

sydney-runkle commented Oct 25, 2023

Hi @mokeyish,

Thanks for submitting this issue. I agree with @Luca-Blight, this is simply a case of conflicting dependencies. You could use an earlier version of fastapi that uses pydantic V1 until langchain upgrades to supporting v2.

Any fastapi versions before 0.100.0 should use V1.

Read more here: tiangolo/fastapi#9709

@mokeyish
Copy link
Author

I found that it also not compatiable with deepspeed. Each library has its own dependencies, and many of them now conflict with each other.

@sydney-runkle
Copy link
Member

@mokeyish,

You can use different versions of each library to make sure the versions are compatible. The burden of resolving version conflicts isn't on pydantic, here.

@mokeyish
Copy link
Author

Currently, fastapi/lmdeploy use v2, langchain/deepspeed use v1.

Don’t learn from Google, learn from Facebook. As I known, Google has two incompatible upgraded products, angular(v1->v2) and tensorflow(v1->v2). Facebook's react and pytorch have always been very compatible, even from pytorch v1 to v2.

pydantic is not an app and you can freely choose dependent versions. pydantic is a library that is used by many downstream libraries, some use v2, and some are still using v1. Incompatible upgrades will cause many problems.

@mokeyish
Copy link
Author

mokeyish commented Oct 31, 2023

I'm not the only one having this problem.

tiangolo/fastapi#10360

langchain-ai/langserve#10

#7901

@samuelcolvin
Copy link
Member

samuelcolvin commented Oct 31, 2023

Hi @mokeyish, the rewrite in Pydantic from V1 to V2 was a fundamental restructure of the codebase, virtually everything (except the unit test, the philosophy and the majority of the public API) changed.

There won't be another breaking change to Pydantic like this.

I'd love Pydantic V1 to be compatible with Pydantic V2, the problem is that doing a thorough job of it would take me and someone else 6 months of solid work. That's 6 months we don't spend improving V2. On balance I don't think that's a good use of my time.

As @Luca-Blight said, the onus has to be on dependent libraries to upgrade.

I'm not the only one having this problem.

Pydantic is currently downloaded 123m times a month. That's 47 times a second.

I'm not sure what point you were trying to make by including links to 3 issues, but the way I read it, it shows what a small proportion of Pydantic's use is affective by v1 vs. v2 compatibility.

@pydantic pydantic locked as too heated and limited conversation to collaborators Oct 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants