openai-python
openai-python copied to clipboard
[Fix] Fix audio api methods arguments not being considered
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")