mistralai / client-python

Python client library for Mistral AI platform
Apache License 2.0
469 stars 97 forks source link

Make orjson an optional dependency #71

Closed Zaczero closed 1 month ago

Zaczero commented 6 months ago

Thank you for your work! Can we please make orjson dependency optional? I have concerns about the quality of this dependency (compatibility, security) and would prefer to not use it in my projects.

For example https://github.com/ijl/orjson/issues/452 talks about python segfault that was introduced in one of the releases, and it took multiple iterations to get it fixed properly:

You will also see that this project has 1-week stale auto-close policy, which is yet another red flag for me.

See:

My suggestion would be to drop the orjson dependency in exchange for https://jcristharif.com/msgspec and made it optional, just for the people who really need it - the performance gain here is most likely very small and for many people it's probably not worth the additional dependency/risk. We are not parsing megabytes/gigabytes of data - stdlib's json should do pretty well.

sophiamyang commented 1 month ago

Thanks for reporting the issue. I don't think orjson is a dependency anymore according to https://github.com/mistralai/client-python/blob/main/pyproject.toml. Please let us know if you see more issues. Thanks!

Zaczero commented 1 month ago

Indeed it is not 👍