Skip to content

feat(openai): pass through code_interpreter tool in Responses API - #1

Open
OmarGoubail wants to merge 1 commit into
mainfrom
code-interpreter-passthrough
Open

feat(openai): pass through code_interpreter tool in Responses API#1
OmarGoubail wants to merge 1 commit into
mainfrom
code-interpreter-passthrough

Conversation

@OmarGoubail

@OmarGoubail OmarGoubail commented Jun 23, 2026

Copy link
Copy Markdown

Description

Adds minimal Code Interpreter passthrough support to ReqLLM's OpenAI Responses API provider.

Callers can now pass %{"type" => "code_interpreter", "container" => ...} in tools: and ReqLLM will forward the tool map unchanged to OpenAI.

Raw code_interpreter_* output items (code_interpreter_call, code_interpreter_logs, code_interpreter_interpretation, etc.) can be accessed in response.provider_meta["code_interpreter"]["items"] and are excluded from normal text/function tool-call extraction.

Both object containers (%{"type" => "auto", "memory_limit" => "4g"}) and explicit string container IDs ("cntr_abc123") are supported.

Notes:

  • This is Responses API only. OpenAI's Chat Completions SDK type (ChatCompletionFunctionToolParam) only supports type: "function", so code_interpreter is not supported there.
  • Azure's Responses API provider delegates to ReqLLM.Providers.OpenAI.ResponsesAPI, so this change will pass
    code_interpreter through automatically. However, Azure OpenAI's Responses API may not expose Code Interpreter; I am unable to confirm this through the docs though. I am working on trying to test it.

Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update

Breaking Changes

Testing

  • Tests pass (mix test)
  • Quality checks pass (mix quality)
    • Quality checks fail, because of a dialyzer warning in lib/req_llm/streaming/http2_duplex_session.ex:83, it's unrelated to my changes though, fixing it is straightforward but not within the scope of this pr, if it's ignored mix quality passes

Live verification:

Screen.Recording.2026-06-23.at.3.16.58.PM.mov

Checklist

  • My code follows the project's style guidelines
  • I have updated the documentation accordingly
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass
  • My commits follow conventional commit format
  • I have NOT edited CHANGELOG.md (it is auto-generated by git_ops)

Related Issues

Closes #

@OmarGoubail
OmarGoubail force-pushed the code-interpreter-passthrough branch from 909d33e to f7e6af5 Compare June 23, 2026 12:45

defp extract_code_interpreter_items(_), do: []

defp code_interpreter_item?(%{"type" => type}) when is_binary(type) do

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't these this be a match clause with %{"type" => "code_interpreter" <> _}

maybe add it as a module attribute instead of literal

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

String.starts_with?(type, "code_interpreter")
end

defp code_interpreter_item?(%{type: type}) when is_binary(type) do

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

@OmarGoubail
OmarGoubail force-pushed the code-interpreter-passthrough branch 2 times, most recently from 20fef34 to 3d2f511 Compare June 23, 2026 13:15
@OmarGoubail
OmarGoubail force-pushed the code-interpreter-passthrough branch from 3d2f511 to 01fbc6c Compare June 24, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants