haystack-core-integrations icon indicating copy to clipboard operation
haystack-core-integrations copied to clipboard

Support Mistral API

Open bilgeyucel opened this issue 1 year ago • 2 comments

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': {}})]}

bilgeyucel avatar Mar 18 '24 09:03 bilgeyucel

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

anakin87 avatar Mar 21 '24 07:03 anakin87

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

AnushreeBannadabhavi avatar Apr 15 '24 20:04 AnushreeBannadabhavi