# Anyone successfully using Code Interpreter via API for real analysis?

**URL:** <https://community.openai.com/t/anyone-successfully-using-code-interpreter-via-api-for-real-analysis/1137783>\
**Category:** API\
**Tags:** gpt-4, code-interpreter, assistants-api\
**Created:** [March 7, 2025, 2:03pm UTC](https://community.openai.com/t/anyone-successfully-using-code-interpreter-via-api-for-real-analysis/1137783 "2025-03-07T14:03:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bonjoursalutsalut](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/bonjoursalutsalut/32/512906_2.png) [@bonjoursalutsalut](https://community.openai.com/u/bonjoursalutsalut)\
**Post date:** [March 7, 2025, 2:03pm UTC](https://community.openai.com/t/anyone-successfully-using-code-interpreter-via-api-for-real-analysis/1137783/1 "2025-03-07T14:03:00Z")

</div>

Hello everyone, I’ve been experimenting with OpenAI’s Assistant API using GPT-4o and the Code Interpreter tool for some simple HR data analysis (e.g., value counts for departments, min/max salaries, etc.). My data is stored in a vector database, and I pass it as a JSON file. But I keep running into issues:

- Sometimes the model says it can’t read the data from the vector store.
- Other times, it successfully loads the file (`pd.read_json(file_path)`) and starts running Pandas functions… but then suddenly resets, replaces my data with a hardcoded example list, and gives me a completely irrelevant answer.
- In some cases , it runs the right code for the specific instruction but then outputs a different result from the expected one

Has anyone gotten this to work consistently? How do you:

- Ensure it **actually reads the right file** and doesn’t hallucinate a dataset?
- 
  - Get it to **exactly return the results** of its executed code ?

Would love to hear your experiences, workarounds, or best practices!

---

<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:** [March 7, 2025, 5:09pm UTC](https://community.openai.com/t/anyone-successfully-using-code-interpreter-via-api-for-real-analysis/1137783/2 "2025-03-07T17:09:31Z")

</div>

You’ll need to do the “making it work consistently” with your system prompting and quality of application development. First, it sounds like you are conflating the features available.

**Code interpreter** and **file\_search** ’s vector store are two different tool products.

You must decide in your API “tools” specification whether you will enable one or the other.

For code interpreter, you must attach files specifically with tool\_resources, the code interpreter type, and the file IDs that you wish to place in the mount point.

Vector stores are separate. File search is simply a knowledge search feature that returns chunked documents powered by the vector store. It is not even called “vector store” in the file search tool description, nor is there a listing of what type of knowledge there is to be found (where on models older than gpt-4o-2024-08-06, it is internally called `myfiles_browser` in the instructions placed for AI consumption.)

Thus, none of the work of developing an API application is done for you, relating to files. This includes there being no mechanism beforehand of telling the AI what files it will find in the mount point, or their purpose. It would have to write scripts to even list the contents of the directories. That is a feature for you to place and develop, which you can do with `additional_instructions` if the Python files are specific to the user or the run.

---

<div class="post-metadata">

**Author:** ![bonjoursalutsalut](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/bonjoursalutsalut/32/512906_2.png) [@bonjoursalutsalut](https://community.openai.com/u/bonjoursalutsalut)\
**Post date:** [March 8, 2025, 12:16pm UTC](https://community.openai.com/t/anyone-successfully-using-code-interpreter-via-api-for-real-analysis/1137783/4 "2025-03-08T12:16:45Z")

</div>

Thank you for the detailed clarification! I don’t think I was mixing up File Search and Code Interpreter, but I was relying on Code Interpreter to use files uploaded via File Search. I didn’t realize the difference between `tool_resources` and File Search for file access—this explains the inconsistency. I’ll make sure to attach files properly with `tool_resources` . Appreciate the insight!
