Skip to content
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

Support keyless auth for Azure OpenAI (token provider) #127

Open
pamelafox opened this issue Dec 2, 2024 · 2 comments
Open

Support keyless auth for Azure OpenAI (token provider) #127

pamelafox opened this issue Dec 2, 2024 · 2 comments

Comments

@pamelafox
Copy link

Many of our Azure developers do not use API keys, they use "keyless auth" which passes in a short-lived OAuth token, which can then be refreshed. The OpenAI package already supports that keyless auth, by accepting a token_provider callback, calling that at the appropriate times, and passing in a Bearer header with the resulting token. Would you consider adding bearer token auth for this wrapper? Or is this wrapper meant for hobbyist scenarios only?

@pamelafox
Copy link
Author

Here's an example of how I would use keyless auth with Azure with the openai package, by the way:
https://github.com/pamelafox/python-openai-demos/blob/c7de0ec332cab9340ff1bf327efceebdec2f6364/chat.py#L16

client = openai.AzureOpenAI(
    api_version=os.getenv("AZURE_OPENAI_VERSION"),
    azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"),
    azure_ad_token_provider=token_provider,
)

@ksolo
Copy link
Collaborator

ksolo commented Dec 3, 2024

@pamelafox This is super helpful thank you. We will try to get this added in an upcoming release.

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

No branches or pull requests

2 participants