Can I use both retrieval and code-interpreter in same assistant?

Can I use in one assistant all possible tools: retrieval, code-interpreter and function calling? It looks like in Playground I can do it, but not with API. For example, I want to use retrieval for my assistant, but I also want it can read csv files, so in this case I need code-interpreter. When I add both of them in Playground to assistant I didn’t have any errors, but in my streamlit app, they don’t work together: when I try to upload csv file I get error (file type), but when I remove ‘retrieval’ tool from this assistant and left only ‘code-interpreter’ it can read same file without problems. Same with function: when I add as tools both code-interpreter and my function, my function doesn’t work. But when I remove code-interpreter from it, it starts working.
What’s the problem? I thought that assistant can have many tools and can choose by itself which one should use in particular case.

1 Like

As per my understanding of the documentation, you can enable both in the assistant, but when creating a “run” you can choose which tools to use.


run = client.beta.threads.runs.create(
  tools=[{"type": "code_interpreter"}]

I am in the middle of adding Assistants to my application, and that’s the approach I want to take for simplicity. One assistant per user, and the application will modify the assistant instructions dynamically depending on whether the user is going to use Retrieval or Code Interpreter, but the user must manually decide manually each time, switching between the two modes (retrieval and code).