Whisper azure error api with Python

Alberto Fernandez Martinez 20 Reputation points
2023-11-24T07:59:59.08+00:00

Hello,

I'm trying to make a conection between python an azure openai to an whisper resource. The Enpoint and the Key are okey, and the resource is created with the name "whisper-1".

My code is:

client = AzureOpenAI(
    api_key = OPENAI_API_KEY,  
    api_version = OPENAI_API_VERSION,
    azure_endpoint = AZURE_OPENAI_ENDPOINT
    )

client.audio.transcriptions.create(
	model = "whisper-1",
    file = audio_file,
	#response_format = "text" 
)

And the error is: openai.NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}

Thank you.

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. romungi-MSFT 48,906 Reputation points Microsoft Employee Moderator
    2023-11-24T15:02:09.67+00:00

    @Alberto Fernandez Martinez I think the error indicates one or all of your environment variables did not get correctly populated. Could you try to use them directly in your script for testing purpose? I have used the following script with my whisper model deployment and it seems to work as expected.

    Also, ensure you have deployed your whisper base model as a deployment through Azure OpenAI studio before using it in the client call to create transcription.

    import os 
    from openai import AzureOpenAI
    from pathlib import Path
    
    client = AzureOpenAI(api_key="your_key", api_version="2023-10-01-preview", azure_endpoint ="https://your_resource.openai.azure.com")
    client.audio.transcriptions.create(model = "your_whisper_deployment_name",  file = Path("path_to_file"), response_format = "text" )
    

    User's image

    1 person found this answer helpful.
    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.