Unable to run code using CodeInterpreter

I am trying to develop the ability to analyze data in a JSON file using an assistant with FileSearch and CodeInterpreter using C# and the OpenAI .NET SDK from instructions in the SDK documentation. Everything works except when I finally try to run the request against the file in the vector store I get the following message back:

“It appears the platform doesn’t directly execute code. Instead, I will guide you on how to run this locally.”

I can find several videos and code examples of people doing something very much like this. Is there a configuration problem or a limitation on my account that could be causing this?

Where should I look for a fix?

Thanks for any help you can offer!

Welcome to the community!

Hmm, if I understand this correctly, you’re trying to run C# in the code interpreter, did I get this right?

In that case, unfortunately, I’ve got bad-ish news for you. As far as I know, the code interpreter only works in python.

The good news is the model can generally readily translate C# into python, and then execute that. Have you tried that? Sometimes you just need to tell it.

Does that help?

1 Like

No I am not trying to run C# code in the interpreter. What I am trying to do is set it up to analyze my file within a vector store. The instructions tell the assistant to build and run Python code to accomplish the task. What the assistant returns is the message that it cannot run code and it returns the Python code for me to run myself. My understanding is that it is meant to run the code.

To be clear, I am using the OpenAI .NET SDK with C# to build the vector store, upload the file, create the assistant and run the thread.

The question I have is why is it telling me that it does not run code? I have seen several examples of it working online but mine does not.

Ah, sorry, I misunderstood.

Did you enable the code interpreter in your assistant settings?

That’s a step in the right direction. Thank you!

I am no longer getting the message that it cannot run code. But now it just echos back my initial prompt without offering any feedback or appearing to do anything.

Ideas on that?

Hmm… sounds like it might be a prompt issue. Can you share what you’re asking? Are you telling the model that it should use the code interpreter, and how, and what it should respond with?

The issue was that I was exceeding my token rate limit. I got it all working this morning.

Next up I am going to try to get it to make me a heat map from the data.

Let me thank you for the help here. It’s been invaluable.

I do have another question: I have not enabled file search in the assistant. When is that needed?

Thanks again!

1 Like

File search is for rag stuff, when your data doesn’t fit into the context