![]()
![]()
![]()
![]()
2026年1月10日,openai-python迎來了最新版本v2.15.0。該版本由自動化代碼生成系統發布,包含重要的功能更新與內部優化,是一次面向開發者的實用增強升級。以下為詳細更新內容及代碼層面變化解析。
一、版本概覽
?版本號:2.15.0
?發布日期:2026年1月10日
?主要提交:
?
feat(api): add new Response completed_at prop?
chore(internal): codegen related update?
release: 2.15.0
本次更新共有3次提交、26個文件被修改,由自動化bot完成發布。
二、核心功能更新 1. 新增 Response 的completed_at屬性
在類型文件src/openai/types/responses/response.py中新增了completed_at字段,用于表示 Response 完成的時間戳。
.
completed_at: Optional[float] = None
"""
Unix timestamp (in seconds) of when this Response was completed.
Only present when the status is completed.
"""這一更新使開發者能夠精確追蹤響應的完成時間,方便對話記錄、系統日志及數據分析。
2. 新增語音模型與語音參數調整
本次版本對多處與語音合成(Speech、ChatCompletion Audio、Realtime Audio)相關的文件進行了改進,統一了語音列表描述方式,并新增了兩個新內置聲音:marin與cedar。
更新涉及文件如下:
?
src/openai/resources/audio/speech.py?
src/openai/types/audio/speech_create_params.py?
src/openai/types/chat/chat_completion_audio_param.py?
src/openai/types/realtime/realtime_audio_config_output.py?
src/openai/types/realtime/realtime_audio_config_output_param.py?
src/openai/types/realtime/realtime_response_create_audio_output.py?
src/openai/types/realtime/realtime_response_create_audio_output_param.py
更新后的語音選項包括:
.
alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse, marin, cedar描述也改為統一格式:
Supported built-in voices are … Previews of the voices are available in the Text to Speech guide.
這一優化為語音生成場景提供更多聲音選擇,顯著提升了個性化與音質表現。
3. GPT 圖像模型全面升級
在src/openai/resources/images.py中的說明中,新增了GPT Image 1.5與GPT Image 1-mini模型支持,官方表述修改為:
This endpoint supports GPT Image models (gpt-image-1.5, gpt-image-1, and gpt-image-1-mini) and dall-e-2.
這意味著圖像編輯與生成接口的靈活性進一步提升,兼容更多模型版本。
4. 工具選擇參數優化(tool_choice)
在多個文件中(如src/openai/resources/responses/input_tokens.py、src/openai/types/responses/input_token_count_params.py)重新定義了tool_choice字段的描述,使其更為簡潔與直觀:
由:
How the model should select which tool (or tools) to use when generating a response.
更新為:
Controls which tool the model should use, if any.
這一修改提升了文檔清晰度,使開發者更容易理解工具選擇機制。
5. 新增加密內容參數(compaction item)
在以下三個文件中增加了對encrypted_content字段的說明:
?
src/openai/types/responses/response_compaction_item.py?
src/openai/types/responses/response_compaction_item_param.py?
src/openai/types/responses/response_compaction_item_param_param.py
新增描述:
“The encrypted content of the compaction summary.”
此更新用于支持對話壓縮(Compaction)項的加密內容描述,增強了安全性與數據完整性。
6. 新增 Code Interpreter 容器內存限制參數
在src/openai/types/responses/tool.py與src/openai/types/responses/tool_param.py中新增字段:
.
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]
"""The memory limit for the code interpreter container."""開發者可通過該參數控制代碼執行容器的內存上限,適用于需要特殊資源占用的任務場景。
7. Web 搜索函數優化與參數擴展
文件:
?
src/openai/types/responses/response_function_web_search.py?
src/openai/types/responses/response_function_web_search_param.py
更新內容:
? 原
query參數標記為[DEPRECATED]? 新增
queries支持多關鍵詞搜索? 增加
sources字段列表,用于返回搜索來源。
這標志著搜索功能接口設計更趨靈活,兼容多維查詢場景。
8. 其他文件變動摘要
?
LICENSE文件更新年份至 2026。?
CHANGELOG.md增加新版本日志與提交記錄。?
pyproject.toml與_version.py版本號提升至 2.15.0。?
.stats.yml更新 OpenAPI 規范 URL 與哈希。?
.release-please-manifest.json更新標識。
內部代碼生成系統進行了更新(代碼生成相關),優化了自動化生成流程,確保類型文件同步最新 OpenAPI 規范:
提交記錄:
chore(internal): codegen related update該更新確保整個 Python SDK 與平臺 API 規范持續保持一致。
四、總結
代碼地址:github.com/openai/openai-python
openai-python v2.15.0 是一次重要的維護與功能增強版本,重點包括:
?Response新增 completed_at 屬性,支持響應結束時間追蹤。
?語音模型擴展,新增 marin 與 cedar 聲音選項。
?圖像編輯接口支持 GPT Image 1.5 與 mini 模型。
?工具選擇參數描述簡化,文檔更清晰。
?Code Interpreter 增加內存限制設置。
?Web 搜索功能優化,支持多關鍵詞與來源返回。
?系統內部代碼生成與OpenAPI規范全面更新。
我們相信人工智能為普通人提供了一種“增強工具”,并致力于分享全方位的AI知識。在這里,您可以找到最新的AI科普文章、工具評測、提升效率的秘籍以及行業洞察。 歡迎關注“福大大架構師每日一題”,發消息可獲得面試資料,讓AI助力您的未來發展。
特別聲明:以上內容(如有圖片或視頻亦包括在內)為自媒體平臺“網易號”用戶上傳并發布,本平臺僅提供信息存儲服務。
Notice: The content above (including the pictures and videos if any) is uploaded and posted by a user of NetEase Hao, which is a social media platform and only provides information storage services.