[BUG] Mistral: response format type lowercased with default locale before sending to the API

Author: jiboo2022Created Sep 16, 2026Updated Sep 16, 2026

Problem

MistralAiResponseFormatType.toString() returns name().toLowerCase() using the default locale, and MistralAiResponseFormat.fromType() feeds that result into the request payload (type(type.toString())). Under a Turkish/Azeri default locale, any constant containing I (e.g. a future JSON_SCHEMA) would be sent with a dotless ı, producing an invalid value for the Mistral API.

Expected behavior

toString() lowercases with Locale.ROOT so the wire value is locale-independent (current constants TEXT/JSON_OBJECT are unaffected; this is a correctness fix for the wire path, not just hygiene).

Environment

langchain4j main (31950454f), module langchain4j-mistral-ai.