GPT5 Models | Tool choices other than 'auto' are not supported with model
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从复现中的 Responses API 调用开始,将其 allowed_tools tool_choice 与链接的 API 文档进行比较。检查 400 响应是由 Python 库还是底层 API 导致的;确定支持的行为以及所需的任何库更改后,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
We are unable to use any tool_choice besides 'auto' for GPT5 models in the Responses API using the latest release v.1.99.5.
Documentation:
- https://platform.openai.com/docs/guides/latest-model#allowed-tools
- https://platform.openai.com/docs/api-reference/responses/create#responses_create-tool_choice
BadRequestError: Error code: 400 - {'error': {'message': "Tool choices other than 'auto' are not supported with model 'gpt-5-mini-2025-08-07' and the following tool types: 'code_interpreter', 'file_search'.", 'type': 'invalid_request_error', 'param': 'tool_choice', 'code': None}}
Posts on community.openai.com:
- https://community.openai.com/t/error-400-tool-choices-other-than-auto-are-not-supported-with-model-gpt-5-and-the-following-tool-types-web-search-preview/1337152
- https://community.openai.com/t/gpt5-and-forced-web-search/1344079
- https://community.openai.com/t/gpt5-cannot-use-web-search-please-help/1337041
To Reproduce
stream = await llm.responses.create(
model="gpt-5",
input="Use your python tool to do this math: 8*9183*7663",
tools=[
{"type": "code_interpreter", "container": {"type": "auto"}},
],
tool_choice={
"type": "allowed_tools",
"mode": "auto",
"tools": [
{
"type": "code_interpreter",
}
],
},
stream=True,
)
async for event in stream:
print(event.model_dump_json(indent=2))
Code snippets
OS
Windows 11
Python version
Python 3.13.2
Library version
openai v.1.99.5
- 主要语言
- Python
- 星标
- 31.8k
- 派生
- 7.3k
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 131
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
openai/openai-python 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
openai/openai-python#4022 · 19 条评论 ·
维护者通常 1 天内回复
-
fix(auth): SubjectTokenProviderError drops response and duplicates error message in workload identity providers可能已有人在做 @mohmedmm 于 9 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
openai/openai-python#4017 · 3 条评论 ·
维护者通常 1 天内回复
-
Querystring drops explicit empty-string scalar values可能已有人在做 @sylvesterkaczmarek 于 32 天前认领。 未关闭sdk-breaking-change v4
难度 2/5 1-3 小时 新手友好度 86/100
openai/openai-python#3837 ·
维护者通常 1 天内回复
-
Define + export `ServiceTiers` string literal可能已有人在做 @SparshGarg999 于 58 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
openai/openai-python#3556 · 3 条评论 ·
维护者通常 1 天内回复
-
Empty OPENAI_BASE_URL prevents fallback to default API endpoint可能已有人在做 @Sehastrajit-S 于 24 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 68/100
openai/openai-python#2927 · 6 条评论 ·
维护者通常 1 天内回复
查看 openai/openai-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
vllm-project/vllm#61131 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
kubernetes-client/python#2735 ·
维护者通常 1 天内回复
-
desktop help wanted test
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
docs pydanty:is-working
难度 2/5 1-3 小时 新手友好度 68/100
pydantic/pydantic-ai#10113 ·
维护者通常 1 天内回复
-
Tutorial unit test leaks sample data into tutorial doctest可能已有人在做 @Gambit-Checkmate 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100