Share via

Responses API not returning file annotations

Mathias Felix Gruber 0 Reputation points
2025-11-20T08:25:19.7866667+00:00

 We’re actively using the Responses API with code interpreter in our internal AI solution. However, we are facing the issue of files being output by the code interpreter not consistently being attached as annotations on the output. E.g. we’ll have the code interpreter execute a code like the following:

import qrcode

# Data to embed in QR code

data = "www.example.com"

# Create QR code

qr = qrcode.QRCode(

    version=1,

    error_correction=qrcode.constants.ERROR_CORRECT_L,

    box_size=10,

    border=4,

)

qr.add_data(data)

qr.make(fit=True)

# Generate the image

img = qr.make_image(fill_color="black", back_color="white")

# Save the QR code image to /mnt/data

output_path = "/mnt/data/leo_pharma_qr.png"

img.save(output_path)

output_path, img

Sometimes, the output file will be attached to the annotations response. Other times not. We found through trial and error that we need to force files to be saved to the /mnt/data to ever be included as annotations, but it’s still very inconsistent.

Is there something we’re missing to get this working well?

Azure OpenAI in Foundry Models

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.