An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
Hello Mohamed,
Thanks for reaching out to us and share the insight here. Are you mentioning you want to just remove the oldest file from your file list and add a new one?
This scenario seems not covered in the official document.
I know there is a 20 files limit for code interpreter from OpenAI document but it seems the Azure official document not mentions it.
This issue seems related to the structure more, I would suggest you try to enable the azure_ai_search.indexes is populated as below. Or another way, you may just update your file list and update your assistant directly.
Please have a try and let us know how it works, if it is not working, I would recommend you raising a support ticket for this case, I am happy to enable you a free ticket since this scenario is not covered and the feature is still on preview stage.
# Ensure azure_ai_search.indexes is populated, even if it's a placeholder
if not my_thread.tool_resources.azure_ai_search.indexes:
my_thread.tool_resources.azure_ai_search.indexes = ["your_index_name"] # Replace with your actual index name if using Search
# Maintain the file_ids limit of 20 by removing the oldest file_id if needed
if len(my_thread.tool_resources.code_interpreter.file_ids) >= 20:
my_thread.tool_resources.code_interpreter.file_ids.pop(0)
# Append the new file_id
my_thread.tool_resources.code_interpreter.file_ids.append(message_file.id)
# Update the thread with the fully populated tool_resources
my_thread = client.beta.threads.update(
my_thread.id,
tool_resources=my_thread.tool_resources
)
I hope this helps.
Regards,
Yutong
-Please kindly accept the answer if you feel helpful to support the community, thanks a lot.