deepset-ai / haystack-core-integrations

Additional packages (components, document stores and the likes) to extend the capabilities of Haystack version 2.0 and onwards
https://haystack.deepset.ai
Apache License 2.0
99 stars 90 forks source link

Support Mistral API #592

Open bilgeyucel opened 5 months ago

bilgeyucel commented 5 months ago

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': {}})]}
anakin87 commented 5 months ago

Related: we should probably also introduce a MistralGenerator which can play well with other components such as the AnswerBuilder

AnushreeBannadabhavi commented 4 months ago

I can work on this if no one is working on it!