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.

// 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 });

Hierarchy (view full)

Implements

  • MinimaxChatInput

Constructors

Constructors