class ChatMinimax// Define a chat prompt with a system message setting the context for translation
const chatPrompt = ChatPromptTemplate.fromMessages([
SystemMessagePromptTemplate.fromTemplate(
"You are a helpful assistant that translates {input_language} to {output_language}.",
),
HumanMessagePromptTemplate.fromTemplate("{text}"),
]);
// Create a new LLMChain with the chat model and the defined prompt
const chainB = new LLMChain({
prompt: chatPrompt,
llm: new ChatMinimax({ temperature: 0.01 }),
});
// Call the chain with the input language, output language, and the text to translate
const resB = await chainB.call({
input_language: "English",
output_language: "Chinese",
text: "I love programming.",
});
// Log the result
console.log({ resB });How many results to generate; the default is 1 and the maximum is not more than 4. Because beamWidth generates multiple results, it will consume more tokens.
Setting for each robot, only available for pro version.
The async caller should be used by subclasses to make any async calls, which will thus benefit from the concurrency and retry logic.
If it is true, this indicates that the current request is set to continuation mode, and the response is a continuation of the last sentence in the incoming messages; at this time, the last sender is not limited to USER, it can also be BOT. Assuming the last sentence of incoming messages is {"sender_type": " U S E R", "text": "天生我材"}, the completion of the reply may be "It must be useful."
Default bot name
Default user name
For the text information in the output that may involve privacy issues, code masking is currently included but not limited to emails, domains, links, ID numbers, home addresses, etc., with the default being true, that is, code masking is enabled.
Secret key to use when making requests. Defaults to the value of
MINIMAX_API_KEY environment variable.
Alias for apiKey
API key to use when making requests. Defaults to the value of
MINIMAX_GROUP_ID environment variable.
Model name to use. Available options are: qwen-turbo, qwen-plus, qwen-max, or Other compatible models.
Model name to use. Available options are: qwen-turbo, qwen-plus, qwen-max, or Other compatible models.
Alias for model
Messages to pass as a prefix to the prompt
Dialogue setting, characters, or functionality setting.
Enable Chatcompletion pro
Dialogue Metadata
Sensitize text information in the output that may involve privacy issues, currently including but not limited to emails, domain names, links, ID numbers, home addresses, etc. Default false, ie. enable sensitization.
Whether to stream the results or not. Defaults to false.
Amount of randomness injected into the response. Ranges from 0 to 1 (0 is not included). Use temp closer to 0 for analytical / multiple choice, and temp closer to 1 for creative and generative tasks. Defaults to 0.95.
Pay attention to the maximum number of tokens generated, this parameter does not affect the generation effect of the model itself, but only realizes the function by truncating the tokens exceeding the limit. It is necessary to ensure that the number of tokens of the input context plus this value is less than 6144 or 16384, otherwise the request will fail.
Total probability mass of tokens to consider at each step. Range from 0 to 1.0. Defaults to 0.8.
Whether to use the standard SSE format, when set to true, the streaming results will be separated by two line breaks. This parameter only takes effect when stream is set to true.
Whether to print out response text.
Wrapper around Minimax large language models that use the Chat endpoint.
To use you should have the MINIMAX_GROUP_ID and MINIMAX_API_KEY
environment variable set.