Skip to content

Fix: mistral passes references when tool calls are used#409

Merged
lukasdotcom merged 1 commit into
mainfrom
mistral-fix
Jul 23, 2026
Merged

Fix: mistral passes references when tool calls are used#409
lukasdotcom merged 1 commit into
mainfrom
mistral-fix

Conversation

@lukasdotcom

Copy link
Copy Markdown
Member

Mistral has a weird format when tool call results exist.

Resolves: #408

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@lukasdotcom

Copy link
Copy Markdown
Member Author

/backport to stable32

Comment thread lib/Service/OpenAiAPIService.php Outdated
Comment on lines +1482 to +1487
// Handle more complex mistral message content
foreach ($choice['message']['content'] as $content) {
if ($content['type'] === 'text' && is_string($content['text'])) {
$messageContent[] = $content['text'];
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like reasoning and multimodal output is also in this same content
maybe reasoning can be also extracted here, and then the multimodal output in the other PR?
not sure how complex it would get though

the long and precise link to docs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the current changes are good to merge though, if reasoning is to be extracted later on 👍

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment that mentions a todo for the future

Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
@lukasdotcom
lukasdotcom merged commit ee48423 into main Jul 23, 2026
26 checks passed
@lukasdotcom
lukasdotcom deleted the mistral-fix branch July 23, 2026 12:49
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.

Typed Mistral message.content chunks are ignored, causing 'No result' errors

2 participants