Minimax
Minimax 是一家中国创业公司,为公司和个人提供自然语言处理模型。
此示例演示了使用 Langchain 与 Minimax 交互。
设置 (Setup)
要运行此笔记本,您需要一个 Minimax 帐户、一个 API 密钥 和一个 组 ID
单个模型调用 (Single model call)
from langchain_community.llms import Minimax
API 参考:Minimax
# Load the model
minimax = Minimax(minimax_api_key="YOUR_API_KEY", minimax_group_id="YOUR_GROUP_ID")
# Prompt the model
minimax("What is the difference between panda and bear?")
链接模型调用 (Chained model calls)
# get api_key and group_id: https://api.minimax.chat/user-center/basic-information
# We need `MINIMAX_API_KEY` and `MINIMAX_GROUP_ID`
import os
os.environ["MINIMAX_API_KEY"] = "YOUR_API_KEY"
os.environ["MINIMAX_GROUP_ID"] = "YOUR_GROUP_ID"
from langchain.chains import LLMChain
from langchain_community.llms import Minimax
from langchain_core.prompts import PromptTemplate
template = """Question: {question}
Answer: Let's think step by step."""
prompt = PromptTemplate.from_template(template)
llm = Minimax()
llm_chain = LLMChain(prompt=prompt, llm=llm)
question = "What NBA team won the Championship in the year Jay Zhou was born?"
llm_chain.run(question)