Class MiniMaxChatTemplate
java.lang.Object
smile.llm.template.MiniMaxChatTemplate
- All Implemented Interfaces:
ChatTemplate
Java port of the MiniMax-M3
chat_template.jinja: a system block with thinking instructions, a
developer block (the user's system prompt and the tool list), then one block per turn, each introduced by
]~b] and closed by [e~[. Output is verified byte for byte against the Jinja template
rendered by Hugging Face transformers.
Differences from the Jinja template, all because Message is not an arbitrary JSON object:
the root role does not exist (the system prompt is always the developer block), assistant
reasoning_content does not exist (reasoning is taken from <mm:think>...</mm:think> in the
content), and <think>/</think> in assistant content, which is what this server returns to
clients, are read as the MiniMax tags. As in the template, a system message that is not the first
message is dropped.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault template: open assistant turn, thinking mode unspecified (the model decides).MiniMaxChatTemplate(boolean addGenerationPrompt, String thinkingMode) Creates a template. -
Method Summary
Modifier and TypeMethodDescriptionencode(List<Message> dialog, ChatOptions options) Encodes dialog messages with optional tool-calling options.static MiniMaxChatTemplateforOptions(ChatOptions options) Creates the template for a request.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChatTemplate
encode
-
Field Details
-
NS
-
TOOLCALL_BEGIN
-
TOOLCALL_END
-
THINK_BEGIN
-
THINK_END
-
-
Constructor Details
-
MiniMaxChatTemplate
public MiniMaxChatTemplate()Default template: open assistant turn, thinking mode unspecified (the model decides). -
MiniMaxChatTemplate
Creates a template.- Parameters:
addGenerationPrompt- append the open assistant turn.thinkingMode-enabled,disabled,adaptiveornull(undefined).
-
-
Method Details
-
forOptions
Creates the template for a request.- Parameters:
options- chat options; may benull.- Returns:
- a template with an open assistant turn and the options' thinking mode.
-
encode
Description copied from interface:ChatTemplateEncodes dialog messages with optional tool-calling options.- Specified by:
encodein interfaceChatTemplate- Parameters:
dialog- ordered conversation turns.options- chat options; may benull.- Returns:
- prompt text including an open assistant turn when applicable.
-