Closed jackmpcollins closed 3 months ago
Gently bumping this, since there hasn't been a response from the maintainers, and this is a blocker for us in adopting / evaluating Mistral.
Thanks for the suggestions. Support for {"type": "function", "function": {"name": "my_function"}}
is coming soon. Stay tuned!
The the Mistral docs Azure AI page links to a notebook that shows that Mistral on Azure is compatible with the openai python package https://github.com/Azure/azureml-examples/blob/main/sdk/python/foundation-models/mistral/openaisdk.ipynb Do you also intend for the Mistral-hosted API to be compatible with the openai python package?
If so, the
tool_choice
parameter in the API and this package needs to be updated to support choosing a specific tool. According to the openai docs the allowed options fortool_choice
are"none"
,"auto"
, or{"type": "function", "function": {"name": "my_function"}}
.https://platform.openai.com/docs/api-reference/chat/create#chat-create-tool_choice
It appears that the Mistral API does not support the
{"type": "function", "function": {"name": "my_function"}}
format, returning errorThis package shows just the string options (with additional "any")
https://github.com/mistralai/client-python/blob/80c7951bad83338641d5e89684f841ce1cac938f/src/mistralai/models/chat_completion.py#L34-L39
While the openai python package includes the option for a specific tool
https://github.com/openai/openai-python/blob/5cfb125acce0e8304d12bdd39b405071021db658/src/openai/types/chat/chat_completion_tool_choice_option_param.py#L12
Lack of support for tool_choice in the Mistral API makes it incompatible with the
openai
python package, which means tools like https://github.com/jackmpcollins/magentic have to add custom support for it.