Preserve wire aliases when converting Responses output items to input

未关闭 适合新手
#5,477 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
62/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python

调研方向

issue 中指出的修改位置是转换辅助函数 _output_item_to_input_item 和 _tool_search_item_to_input_item。从这里开始,检查它们在哪里对 ResponseFunctionToolCall 等 Pydantic 响应项调用了 model_dump。将转储改为 by_alias=True,同时保留 exclude_unset 以及对 created_by 等仅输出字段的剥离。完成标准是:有一个回归测试回放带有 async 等别名字段的函数调用,并确认序列化后的输入使用线上名称。

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

描述

Summary

Response items converted back into Responses API input are serialized without Pydantic aliases. For OpenAI's ResponseFunctionToolCall, the Python attribute is async_ but the wire field is async. Replaying that item can therefore send async_ to the API and fail with an unknown parameter error.

This also affects users of the Restate Python SDK's OpenAI Agents integration, which persists model responses and returns them to the Agents SDK. The problematic conversion is in the Agents SDK's output-to-input path.

Expected behavior

When a Pydantic response item is converted to request input, serialize its API aliases (for example, async_ as async) while continuing to strip output-only metadata such as created_by.

Proposed fix

Use model_dump(exclude_unset=True, by_alias=True) in _output_item_to_input_item and _tool_search_item_to_input_item, with regression coverage for an aliased field on a response function call.

主要语言
Python
星标
30.4k
派生
4.9k
平均合并
16 小时 32 分钟
30 天内合并 PR
85

环境准备

从这里开始

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

openai/openai-agents-python 的其他 Issue

查看 openai/openai-agents-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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