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

Update to Pydantic 2.0 #358

Closed
pchalasani opened this issue Jan 11, 2024 · 8 comments
Closed

Update to Pydantic 2.0 #358

pchalasani opened this issue Jan 11, 2024 · 8 comments

Comments

@pchalasani
Copy link
Contributor

At some point :)

@sanders41
Copy link
Contributor

For now you are blocked on this by agent-search. The latest version 0.0.9 still depends on pydantic < 2

Because agent-search (0.0.9) depends on pydantic (>=1.10.13,<2.0.0)
 and no versions of agent-search match >0.0.9,<0.0.10, agent-search (>=0.0.9,<0.0.10) requires pydantic (>=1.10.13,<2.0.0).
So, because langroid depends on both pydantic (2.5.3) and agent-search (^0.0.9), version solving failed.

@pchalasani
Copy link
Contributor Author

blocked on this by agent-search.

I'm surprised this is the only blocker (if so, that's a minor one, since agent-search is just an extra and we can work around that)... I was expecting a lot of similar conflicts.

@sanders41
Copy link
Contributor

I haven't run into a situation where I had multiple conflicts before so I'm not sure how the Poetry resolver handles this. It's quite possible that it hit the first conflict and quit without reporting the others. So removing agent-search may bring out other conflicts.

@Mohannadcse
Copy link
Collaborator

Mohannadcse commented Jan 12, 2024

Not sure if this is helpful, but here is a glance about langroid dependency on pydantic:
It mainly relies on pydantic version 1.10.13. Here are the multiple paths between "langroid" and "pydantic" version "1.10.13".

  1. langroid -> chromadb -> fastapi -> pydantic version "1.10.13"
  2. langroid -> chromadb -> pydantic version "1.10.13"
  3. langroid -> farm-haystack -> pydantic version "1.10.13"
  4. langroid -> farm-haystack -> quantulum3 -> inflect -> pydantic version "1.10.13"
  5. langroid -> lancedb -> pydantic version "1.10.13"
  6. langroid -> meilisearch -> camel-converter -> pydantic version "1.10.13"
  7. langroid -> meilisearch-python-sdk -> camel-converter -> pydantic version "1.10.13"
  8. langroid -> meilisearch-python-sdk -> pydantic version "1.10.13"
  9. langroid -> openai -> pydantic version "1.10.13"
  10. langroid -> pydantic version "1.10.13"
  11. langroid -> qdrant-client -> pydantic version "1.10.13"
image

However, there is this transitive dependency, where some langroid dependencies use pyndantic version 2.5.3. For example, current langroid version 0.1.164 uses openai version 1.7.1, which uses pydantic version 2.5.3
That's why the picture below shows this package isn't imported (the node doesn't have the imported attribute). Here are multiple paths between "langroid" and "pydantic" version "2.5.3".

  1. langroid -> chromadb -> fastapi -> pydantic version "2.5.3"
  2. langroid -> chromadb -> pydantic version "2.5.3"
  3. langroid -> farm-haystack -> quantulum3 -> inflect -> pydantic version "2.5.3"
  4. langroid -> lancedb -> pydantic version "2.5.3"
  5. langroid -> meilisearch -> camel-converter -> pydantic version "2.5.3"
  6. langroid -> meilisearch-python-sdk -> camel-converter -> pydantic version "2.5.3"
  7. langroid -> meilisearch-python-sdk -> pydantic version "2.5.3"
  8. langroid -> openai -> pydantic version "2.5.3"
  9. langroid -> qdrant-client -> pydantic version "2.5.3"
image

Probably you are wondering why the agent-search wasn't shown in these paths. The API that I'm using for constructing the graph doesn't consider optional dependencies.

@sanders41
Copy link
Contributor

sanders41 commented Jan 12, 2024

On a quick scan through requirements files it looks like all the other dependencies have pydantic >= 1.x so they allow 2+ also.

I happen to be the maintainer of camel-converter and meilisearch-python-sdk, and one of the meilisearch client maintainers so I know for sure that is the case on those 😄

@pchalasani
Copy link
Contributor Author

@sanders41 finally got this done in PR #498 -- langroid now works with Pydantic v1 or v2

@sanders41
Copy link
Contributor

Thanks for the heads up @pchalasani. Do you know how long you plan to support Pydantic v1? My current tentative plan in my libraries is to drop support for it with a release in Oct/Nov when Python 3.8 goes EOL and doing a release for that. Will this cause issues for you, or could you pin to versions < the new major version? If it will cause issues I could continue to support it for a while longer.

As a side note, I noticed you are using both the meilisearch-python-sdk and the meilisearch libraries. You could drop one of those and have one less dependency to install. Since you are using the AsyncClient from meilisearch-python-sdk it would make sense to keep that one. If you want me to do a PR to remove the other let me know and I can.

@pchalasani
Copy link
Contributor Author

@sanders41

Will this cause issues for you, or could you pin to versions < the new major version? If it will cause issues I could continue to support it for a while longer.

Installing langroid by default installs pydantic 2.x, so discontinuing meilisearch v1 support shouldn't be an issue.

If you want me to do a PR to remove the other let me know and I can.

That would be great, thanks.

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

No branches or pull requests

3 participants