Skip to content

Responses API Code Interpreter #2396

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
mattbrandman opened this issue Jun 4, 2025 · 1 comment
Open
1 task done

Responses API Code Interpreter #2396

mattbrandman opened this issue Jun 4, 2025 · 1 comment
Labels
bug Something isn't working openapi

Comments

@mattbrandman
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

The responses API requires a "results" field on the code_interpreter model. This is populated with None on every response I have seen but is also required when sending the old code_interpreter blocks, however the api rejects the results field as unknown the class is

class ResponseCodeInterpreterToolCallParam(TypedDict, total=False):
    id: Required[str]
    """The unique ID of the code interpreter tool call."""

    code: Required[str]
    """The code to run."""

    results: Required[Iterable[Result]]
    """The results of the code interpreter tool call."""

    status: Required[Literal["in_progress", "interpreting", "completed"]]
    """The status of the code interpreter tool call."""

    type: Required[Literal["code_interpreter_call"]]
    """The type of the code interpreter tool call. Always `code_interpreter_call`."""

    container_id: str
    """The ID of the container used to run the code."""

To Reproduce

  1. Make a request using code interpreter built in tool
  2. Try to send a follow up request with the previous code interpreter block

Code snippets

OS

MacOS

Python version

Python v3.12

Library version

v1.84

@mattbrandman mattbrandman added the bug Something isn't working label Jun 4, 2025
@czgu
Copy link

czgu commented Jun 7, 2025

+1 on this issue.

With the responses API, there is an "include" field that can be set to add outputs from the code_interpreter. It is documented here: https://platform.openai.com/docs/api-reference/responses/create#responses-create-include.

If this flag is enabled, a new "outputs" field will appear in the response, and its structure will be similar to the "results" field.

I also observed that in the OpenAI playground, when using the code_interpreter, the "outputs" field is always present, but there is no include flags in the generated CURL command to reproduce this behavior

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

No branches or pull requests

3 participants