Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Output response types are not usable as parameters

オープン
#2,323 コメント 0 件 リアクション 5 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python

調査の方向性

まず src/openai/types/responses/easy_input_message_param.py と src/openai/types/responses/response_output_message.py を比較し、レポートに記載された必須フィールドに焦点を当てます。これらの自動生成された型がどのように生成されるかを追跡してから、互換性の変更をどこに置くべきかを判断します。報告された messages.append(item) パターンが、意図された response と input の型要件を弱めることなく、Python の型チェックを通過すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug sdk
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

Consider the following code:

messages: ResponseInputParam = [{"role": "developer", "content": instructions}]

# ...
resp = client.responses.create(
    model="o4-mini",
    input=messages,
)

for item in resp.output:
    match item:
        case ResponseOutputMessage(content=content):
            print(item.content)
            messages.append(item)

This seems like it should work fine, but it generates a type checking error:

error: Argument of type "ResponseOutputMessage" cannot be assigned to parameter "object" of type "ResponseInputItemParam" in function "append"
    Type "ResponseOutputMessage" is not assignable to type "ResponseInputItemParam"
      "ResponseOutputMessage" is not assignable to "EasyInputMessageParam"
      "ResponseOutputMessage" is not assignable to "Message"
      "ResponseOutputMessage" is not assignable to "ResponseOutputMessageParam"
      "ResponseOutputMessage" is not assignable to "ResponseFileSearchToolCallParam"
      "ResponseOutputMessage" is not assignable to "ResponseComputerToolCallParam"
      "ResponseOutputMessage" is not assignable to "ComputerCallOutput"
      "ResponseOutputMessage" is not assignable to "ResponseFunctionWebSearchParam"
    ... (reportArgumentType)

I think this is because the parameter types use Required, but the output types don't. For example, EasyMessageInputParam requires content, but ResponseOutputMessage doesn't:

https://github.com/openai/openai-python/blob/ed53107e10e6c86754866b48f8bd862659134ca8/src/openai/types/responses/easy_input_message_param.py#L13-L18

vs

https://github.com/openai/openai-python/blob/ed53107e10e6c86754866b48f8bd862659134ca8/src/openai/types/responses/response_output_message.py#L20-L21

I recognize that the bindings are auto-generated and this may not be trivial to fix.

To Reproduce

n/a

Code snippets

OS

linux

Python version

Python v3.13.2

Library version

openai v1.75.0

主要言語
Python
スター
31.8k
フォーク
7.3k
平均マージ
1日 1時間
マージ済み PR(30日)
137

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

openai/openai-python のほかの issue

openai/openai-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。