tools are not supported when an image model is used through Responses
错误信息
tools are not supported when an image model is used through Responses
AI 解决方案
原文:tools are not supported when an image model is used through Responses
译文:当通过 Responses 使用图像模型时,不支持使用 tools
🎯 原因分析
在使用 Responses API 调用图像模型时,系统限制了 tools(工具/函数调用)功能的使用。这是由于图像模型的设计用途是处理视觉内容生成或理解任务,而非执行工具调用逻辑,二者在功能架构上存在冲突。
💡 解决方案
移除调用图像模型时的 tools 参数,直接保留图像生成或处理的核心逻辑。
``代码语言错误示例:图像模型中使用了 tools 参数
response = client.responses.create(
model="image-model-name",
input=[{"role": "user", "content": [{"type": "image", "image_url": "..."}]}],
tools=[{"type": "function", "function": {...}}] # 报错点:工具参数不被支持
)
正确示例:移除 tools 参数
response = client.responses.create(
model="image-model-name",
input=[{"role": "user", "content": [{"type": "image", "image_url": "..."}]}]
)
``