haystack-core-integrations
haystack-core-integrations copied to clipboard
Support Mistral API
Is your feature request related to a problem? Please describe. We extend OpenAIChatGenerator for MistralChatGenerator. This works for chat completion but not for function calling. Mistral's function calling API is not the same as OpenAI's. https://docs.mistral.ai/guides/function-calling/
Describe the solution you'd like We need to support Mistral's own API in MistralChatGenerator
Describe alternatives you've considered Not supporting function calling in Mistral
Additional context
With the current implementation, MistralChatGenerator states that a message is a function call but the content
doesn't provide function name/argument, probably because we cannot map the response coming from Mistral to a ChatMessage object
{'replies': [ChatMessage(content='', role=<ChatRole.ASSISTANT: 'assistant'>, name=None, meta={'model': 'mistral-large-latest', 'index': 0, 'finish_reason': 'tool_calls', 'usage': {}})]}