Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

GPT5 Models | Tool choices other than 'auto' are not supported with model

未关闭
#2,537 17 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
python
领域
api

调研方向

从复现中的 Responses API 调用开始,将其 allowed_tools tool_choice 与链接的 API 文档进行比较。检查 400 响应是由 Python 库还是底层 API 导致的;确定支持的行为以及所需的任何库更改后,即视为完成。

由索引模型根据 Issue 内容生成。

描述

api bug
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:
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:
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

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

openai/openai-python 的其他 Issue

查看 openai/openai-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。