Skip to content

[Fix] Fix audio api methods arguments not being considered#340

Closed
bnznamco wants to merge 1 commit intoopenai:mainfrom
bnznamco:main
Closed

[Fix] Fix audio api methods arguments not being considered#340
bnznamco wants to merge 1 commit intoopenai:mainfrom
bnznamco:main

Conversation

@bnznamco
Copy link
Copy Markdown

Methods of Audio package are not passing arguments to cls.__prepare_request.

This prevents to override the configuration of the client from the method.

Before:

@classmethod
def transcribe(
    cls,
    model,
    file,
    api_key=None,
    api_base=None,
    api_type=None,
    api_version=None,
    organization=None,
    **params,
):
    requestor, files, data = cls._prepare_request(file, file.name, model, **params)

After:

def translate(
    cls,
    model,
    file,
    api_key=None,
    api_base=None,
    api_type=None,
    api_version=None,
    organization=None,
    **params,
):
    requestor, files, data = cls._prepare_request(
        file,
        file.name,
        model,
        api_key,
        api_base,
        api_type,
        api_version,
        organization,
        **params,
    )

After this fix you will be able to override for example api_key directly calling the method.

openai.Audio.transcribe("whisper-1", file, api_key="my-api-key")

@hallacy hallacy requested a review from mpokrass March 30, 2023 04:42
@mpokrass mpokrass removed their request for review April 4, 2023 16:03
@hallacy
Copy link
Copy Markdown
Collaborator

hallacy commented Apr 8, 2023

Closing this because #369 fixed it

@hallacy hallacy closed this Apr 8, 2023
safa0 pushed a commit to safa0/openai-agents-python that referenced this pull request Apr 27, 2025
Previously the stream was closing as soon as all the audio was added but
didn't wait for it to be finished. Additionally the audio might seem
chopped off if there is no additional silence so this PR also adds one
second of silence before exiting the program.
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.

2 participants