Class MistralAiApi.ChatCompletionRequest.ResponseFormat
java.lang.Object
org.springframework.ai.mistralai.api.MistralAiApi.ChatCompletionRequest.ResponseFormat
- Enclosing class:
- MistralAiApi.ChatCompletionRequest
An object specifying the format that the model must output.
Setting the type to JSON_SCHEMA enables Structured Outputs which ensures the model will match your supplied JSON schema.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic classJSON schema object that describes the format of the JSON object.static enum -
Constructor Summary
ConstructorsConstructorDescriptionResponseFormat(String type) Deprecated.ResponseFormat(String type, @Nullable Map<String, Object> jsonSchema) Deprecated.Usebuilder()or factory methods instead.ResponseFormat(MistralAiApi.ChatCompletionRequest.ResponseFormat.Type type, @Nullable String schema) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()boolean@Nullable StringgetType()inthashCode()Creates a ResponseFormat for JSON object output (JSON mode).jsonSchema(Class<?> clazz) Creates a ResponseFormat for JSON schema output with automatic schema generation from a class.jsonSchema(String schema) Creates a ResponseFormat for JSON schema output with a JSON schema string.jsonSchema(Map<String, Object> schema) Creates a ResponseFormat for JSON schema output with a JSON schema map.voidvoidvoidtext()Creates a ResponseFormat for text output.toString()
-
Constructor Details
-
ResponseFormat
public ResponseFormat() -
ResponseFormat
Deprecated.Usebuilder()or factory methods instead. -
ResponseFormat
Deprecated.Usebuilder()or factory methods instead. -
ResponseFormat
public ResponseFormat(MistralAiApi.ChatCompletionRequest.ResponseFormat.Type type, @Nullable String schema)
-
-
Method Details
-
getType
-
setType
-
getJsonSchema
-
setJsonSchema
-
getSchema
-
setSchema
-
text
Creates a ResponseFormat for text output.- Returns:
- ResponseFormat configured for text output
-
jsonObject
Creates a ResponseFormat for JSON object output (JSON mode).- Returns:
- ResponseFormat configured for JSON object output
-
jsonSchema
Creates a ResponseFormat for JSON schema output with automatic schema generation from a class.- Parameters:
clazz- the class to generate the JSON schema from- Returns:
- ResponseFormat configured with the generated JSON schema
-
jsonSchema
Creates a ResponseFormat for JSON schema output with a JSON schema string.- Parameters:
schema- the JSON schema as a string- Returns:
- ResponseFormat configured with the provided JSON schema
-
jsonSchema
public static MistralAiApi.ChatCompletionRequest.ResponseFormat jsonSchema(Map<String, Object> schema) Creates a ResponseFormat for JSON schema output with a JSON schema map.- Parameters:
schema- the JSON schema as a map- Returns:
- ResponseFormat configured with the provided JSON schema
-
builder
-
equals
-
hashCode
public int hashCode() -
toString
-
builder()or factory methods instead.