mistralai / client-python

Python client library for Mistral AI platform
Apache License 2.0
477 stars 103 forks source link

Make orjson an optional dependency #71

Closed Zaczero closed 3 months ago

Zaczero commented 8 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 3 months 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 3 months ago

Indeed it is not 👍