ESP32 connected to the domestic large model MiniMax
[Copy link]
MM Smart Assistant is a large language model developed by MiniMax itself, without any interfaces that call other products. MiniMax is a Chinese technology company that has been committed to conducting research related to large models.
With the continuous development of artificial intelligence technology, the field of natural language processing has also received widespread attention and application. MiniMax, as a dialogue model with hundreds of billions of parameters, supports multiple rounds of dialogue and has the capabilities of content creation, information induction and summary. You can quickly register to experience the Chinese version of the language model and have a dialogue with the GLM model. This article will focus on how to access the MiniMax api of the domestic large model through ESP32.
MiniMax official website address: https://www.minimaxi.com /
This time, we will use Arduino programming to make the development much easier. This way, we can put the big model in our pocket.
1.1 Understanding MiniMax API
For the convenience of users, we provide native HTTP to implement model API calls
.
1.1.2 HTTP calls
Also supports standard HTTP calls
POST https://open.bigmodel.cn/api/paas/v3/model-api/{model}/{invoke_method}
Request header
Content-Type: application/json
Authorization: authentication token, see the following interface authentication instructions
Path parameter
model: specific model encoding
invoke_method: calling method, the value is invoke: synchronous call, async-invoke: asynchronous call, sse-invoke: SSE call
1.2 Http interface authentication
- API
https://api.minimax.chat/v1/text/chatcompletion_v2
-
Number of tokens supported
-
Interface parameter description
3.1 Request Body Parameters
api_key="请填写您的api_key"
curl --location "https://api.minimax.chat/v1/text/chatcompletion_v2" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${api_key}" \
--data '{
"model": "abab5.5-chat",
"messages": [
{
"role": "system",
"content": "MM智能助理是一款由MiniMax自研的,没有调用其他产品的接口的大型语言模型。MiniMax是一家中国科技公司,一直致力于进行大模型相关的研究。"
},
{
"role": "user",
"content": "你会按照以下要求回复我的内容:“根据我给出的多段信息分别判断信息文本内容表达了哪类情绪,并给出判断的理由,判断理由务必精简、准确。”我的内容是:“1、学习三星堆正确拍照姿势,留下难忘回忆!2、太可爱啦!换了个小猫图标!3、当代社畜分类图鉴,你是哪种?”"
}
],
"tool_choice": "none",
"stream": true,
"max_tokens": 16384,
"temperature": 0.1,
"top_p": 0.9
}'
3.2 Response Parameters
ata: {"id":"0230e4e325f59584349bcfe854f845ca","choices":[{"index":0,"delta":{"content":"1","role":"assistant"}}],"created":1709289956,"model":"abab6-chat","object":"chat.completion.chunk"}
data: {"id":"0230e4e325f59584349bcfe854f845ca","choices":[{"index":0,"delta":{"content":". 积极情绪:文本表达了学习和探索新事物的兴奋和愉悦。\n2. 积极情绪:文本表达了对可爱事物的喜爱和欣赏。\n3. 中性情绪:文本提出了一个关于社会现象的观察,带有","role":"assistant"}}],"created":1709289957,"model":"abab6-chat","object":"chat.completion.chunk"}
data: {"id":"0230e4e325f59584349bcfe854f845ca","choices":[{"finish_reason":"stop","index":0,"delta":{"content":"一定的幽默和讽刺意味。","role":"assistant"}}],"created":1709289957,"model":"abab6-chat","object":"chat.completion.chunk"}
data: {"id":"0230e4e325f59584349bcfe854f845ca","choices":[{"finish_reason":"stop","index":0,"message":{"content":"1. 积极情绪:文本表达了学习和探索新事物的兴奋和愉悦。\n2. 积极情绪:文本表达了对可爱事物的喜爱和欣赏。\n3. 中性情绪:文本提出了一个关于社会现象的观察,带有一定的幽默和讽刺意味。","role":"assistant"}}],"created":1709289957,"model":"abab6-chat","object":"chat.completion","usage":{"total_tokens":199},"base_resp":{"status_code":0,"status_msg":""}}
2. Prerequisites
Before continuing with this project, make sure to check the following prerequisites.
We will be using the Arduino IDE to program the ESP32/ESP8266 boards, so before continuing with this tutorial, make sure you have installed these boards in the Arduino IDE.
2.1 Environment Configuration
Arduino IDE: Download and install Arduino IDE;
ESP32 development board library: Add ESP32 support in Arduino IDE;
Reference blog: [ESP32C3 configuration Arduino IDE tutorial]
Allow some time for the installation process, the specific time may vary depending on your Internet connection.
Original link: https://blog.csdn.net/VOR234/article/details/136768206
|