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

Responses API with code_interpreter returns empty output_text in v2.20.0 (regression from v2.19.0)

Aperta
#2,870 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #2925 di @roli-lpci — chiusa senza merge

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
api

Direzione di ricerca

Inizia eseguendo la riproduzione Python fornita con openai-python v2.20.0 e confrontando la deserializzazione della risposta della Responses API con quella di v2.19.0. Traccia il modo in cui viene analizzata la risposta completata, quindi verifica che l'utilizzo di code_interpreter preservi il messaggio finale e ripristini il valore previsto di response.output_text.

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

Descrizione

Bug report

Describe the bug

When using the Responses API with code_interpreter tool and file uploads, response.output_text is always empty in v2.20.0, even though the response status is "completed" and the code_interpreter successfully executes code. The same code works correctly on v2.19.0 and v2.18.0.

To reproduce

Minimal reproduction script:

import json
import os
from openai import OpenAI

client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))

# Upload a tiny JSON file
data = {"items": [{"name": "A", "value": 10}, {"name": "B", "value": 20}]}
uploaded = client.files.create(
    file=("test_data.json", json.dumps(data).encode()),
    purpose="assistants",
)

try:
    response = client.responses.create(
        model="o4-mini",
        reasoning={"effort": "low"},
        tools=[
            {
                "type": "code_interpreter",
                "container": {"type": "auto", "file_ids": [uploaded.id]},
            },
        ],
        instructions="You are a helpful data analyst. Always reply with a final text answer.",
        input="Read test_data.json and return the sum of the 'value' column. Reply with just the number.",
        max_output_tokens=256,
        timeout=120,
    )

    print(f"Status: {response.status}")
    print(f"output_text: {response.output_text!r}")
    print(f"Output items: {len(response.output)}")
    for i, item in enumerate(response.output):
        print(f"  [{i}] type={item.type}")
finally:
    client.files.delete(uploaded.id)
Expected behavior

response.output_text should contain the model's text answer (e.g. "30"), as it does on v2.19.0.

Actual behavior (v2.20.0)
  • response.status → "completed"
  • response.output_text → "" (empty string)
  • The code_interpreter_call output item shows status="completed" but outputs=null
  • No message output item is present in response.output

Typical output on v2.20.0:

Status: completed
output_text: ''
Output items: 2
  [0] type=reasoning
  [1] type=code_interpreter_call  (status=completed, outputs=null)
Working behavior (v2.19.0 and v2.18.0)
Status: completed
output_text: '30'
Output items: 6
  [0] type=reasoning
  [1] type=code_interpreter_call  (status=completed)
  [2] type=reasoning
  [3] type=code_interpreter_call  (status=completed)
  [4] type=reasoning
  [5] type=message  (status=completed)
Version comparison matrix
openai version o4-mini + effort=low gpt-4.1-mini (no reasoning)
2.18.0 ✅ PASS ✅ PASS
2.19.0 ✅ PASS ✅ PASS
2.20.0 ❌ FAIL (empty output_text) ❌ FAIL (empty output_text)
Environment
  • OS: Ubuntu Linux
  • Python: 3.12
  • openai (broken): 2.20.0
  • openai (working): 2.19.0, 2.18.0
Additional context

The issue affects both reasoning models (o4-mini) and non-reasoning models (gpt-4.1-mini), so it is not specific to reasoning effort settings. The regression appears to be in how the SDK handles the response deserialization — the API-side code_interpreter executes correctly, but the final message output item with the text response is missing from the parsed response on v2.20.0.

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

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.