Skip to content

Responses API: response.code_interpreter_call_code.delta coming back as type ResponseAudioDeltaEvent #2382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
moonbox3 opened this issue May 27, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@moonbox3
Copy link

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

While using the new code interpreter functionality with the OpenAI package v1.82.0, and streaming events, the event for a response.code_interpreter_call_code.delta is coming back as part of ResponseAudioDeltaEvent instead of as part of ResponseCodeInterpreterCallCodeDeltaEvent:

Here are the events I receive:

event
ResponseCodeInterpreterCallInProgressEvent(code_interpreter_call=None, output_index=0, sequence_number=3, type='response.code_interpreter_call.in_progress', item_id='ci_68355305cb2881919aabe46ca6725a2403aa3f9ee87e93d4')

Then:

event
ResponseAudioDeltaEvent(delta='import', sequence_number=4, type='response.code_interpreter_call_code.delta', output_index=0, item_id='ci_68355305cb2881919aabe46ca6725a2403aa3f9ee87e93d4')

To Reproduce

  1. Pip install the openai 1.82.0 package.
  2. Get a streaming response when configuring the tools like:
tools=[
  {
    "type": "code_interpreter",
    "container": { "type": "auto" }
  }
],
  1. The response will be of type ResponseAudioDeltaEvent but contain the following:
event
ResponseAudioDeltaEvent(delta='import', sequence_number=4, type='response.code_interpreter_call_code.delta', output_index=0, item_id='ci_68355305cb2881919aabe46ca6725a2403aa3f9ee87e93d4')

I handle streaming events in the a similar way to (that all emit the correct event types):

response: AsyncStream[ResponseStreamEvent] = await agent.client.responses.create(
    input="Give me the first 10 fibonacci numbers using Python",
    instructions=<instructions>,
    previous_response_id=previous_response_id,
    store=store_output_enabled,
    tools=tools,  # configured for code interpreter
    stream=True,
    **response_options,
)

async with response as response_stream:
    async for event in response_stream:
        event = cast(ResponseStreamEvent, event)
        match event:
            case ResponseCreatedEvent():
            	# Removed for brevity
                pass
            case ResponseOutputItemAddedEvent():
                # Removed for brevity
                pass
            case ResponseFunctionCallArgumentsDeltaEvent():
                # Removed for brevity
                pass
            case ResponseCodeInterpreterCallCodeDeltaEvent():
                # Expect to hit this case, but I do not.
                pass

Code snippets

See above.

OS

MacOS Sequoia 15.5

Python version

Python 3.12.10

Library version

openai 1.82.0

@moonbox3 moonbox3 added the bug Something isn't working label May 27, 2025
@dominpm
Copy link

dominpm commented May 27, 2025

Also happening on file_search annotations #2383

@moonbox3
Copy link
Author

@RobertCraigie, FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants