Skip to content

fix: cast empty tool properties to object for Mistral API compatibility#1012

Open
afiktahirov wants to merge 1 commit intoprism-php:mainfrom
afiktahirov:fix/mistral-toolmap-empty-properties
Open

fix: cast empty tool properties to object for Mistral API compatibility#1012
afiktahirov wants to merge 1 commit intoprism-php:mainfrom
afiktahirov:fix/mistral-toolmap-empty-properties

Conversation

@afiktahirov
Copy link
Copy Markdown

Description

When a tool has no parameters, parametersAsArray() returns an empty PHP array [].
When JSON-encoded, this becomes [] (JSON array), but Mistral API expects
"properties" to be a JSON object {}.

This causes a 400 error from Mistral:

Invalid tool schema: [] is not of type 'object'

Fix: fallback to (object) [] which JSON-encodes to {} when properties are empty.

Breaking Changes

No breaking changes. This only affects tools with empty parameter schemas.

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