Skip to content

Conversation

kristapratico
Copy link
Owner

@kristapratico kristapratico commented Aug 30, 2023

Description

The Audio/Whisper APIs in the openai library were implemented to work specifically with openai endpoints, e.g. taking a positional param for model. This PR shows how we might change the code so we can use deployment_id with Azure, but preserve the positional parameter behavior for model, file, filename, etc.

Usage

import openai

openai.api_base = "<endpoint>"
openai.api_key = "<api-key>"
openai.api_type = "azure"
openai.api_version = "2023-09-01-preview"

transcribed = openai.Audio.transcribe(
    deployment_id="whisper-1",
    file=open("recording.m4a", "rb")
)

translated = openai.Audio.translate(
    deployment_id="whisper-1",
    file=open("recording.m4a", "rb")
)

Intellisense:

Intellisense shows both options for calling the APIs.

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant