-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding tools to MistralChatGenerator - based on OpenAIChatGenerator #1358
Conversation
message = results["replies"][0] | ||
|
||
assert message.tool_calls | ||
tool_call = message.tool_call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we discussed about the removal of assert not message.text
...
Which kind of text does the model produce along with a tool call?
Is it expected? I can't find it mentioned in [Mistral docs], but I haven't studied the topic in depth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vblagoje please re-add assert not message.texts
here if applicable
I asked @davidsbatista to complete this one @anakin87 - he allowed me, should have PR ready by EOD |
...tions/mistral/src/haystack_integrations/components/generators/mistral/chat/chat_generator.py
Show resolved
Hide resolved
@@ -54,10 +60,11 @@ class MistralChatGenerator(OpenAIChatGenerator): | |||
def __init__( | |||
self, | |||
api_key: Secret = Secret.from_env_var("MISTRAL_API_KEY"), | |||
model: str = "mistral-tiny", | |||
model: str = "mistral-small-latest", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there is a good reason to change the default model, let's mark this PR as breaking ("!" in the title).
In any case, the title needs to be aligned with the common format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok yeah, will do mark it as breaking, couldn't find this model listed any more nor supporting FC, see https://docs.mistral.ai/capabilities/function_calling/
...tions/mistral/src/haystack_integrations/components/generators/mistral/chat/chat_generator.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please address the 2 small comments I've left.
- Change the title to reflect our conventions.
Then feel free to merge!
message = results["replies"][0] | ||
|
||
assert message.tool_calls | ||
tool_call = message.tool_call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vblagoje please re-add assert not message.texts
here if applicable
tool_calls.append(ToolCall(id=payload["id"], tool_name=payload["name"], arguments=arguments)) | ||
except json.JSONDecodeError: | ||
logger.warning( | ||
"OpenAI returned a malformed JSON string for tool call arguments. This tool call " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"OpenAI returned a malformed JSON string for tool call arguments. This tool call " | |
"Mistral returned a malformed JSON string for tool call arguments. This tool call " |
Related Issues
Proposed Changes:
How did you test it?
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.