Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Output response types are not usable as parameters

Aperta
#2,323 0 commenti 5 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Inizia confrontando src/openai/types/responses/easy_input_message_param.py e src/openai/types/responses/response_output_message.py, concentrandoti sui campi obbligatori descritti nel report. Ricostruisci come vengono generati questi tipi autogenerati prima di decidere dove collocare la modifica di compatibilità. Il lavoro è completato quando il pattern segnalato messages.append(item) supera il controllo dei tipi Python senza indebolire i requisiti previsti per i tipi di risposta e di input.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Python
Stelle
31.8k
Fork
7.3k
Merge medio
1g 3h
PR unite (30g)
131

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openai/openai-python

Tutte le issue di openai/openai-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.