Azure AI Services File Import From URL Throws 415 Error

Muso, Marin 20 Reputation points
2024-08-30T19:35:14.19+00:00

This is the request body:

Request URL: 

https://ourapiminstance.azure-api.net/genai/azure/assistants/openai/files/import?api-version=2023-12-01-preview

Request Body:

{
    "purpose": "fine-tune",
    "filename": "toy_chat_fine_tuning.jsonl",
    "content_url": "https://github.com/openai/openai-cookbook/blob/main/examples/data/toy_chat_fine_tuning.jsonl"
    
}

Headers: 

Content-Type: multipart/form-data
Ocp-Apim-Subscription-Key: ****

Response:


HTTP/1.1 415 Unsupported Media Type
Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,073 questions
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,916 questions
{count} votes

Accepted answer
  1. YutongTie-MSFT 50,856 Reputation points
    2024-09-03T20:51:55.92+00:00

    Hi @Muso, Marin

    It seems you are using a wrong Content-Type, please make sure you are using below content type -

    Content-Type: application/json

    I am sharing my working request body here -

    {
    	 "purpose": "fine-tune",
          "filename": "toy_chat_fine_tuning.jsonl",
          "content_url": "https://github.com/openai/openai-cookbook/blob/main/examples/data/toy_chat_fine_tuning.jsonl"
        
    }
    

    My header -

    apim-request-id: **
    content-type: application/json; charset=utf-8
    location: https://yutongai.openai.azure.com/openai/files/file-*****?api-version=2024-06-01
    
    
    

    You can use the try it button to check on your input very quick - https://video2.skills-academy.com/en-us/rest/api/azureopenai/files/import?view=rest-azureopenai-2024-06-01&tabs=HTTP

    User's image

    Please have a try and let us know how it works.

    Then, the role is only working for fine-tune and fine-tune-result as below -

    User's image

    I hope this helps!

    Regards,

    Yutong

    -Please kindly accept the answer if you feel helpful to support the community, thanks a lot.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. LeelaRajeshSayana-MSFT 14,831 Reputation points Microsoft Employee
    2024-09-04T14:13:46.1633333+00:00

    Hi @Muso, Marin Greetings! Apologies for the delayed response on this, I have tested the end point with a sample request and can confirm that it is working.

    I noticed from your posting that you are passing the parameter Ocp-Apim-Subscription-Key as a header. Referring to the API document on Azure Open AI Files import, the end point expects the api-key parameter in the header which is the Cognitive Services Azure OpenAI account key.

    I also notice that you have set the Content-Type to application/url in the above request. I have set it to default application/json. Please refer the below images of the API call for your reference.

    User's image

    Here is the request body

    User's image

    Response from the API
    User's image

    Hope this helps! Please let us know if you have any additional questions or need further assistance on this.


    If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.