Class MiniMaxApi
java.lang.Object
org.springframework.ai.minimax.api.MiniMaxApi
Single class implementation of the MiniMax Chat Completion API and
MiniMax Embedding API.
- Since:
- 1.0.0 M1
- Author:
- Geng Rong, Thomas Vitale
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
Represents a chat completion response returned by model, based on the provided input.static final record
Represents a streamed chunk of a chat completion response returned by model, based on the provided input.static enum
The reason the model stopped generating tokens.static final record
Message comprising the conversation.static final record
Creates a model response for the given chat conversation.static enum
MiniMax Chat Completion Models: MiniMax Model.static final record
List of multiple embedding responses.static enum
MiniMax Embeddings Models: Embeddings.static final record
Creates an embedding vector representing the input text.static enum
MiniMax Embeddings Typesstatic final record
Represents a tool the model may call.static final record
Log probability information for the choice.static final record
Usage statistics for the completion request. -
Field Summary
-
Constructor Summary
ConstructorDescriptionMiniMaxApi
(String miniMaxToken) Create a new chat completion api with default base URL.MiniMaxApi
(String baseUrl, String miniMaxToken) Create a new chat completion api.MiniMaxApi
(String baseUrl, String miniMaxToken, org.springframework.web.client.RestClient.Builder restClientBuilder) Create a new chat completion api.MiniMaxApi
(String baseUrl, String miniMaxToken, org.springframework.web.client.RestClient.Builder restClientBuilder, org.springframework.web.client.ResponseErrorHandler responseErrorHandler) Create a new chat completion api. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<MiniMaxApi.ChatCompletion>
chatCompletionEntity
(MiniMaxApi.ChatCompletionRequest chatRequest) Creates a model response for the given chat conversation.reactor.core.publisher.Flux<MiniMaxApi.ChatCompletionChunk>
chatCompletionStream
(MiniMaxApi.ChatCompletionRequest chatRequest) Creates a streaming chat response for the given chat conversation.org.springframework.http.ResponseEntity<MiniMaxApi.EmbeddingList>
embeddings
(MiniMaxApi.EmbeddingRequest embeddingRequest) Creates an embedding vector representing the input text or token array.static String
-
Field Details
-
DEFAULT_CHAT_MODEL
-
DEFAULT_EMBEDDING_MODEL
-
-
Constructor Details
-
MiniMaxApi
Create a new chat completion api with default base URL.- Parameters:
miniMaxToken
- MiniMax apiKey.
-
MiniMaxApi
Create a new chat completion api.- Parameters:
baseUrl
- api base URL.miniMaxToken
- MiniMax apiKey.
-
MiniMaxApi
public MiniMaxApi(String baseUrl, String miniMaxToken, org.springframework.web.client.RestClient.Builder restClientBuilder) Create a new chat completion api.- Parameters:
baseUrl
- api base URL.miniMaxToken
- MiniMax apiKey.restClientBuilder
- RestClient builder.
-
MiniMaxApi
public MiniMaxApi(String baseUrl, String miniMaxToken, org.springframework.web.client.RestClient.Builder restClientBuilder, org.springframework.web.client.ResponseErrorHandler responseErrorHandler) Create a new chat completion api.- Parameters:
baseUrl
- api base URL.miniMaxToken
- MiniMax apiKey.restClientBuilder
- RestClient builder.responseErrorHandler
- Response error handler.
-
-
Method Details
-
getTextContent
-
chatCompletionEntity
public org.springframework.http.ResponseEntity<MiniMaxApi.ChatCompletion> chatCompletionEntity(MiniMaxApi.ChatCompletionRequest chatRequest) Creates a model response for the given chat conversation.- Parameters:
chatRequest
- The chat completion request.- Returns:
- Entity response with
MiniMaxApi.ChatCompletion
as a body and HTTP status code and headers.
-
chatCompletionStream
public reactor.core.publisher.Flux<MiniMaxApi.ChatCompletionChunk> chatCompletionStream(MiniMaxApi.ChatCompletionRequest chatRequest) Creates a streaming chat response for the given chat conversation.- Parameters:
chatRequest
- The chat completion request. Must have the stream property set to true.- Returns:
- Returns a
Flux
stream from chat completion chunks.
-
embeddings
public org.springframework.http.ResponseEntity<MiniMaxApi.EmbeddingList> embeddings(MiniMaxApi.EmbeddingRequest embeddingRequest) Creates an embedding vector representing the input text or token array.- Parameters:
embeddingRequest
- The embedding request.- Returns:
- Returns
MiniMaxApi.EmbeddingList
.
-