mistralai / client-python

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

Feature Request: OpenAI API function support #52

Open j-dominguez9 opened 9 months ago

j-dominguez9 commented 9 months ago

I first want to mention that I do not want to support OpenAI or want to enable them in any way. That is particularly why I want Mistral to succeed. That being said, their API function has become somewhat standard in a lot of libraries and projects. By changing the 'api_base' argument, you can point it at any url, given that they support that format and functionality. It would make things easier for people switching over codebases and also allow extra functionality, like generating using JSON mode or function calls with pydantic + instructor.

jackmpcollins commented 7 months ago

I tested compatibility just now to try out using the Mistral API with https://github.com/jackmpcollins/magentic and found the allowed options for tool_choice was the only difference. I've opened a new issue specific to that https://github.com/mistralai/client-python/issues/78

@j-dominguez9 Are there any other specific differences you are aware of? It looks like JSON mode has been added but I haven't tested this.

aharth commented 3 weeks ago

Does the Mistral Python client support custom httpx clients via the http_client constructor parameter?

Both Open AI and Anthropic client libraries seem to support that functionality...

aharth commented 3 weeks ago

Ok, the parameter is named client.