# \[Theory\] No Code Interpreter API Anytime Soon

**URL:** <https://community.openai.com/t/theory-no-code-interpreter-api-anytime-soon/328953>\
**Category:** API\
**Tags:** code-interpreter\
**Created:** [August 24, 2023, 10:33pm UTC](https://community.openai.com/t/theory-no-code-interpreter-api-anytime-soon/328953 "2023-08-24T22:33:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon22939549](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@anon22939549](https://community.openai.com/u/anon22939549)\
**Post date:** [August 24, 2023, 10:33pm UTC](https://community.openai.com/t/theory-no-code-interpreter-api-anytime-soon/328953/1 "2023-08-24T22:33:07Z")

</div>

I don’t think we’ll see a Code Interpreter API anytime soon because of the risk of runaway generation.

Code Interpreter responds after every code execution, so it’s theoretically _possible_ for a bad actor to engineer a situation which could lead to an essentially infinite loop of token generation from a single prompt.

So, I think OpenAI will need to create some safeguards to put in place to guarantee that cannot happen before we’ll ever see an API endpoint.

---

<div class="post-metadata">

**Author:** ![Foxalabs](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/foxalabs/32/738355_2.png) [@Foxalabs](https://community.openai.com/u/Foxalabs)\
**Post date:** [August 25, 2023, 9:36am UTC](https://community.openai.com/t/theory-no-code-interpreter-api-anytime-soon/328953/2 "2023-08-25T09:36:57Z")

</div>

If you do that with current CI model it will exit after (I think) either 10 attempts for some predefined token limit (not sure on those numbers exactly, but in the ballpark of 4-5 mins of generation) Yu could presumably have similar limits on the API, but it would be super compute heavy.

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [August 25, 2023, 9:59am UTC](https://community.openai.com/t/theory-no-code-interpreter-api-anytime-soon/328953/3 "2023-08-25T09:59:31Z")

</div>

You can already get an AI model with the skill of code interpreter:

1. use a dummy function that doesn’t get called,
2. Add the ChatGPT code interpreter prompt to the system prompt,
3. Get python function calls when AI wants to answer by running code (along with things the AI wants to say at the same time).
4. To chat history, add the AI chat content response and actual unseen AI-generated function language correctly as “assistant” role, and the last line of generated variables from python as function role, and call API again.
5. Repeat until you don’t get any function calls.

The complete chat history makes the number and type of function call operations apparent, better than ChatGPT history function if it required 10 automatic rewrites and tracebacks for the AI to fix the code it wanted to run.

Just add your actual python notebook sandbox - or not sandboxed. Add new features like mountpoint browsing and URL file location responses.

---

<div class="post-metadata">

**Author:** ![anon22939549](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@anon22939549](https://community.openai.com/u/anon22939549)\
**Post date:** [August 25, 2023, 5:13pm UTC](https://community.openai.com/t/theory-no-code-interpreter-api-anytime-soon/328953/4 "2023-08-25T17:13:41Z")

</div>

There very well may be some pre-defined threshold, I’ve not probed enough to begin to identify it.

I’ve definitely had “single” generations between 10k and 20k tokens. I can’t say how long they ran for because I tabbed away and did other things while they were running, but I’m sure it was on the order of at least 4–5 minutes.

Much of this would depend on the actual implementation of a CI API endpoint, specifically when control is returned to the calling function. For instance, if after a code execution it’s logical to kick it back to the caller who would then decide whether or not to direct things to the user or assistant. OpenAI seems to always make a call to the assistant before halting so I could imagine that getting baked into the API. ¯⁠\⁠\_⁠(⁠ツ⁠)⁠\_⁠/⁠¯

Do you have any source for the existence of a fail-safe?

@_j I am so confused by you.

We’ve interacted enough that I would hope you’d be aware that I’m not a moron—I’m not sure why you thought I needed this.

First, no.

There is a huge difference between calling an OpenAI API which can run code on OpenAI’s servers and running code on my own server based on a response from an OpenAI API.

I did, in point of fact, write my own “Code Interpreter” _months before_ OpenAI announced theirs.

I code mostly in R\[1\] for my research, so I wrote a plugin for R Studio that calls the OpenAI API to write, edit, and document code. Code is run either in a sandbox or my current interactive session and the results are sent back to the assistant to iterate on or verify correctness.

And yes it does bail out when it has been running too long.\[2\]

* * *

1. and some Fortran 

2. Though, for full transparency, I’ll admit this was a bit of an afterthought as I was using the codex model when it was in free-beta and wasn’t worried about usage.

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [August 25, 2023, 6:37pm UTC](https://community.openai.com/t/theory-no-code-interpreter-api-anytime-soon/328953/5 "2023-08-25T18:37:37Z")

</div>

> [@anon22939549](#):
>
> There is a huge difference

And what is that huge difference then? Perhaps what you haven’t tried to see is that the AI model used when a function is included is the exact same as would be used by code interpreter, with all the fine-tuning. It will make python function calls to complete calculation answers to answer the user without any python function at all, even preferring that over calling a Wolfram Alpha calculator.

---

<div class="post-metadata">

**Author:** ![anon22939549](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@anon22939549](https://community.openai.com/u/anon22939549)\
**Post date:** [August 25, 2023, 6:52pm UTC](https://community.openai.com/t/theory-no-code-interpreter-api-anytime-soon/328953/6 "2023-08-25T18:52:34Z")

</div>

> [@\_j](#):
>
> And what is that huge difference then?

I invite you to _think_.

What is the difference between,

1. Calling an OpenAI API which can run code on OpenAI’s servers
2. Running code on my own server based on a response from an OpenAI API

Think _hard_.

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [August 25, 2023, 7:04pm UTC](https://community.openai.com/t/theory-no-code-interpreter-api-anytime-soon/328953/7 "2023-08-25T19:04:39Z")

</div>

Freedom, permanence, your own modules, and ability to dedicate any compute resources or virtualenv you want when it is not running on someone else’s spun up Jupyter instance.

Sorry to insult you with useful information, I’ll make sure that never happens again. The helping, that is.
