P Mahadevan Greetings & Welcome to Microsoft Q&A forum!
AFAIK, You can upload up to 20 files, with a max file size of 512 MB to use with tools.
After some trail and error found an alternate way using the following code: is this the correct approach?
That is a correct approach to update the tool resources of an assistant. In your code, you are updating the code_interpreter
tool resource of the assistant with the specified file_ids
.
As mentioned here, you can modify the assistant with an update method.
my_updated_assistant = client.beta.assistants.update(
"asst_abc123",
instructions="You are an HR bot, and you have access to files to answer employee questions about company policies. Always respond with info from either of the files.",
name="HR Helper",
tools=[{"type": "code-interpreter"}],
model="gpt-4", #model = model deployment name
file_ids=["assistant-abc123", "assistant-abc456"],
)
The update
method of the assistant object can be used to update various properties of an assistant.
The file_ids
parameter is a list of file IDs that contain the code that the code_interpreter
tool resource will execute.
By updating the file_ids
of the code_interpreter
tool resource, you are essentially updating the code that the assistant will execute when using this tool.
So, your code seems to be correct and should work as expected to update the tool resources of an assistant.
Do let me know if that helps or have any other queries.
If the response helped, please do click Accept Answer
and Yes
for was this answer helpful.