Skip to content

Make ChatCompletionMessageToolCall compatible with Mistral API #368

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Kerollmops
Copy link

@Kerollmops Kerollmops commented May 16, 2025

This PR modifies the chat types, specifically the ChatCompletionMessageToolCall struct, to make it compatible with the Mistral API. Mistral does not specify the type when it calls a function, but OpenAI always does. Unfortunately, this change is breaking. I don't quite understand why this example outputs show the type function but my tests with the mistral-saba-latest model don't.

About the diff, I had some issues with carriage returns \r. I don't understand why my editors (Zed, nano, Sublime Text) are not supporting them correctly. So, let me know if you don't plan to accept the changes as is, and I'll spend some time fixing it. The only line that actually changes is line 396.

Now that I have considered this PR a bit more, I wonder if it wouldn't be better to implement Default on ChatCompletionToolType and make ChatCompletionToolType::Function the default value.

@Kerollmops Kerollmops force-pushed the optional-type-function branch from dd328d4 to 603f1d1 Compare May 16, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant