M2.7
Text Generation • MiniMax • ProxiedMiniMax's M2.7 language model with multilingual capabilities.
| Model Info | |
|---|---|
| Context Window ↗ | 128,000 tokens |
| Terms and License | link ↗ |
| More information | link ↗ |
Usage
const response = await env.AI.run( 'minimax/m2.7', { messages: [ { role: 'user', content: 'What is the capital of France?', }, ], max_tokens: 100, }, { gateway: { id: 'default' }, })console.log(response)Examples
With System Prompt — Using a system prompt to guide behavior
const response = await env.AI.run( 'minimax/m2.7', { messages: [ { role: 'system', content: 'You are a helpful cooking assistant. Give concise recipes with metric measurements.', }, { role: 'user', content: 'How do I make a simple pasta aglio e olio?', }, ], max_tokens: 500, temperature: 0.7, }, { gateway: { id: 'default' }, })console.log(response)Multi-turn Conversation — Continuing a conversation with context
const response = await env.AI.run( 'minimax/m2.7', { messages: [ { role: 'user', content: 'What are the main differences between TCP and UDP?', }, { role: 'assistant', content: 'TCP is connection-oriented and guarantees delivery, while UDP is connectionless and faster but without delivery guarantees.', }, { role: 'user', content: 'When would I choose UDP over TCP?', }, ], max_tokens: 500, temperature: 0.5, }, { gateway: { id: 'default' }, })console.log(response)Creative Writing — Higher temperature for creative output
const response = await env.AI.run( 'minimax/m2.7', { messages: [ { role: 'user', content: 'Write a haiku about programming.', }, ], max_tokens: 100, temperature: 0.9, }, { gateway: { id: 'default' }, })console.log(response)Parameters
arrayrequirednumberminimum: 0maximum: 1numberexclusiveMinimum: 0numberexclusiveMinimum: 0numberminimum: 0maximum: 1booleanobjectarraystringenum: none, autoobjectbooleanstringarraynumberstringstringenum: chat.completion, chat.completion.chunkobjectbooleanbooleanobjectAPI Schemas
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "system", "user", "assistant", "tool" ] }, "name": { "type": "string" }, "content": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "anyOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "image_url" }, "image_url": { "type": "object", "properties": { "url": { "type": "string" } }, "required": [ "url" ], "additionalProperties": false } }, "required": [ "type", "image_url" ], "additionalProperties": false } ] } } ] }, "tool_calls": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "type": { "type": "string", "const": "function" }, "function": { "type": "object", "properties": { "name": { "type": "string" }, "arguments": { "type": "string" } }, "required": [ "name", "arguments" ], "additionalProperties": false } }, "required": [ "id", "type", "function" ], "additionalProperties": false } } }, "required": [ "role", "content" ], "additionalProperties": {} } }, "temperature": { "type": "number", "minimum": 0, "maximum": 1 }, "max_tokens": { "type": "number", "exclusiveMinimum": 0 }, "max_completion_tokens": { "type": "number", "exclusiveMinimum": 0 }, "top_p": { "type": "number", "minimum": 0, "maximum": 1 }, "stream": { "type": "boolean" }, "stream_options": { "type": "object", "properties": { "include_usage": { "type": "boolean" } }, "additionalProperties": false }, "tools": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "const": "function" }, "function": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "parameters": {} }, "required": [ "name", "description", "parameters" ], "additionalProperties": false } }, "required": [ "type", "function" ], "additionalProperties": false } }, "tool_choice": { "type": "string", "enum": [ "none", "auto" ] }, "response_format": { "type": "object", "properties": { "type": { "type": "string", "const": "json_schema" }, "json_schema": { "type": "object", "properties": { "name": { "type": "string", "maxLength": 64 }, "description": { "type": "string" }, "schema": { "type": "object", "properties": { "type": { "type": "string", "const": "object" }, "properties": {} }, "required": [ "type", "properties" ], "additionalProperties": false } }, "required": [ "name", "schema" ], "additionalProperties": false } }, "required": [ "type", "json_schema" ], "additionalProperties": false }, "mask_sensitive_info": { "type": "boolean" } }, "required": [ "messages" ], "additionalProperties": {}}{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": { "type": "string" }, "choices": { "type": "array", "items": { "type": "object", "properties": { "index": { "type": "number" }, "message": { "type": "object", "properties": { "role": { "type": "string", "const": "assistant" }, "content": { "type": "string" }, "tool_calls": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "type": { "type": "string", "const": "function" }, "function": { "type": "object", "properties": { "name": { "type": "string" }, "arguments": { "type": "string" } }, "required": [ "name", "arguments" ], "additionalProperties": false } }, "required": [ "id", "type", "function" ], "additionalProperties": false } } }, "required": [ "role", "content" ], "additionalProperties": {} }, "finish_reason": { "type": "string", "enum": [ "stop", "length", "tool_calls" ] } }, "required": [ "index", "message", "finish_reason" ], "additionalProperties": {} } }, "created": { "type": "number" }, "model": { "type": "string" }, "object": { "type": "string", "enum": [ "chat.completion", "chat.completion.chunk" ] }, "usage": { "type": "object", "properties": { "total_tokens": { "type": "number" }, "prompt_tokens": { "type": "number" }, "completion_tokens": { "type": "number" } }, "required": [ "total_tokens", "prompt_tokens", "completion_tokens" ], "additionalProperties": {} }, "input_sensitive": { "type": "boolean" }, "output_sensitive": { "type": "boolean" }, "base_resp": { "type": "object", "properties": { "status_code": { "type": "number" }, "status_msg": { "type": "string" } }, "required": [ "status_code", "status_msg" ], "additionalProperties": false } }, "required": [ "id", "choices", "created", "model", "object" ], "additionalProperties": {}}