用途
MiniMax 图像理解技能用于在需要分析、描述或从图像中提取信息时调用 AI 能力。核心工具为 understand_image,通过传入提示词和图像地址获取图像分析结果。
主要能力
- 截图分析:识别错误信息、界面问题、截图中的代码。
- 视觉内容理解:照片、示意图、图表、图形。
- 文档处理:从图像中提取文字(OCR)、理解版面布局。
- UI/UX 分析:评估设计、识别组件。
- 视觉调试:理解视觉缺陷或布局问题。
使用方式
直接调用 understand_image 工具,传入 prompt 与 image_url:
understand_image({ prompt: "Your question about the image", image_url: "https://example.com/image.png" })
图像输入处理
工具自动处理三类图像输入:
- HTTP/HTTPS URL:下载图像并转换为 base64。例如 https://example.com/image.jpg
- 本地文件路径:读取本地文件并转换为 base64。支持绝对路径(如 /Users/username/Documents/image.png)与相对路径(如 images/photo.png),若存在 @ 前缀会被移除。
- Base64 数据 URL:直接透传已有的 base64 数据。例如 data:image/png;base64,iVBORw0KGgo...
支持的图像格式
- 支持:JPEG(.jpg、.jpeg)、PNG(.png)、WebP(.webp)
- 不支持:PDF、GIF、PSD、SVG 及其他格式
API 细节
- 端点:POST {api_host}/v1/coding_plan/vlm
- 请求体:
{ "prompt": "Your question about the image", "image_url": "data:image/jpeg;base64,/9j/4AAQ..." }
- 响应格式:
{ "content": "AI analysis of the image...", "base_resp": { "status_code": 0, "status_msg": "success" } }
提示词建议
- 描述类:"Describe what's in this image in detail"、"What is the main subject of this image?"、"Describe the visual style and composition"
- 代码/技术类:"What code is shown in this screenshot?"、"Extract all text from this image"、"Identify the UI framework/components used"
- 分析类:"Analyze this UI design. What is working well and what could be improved?"、"What emotions or mood does this image convey?"、"Compare this design to Material Design principles"
- OCR/文字提取类:"Extract all text from this image"、"Read the error message in this screenshot"、"What does the label say in this image?"
示例
错误分析:
understand_image({ prompt: "What is the error message and where is it located in this screenshot?", image_url: "./error-screenshot.png" })
代码截图:
understand_image({ prompt: "What code is shown in this screenshot? Please transcribe it exactly.", image_url: "https://example.com/code.png" })
设计评审:
understand_image({ prompt: "Analyze this UI design. What is working well and what could be improved?", image_url: "https://example.com/mockup.png" })
OCR:
understand_image({ prompt: "Extract all text from this image", image_url: "/Users/username/Documents/scan.png" })
适用场景
- 需要从截图中读取错误信息、代码或界面细节时。
- 需要理解照片、图表、示意图等视觉内容时。
- 需要从图像中提取文字或理解文档版面时。
- 需要评估 UI/UX 设计或进行视觉调试时。
限制与注意事项
- 不适用场景:图像已在对话中被描述过;图像是已识别的简单图标或表情符号;未提供图像或图像 URL 不可访问;与已有上下文重复(例如文件内容已可见)。
- 复杂分析可能触发确认提示(analyze、extract、describe、recognize、transcribe、read)。
- 错误处理:状态码 1004 为认证错误,需检查 API key 与区域;状态码 2038 表示需要实名验证;无效图像表示文件不存在或 URL 不可访问;不支持的格式表示图像格式不在 JPEG、PNG、WebP 之列。
- 提示词应尽量具体,如需结构化输出可说明格式(如 "list all elements"),若图像属于更大任务的一部分可补充上下文,截图场景可说明需要整页还是特定区域。