azureazure-openaiopenai-assistants-api

In Azure OpenAI Assistants when I upload a file and save it where is that file stored?


In Azure OpenAI Studio I am hoping to use Assistants to do data analysis, however, I need to know where those files are stored and how to delete them. When I click on add files I am offered the chance to use an already uploaded file. If I delete previously made assistants then the file remains.

Where are these files being uploaded to and how can I:

I've tried searching the documentation on assistants but it only references files used in threads, not where they are stored. I also tried deleting assistants to see if files uploaded to them get deleted too but they don't.

Edit:

@Sampath I uploaded files from the playground under Assistants. When I click on Add Files I see previously uploaded files. I didn't follow a reference I just used the tool as I would the chatGPT interface from openAI.

image_of_file_upload_tool_used


Solution

  • Usually, files appear in the Data files tab. Sometimes, due to region restrictions, they don't appear.

    enter image description here

    So, there is no direct way to delete those files in the portal, but you can use the Python SDK or REST to delete them.

    Below are the files I have in the existing files.

    enter image description here

    The same files are listed when using the Python SDK.

    import os
    import json
    from openai import AzureOpenAI
        
    client = AzureOpenAI(
        api_key="bb286...............",  
        api_version="2024-02-15-preview",
        azure_endpoint = "https://<openai_name>.openai.azure.com/"
        )
        
    for i in client.files.list():
        print(i)
       
    

    Output:

    enter image description here

    Whenever you create a file, a file_id is automatically generated, and you can use that ID for various operations.

    To delete a file, use the code below.

    client.files.delete('file_id')

    enter image description here

    Afterward, refresh the portal page to see the changes.

    Next, to manage access, you need to restrict access to the Azure OpenAI resource itself, either by api key or in IAM. However, you cannot restrict access only to those files.