How to make audio file input with gpt-4o

Vitalii Rentiuk 20 Reputation points
2024-12-04T15:36:08.7533333+00:00

Hi! I was trying to use Azure AI Studio gpt4-o model with audio input. It looks like this:

messages = [{"role": "user",

                 "content": [{"type": "input_audio", "input_audio": {

                        "data": encoded_string,

                        "format": "wav"}}]

                }]
This code was taken from OpenAI documentation https://platform.openai.com/docs/guides/audio . Although in AI studio it says that audio channel is available, I get the following response: "Error Error code: 400 - {'error': {'message': "Invalid value: 'input_audio'. Supported values are: 'text', 'image_url', 'audio_url', and 'refusal'.", 'type': 'invalid_request_error', 'param': 'messages[1].content[0].type', 'code': 'invalid_value'}}". I'm using "2024-10-01-preview" api version.

Is usage of audio files, not urls not available for now and will it be available in future?

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
4,080 questions
{count} votes

Accepted answer
  1. VasaviLankipalle-MSFT 18,676 Reputation points Moderator
    2024-12-04T19:34:35.9833333+00:00

    Hello @Vitalii Rentiuk , Thanks for using Microsoft Q&A Platform.

    If you are working with SDK then the supported audio formats are listed in the sample GitHub repository. Here are the supported formats with python SDK:

    User's image To learn more about how to use the Audio file as input here is the reference sample code: https://github.com/azure-samples/aoai-realtime-audio-sdk

    Is this something you are looking for?

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.