Make file available for file_search and code_interpreter at the same time

Hey everyone!

I am using the assistants API as the engine for a chatbot, and I was using a logic that if someone uploads a “.pdf” file, that file would be addedd to the file_search capabilities of the assistant, for reasoning.

However, a use case appeared where users want to be able to send “.pdf” files for the bot to make operations on it, such as editing text and etc.

I did not want to expose an option for the user to select if it wants to send to the code_interpreter or the file_search, so I thought of adding the file both for the file_search and the code_interpreter.

This way, the AI should be able to search if a reasoning question is made, or to access the file in the code environment for further operations. However, this is not workiing as expected, and it usually ends in triggering the wrong tool.

Does anyone had a similar problem before? I would love to see how you solved this issue.

2 Likes