Class ResponseFormat

java.lang.Object
org.springframework.ai.deepseek.api.ResponseFormat

public final class ResponseFormat extends Object
An object specifying the format that the model must output. Setting to { "type": "json_object" } enables JSON Output, which guarantees the message the model generates is valid JSON.

Important: When using JSON Output, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if finish_reason="length", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.

References: DeepSeek API - Create Chat Completion

Author:
Geng Rong