Skip to content

enable azure for audio/whisper #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

enable azure for audio/whisper #3

wants to merge 6 commits into from

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