Record Class MiniMaxApi.ChatCompletionRequest
java.lang.Object
java.lang.Record
org.springframework.ai.minimax.api.MiniMaxApi.ChatCompletionRequest
- Record Components:
messages
- A list of messages comprising the conversation so far.model
- ID of the model to use.frequencyPenalty
- Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.maxTokens
- The maximum number of tokens to generate in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length.n
- How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs.presencePenalty
- Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.responseFormat
- An object specifying the format that the model must output. Setting to { "type": "json_object" } enables JSON mode, which guarantees the message the model generates is valid JSON.seed
- This feature is in Beta. If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed, and you should refer to the system_fingerprint response parameter to monitor changes in the backend.stop
- Up to 4 sequences where the API will stop generating further tokens.stream
- If set, partial message deltas will be sent.Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.temperature
- What sampling temperature to use, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.topP
- An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.maskSensitiveInfo
- Mask the text information in the output that is easy to involve privacy issues, including but not limited to email, domain name, link, ID number, home address, etc. The default is true, which means enabling masking.tools
- A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for.toolChoice
- Controls which (if any) function is called by the model. none means the model will not call a function and instead generates a message. auto means the model can pick between generating a message or calling a function. Specifying a particular function via {"type: "function", "function": {"name": "my_function"}} forces the model to call that function. none is the default when no functions are present. auto is the default if functions are present. Use theMiniMaxApi.ChatCompletionRequest.ToolChoiceBuilder
to create the tool choice value.
- Enclosing class:
- MiniMaxApi
public static record MiniMaxApi.ChatCompletionRequest(List<MiniMaxApi.ChatCompletionMessage> messages, String model, Double frequencyPenalty, Integer maxTokens, Integer n, Double presencePenalty, MiniMaxApi.ChatCompletionRequest.ResponseFormat responseFormat, Integer seed, List<String> stop, Boolean stream, Double temperature, Double topP, Boolean maskSensitiveInfo, List<MiniMaxApi.FunctionTool> tools, Object toolChoice)
extends Record
Creates a model response for the given chat conversation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
An object specifying the format that the model must output.static class
Helper factory that creates a tool_choice of type 'none', 'auto' or selected function by name. -
Constructor Summary
ConstructorsConstructorDescriptionChatCompletionRequest
(List<MiniMaxApi.ChatCompletionMessage> messages, Boolean stream) Shortcut constructor for a chat completion request with the given messages, model, tools and tool choice.ChatCompletionRequest
(List<MiniMaxApi.ChatCompletionMessage> messages, String model, Double temperature) Shortcut constructor for a chat completion request with the given messages and model.ChatCompletionRequest
(List<MiniMaxApi.ChatCompletionMessage> messages, String model, Double temperature, boolean stream) Shortcut constructor for a chat completion request with the given messages, model and control for streaming.ChatCompletionRequest
(List<MiniMaxApi.ChatCompletionMessage> messages, String model, Double frequencyPenalty, Integer maxTokens, Integer n, Double presencePenalty, MiniMaxApi.ChatCompletionRequest.ResponseFormat responseFormat, Integer seed, List<String> stop, Boolean stream, Double temperature, Double topP, Boolean maskSensitiveInfo, List<MiniMaxApi.FunctionTool> tools, Object toolChoice) Creates an instance of aChatCompletionRequest
record class.ChatCompletionRequest
(List<MiniMaxApi.ChatCompletionMessage> messages, String model, List<MiniMaxApi.FunctionTool> tools, Object toolChoice) Shortcut constructor for a chat completion request with the given messages, model, tools and tool choice. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.Returns the value of thefrequencyPenalty
record component.final int
hashCode()
Returns a hash code value for this object.Returns the value of themaskSensitiveInfo
record component.Returns the value of themaxTokens
record component.messages()
Returns the value of themessages
record component.model()
Returns the value of themodel
record component.n()
Returns the value of then
record component.Returns the value of thepresencePenalty
record component.Returns the value of theresponseFormat
record component.seed()
Returns the value of theseed
record component.stop()
Returns the value of thestop
record component.stream()
Returns the value of thestream
record component.Returns the value of thetemperature
record component.Returns the value of thetoolChoice
record component.tools()
Returns the value of thetools
record component.topP()
Returns the value of thetopP
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
ChatCompletionRequest
public ChatCompletionRequest(List<MiniMaxApi.ChatCompletionMessage> messages, String model, Double temperature) Shortcut constructor for a chat completion request with the given messages and model.- Parameters:
messages
- A list of messages comprising the conversation so far.model
- ID of the model to use.temperature
- What sampling temperature to use, between 0 and 1.
-
ChatCompletionRequest
public ChatCompletionRequest(List<MiniMaxApi.ChatCompletionMessage> messages, String model, Double temperature, boolean stream) Shortcut constructor for a chat completion request with the given messages, model and control for streaming.- Parameters:
messages
- A list of messages comprising the conversation so far.model
- ID of the model to use.temperature
- What sampling temperature to use, between 0 and 1.stream
- If set, partial message deltas will be sent.Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.
-
ChatCompletionRequest
public ChatCompletionRequest(List<MiniMaxApi.ChatCompletionMessage> messages, String model, List<MiniMaxApi.FunctionTool> tools, Object toolChoice) Shortcut constructor for a chat completion request with the given messages, model, tools and tool choice. Streaming is set to false, temperature to 0.8 and all other parameters are null.- Parameters:
messages
- A list of messages comprising the conversation so far.model
- ID of the model to use.tools
- A list of tools the model may call. Currently, only functions are supported as a tool.toolChoice
- Controls which (if any) function is called by the model.
-
ChatCompletionRequest
Shortcut constructor for a chat completion request with the given messages, model, tools and tool choice. Streaming is set to false, temperature to 0.8 and all other parameters are null.- Parameters:
messages
- A list of messages comprising the conversation so far.stream
- If set, partial message deltas will be sent.Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.
-
ChatCompletionRequest
public ChatCompletionRequest(List<MiniMaxApi.ChatCompletionMessage> messages, String model, Double frequencyPenalty, Integer maxTokens, Integer n, Double presencePenalty, MiniMaxApi.ChatCompletionRequest.ResponseFormat responseFormat, Integer seed, List<String> stop, Boolean stream, Double temperature, Double topP, Boolean maskSensitiveInfo, List<MiniMaxApi.FunctionTool> tools, Object toolChoice) Creates an instance of aChatCompletionRequest
record class.- Parameters:
messages
- the value for themessages
record componentmodel
- the value for themodel
record componentfrequencyPenalty
- the value for thefrequencyPenalty
record componentmaxTokens
- the value for themaxTokens
record componentn
- the value for then
record componentpresencePenalty
- the value for thepresencePenalty
record componentresponseFormat
- the value for theresponseFormat
record componentseed
- the value for theseed
record componentstop
- the value for thestop
record componentstream
- the value for thestream
record componenttemperature
- the value for thetemperature
record componenttopP
- the value for thetopP
record componentmaskSensitiveInfo
- the value for themaskSensitiveInfo
record componenttools
- the value for thetools
record componenttoolChoice
- the value for thetoolChoice
record component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
messages
Returns the value of themessages
record component.- Returns:
- the value of the
messages
record component
-
model
Returns the value of themodel
record component.- Returns:
- the value of the
model
record component
-
frequencyPenalty
Returns the value of thefrequencyPenalty
record component.- Returns:
- the value of the
frequencyPenalty
record component
-
maxTokens
Returns the value of themaxTokens
record component.- Returns:
- the value of the
maxTokens
record component
-
n
Returns the value of then
record component.- Returns:
- the value of the
n
record component
-
presencePenalty
Returns the value of thepresencePenalty
record component.- Returns:
- the value of the
presencePenalty
record component
-
responseFormat
Returns the value of theresponseFormat
record component.- Returns:
- the value of the
responseFormat
record component
-
seed
Returns the value of theseed
record component.- Returns:
- the value of the
seed
record component
-
stop
Returns the value of thestop
record component.- Returns:
- the value of the
stop
record component
-
stream
Returns the value of thestream
record component.- Returns:
- the value of the
stream
record component
-
temperature
Returns the value of thetemperature
record component.- Returns:
- the value of the
temperature
record component
-
topP
Returns the value of thetopP
record component.- Returns:
- the value of the
topP
record component
-
maskSensitiveInfo
Returns the value of themaskSensitiveInfo
record component.- Returns:
- the value of the
maskSensitiveInfo
record component
-
tools
Returns the value of thetools
record component.- Returns:
- the value of the
tools
record component
-
toolChoice
Returns the value of thetoolChoice
record component.- Returns:
- the value of the
toolChoice
record component
-