-
Notifications
You must be signed in to change notification settings - Fork 321
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
feat: Azure OpenAI Token Authentication #329
base: main
Are you sure you want to change the base?
Conversation
Add authentication via token for Azure OpenAI.
Thanks for the PR, most of the team is traveling but we'll get this reviewed as soon as we are back! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly some ergonomic suggesitions
/// * `api_version` - API version to use (e.g., "2024-10-21" for GA, "2024-10-01-preview" for preview) | ||
/// * `azure_endpoint` - Azure OpenAI endpoint URL, for example: https://{your-resource-name}.openai.azure.com | ||
pub fn new(api_key: &str, api_version: &str, azure_endpoint: &str) -> Self { | ||
pub fn new(auth: AzureOpenAIAuth, api_version: &str, azure_endpoint: &str) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's two forms of auth, I think there should be 2 additional methods that take in either api_key: &str
or token: &str
.
new
would be the same, taking in auth
(could also consider changing into impl Into<AzureOpenAIAuth>
choosing a reasonable default for strings too for backwards compat).
Then from_api_key
and from_token
would define specific versions of the enum directly which is self-documenting and also user-friendly (no need to deal with the enum directly).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All docs with Client::new
should either be reverted if impl Into<...>
is added OR using one of the new constructors being added.
Overview
This pull requests extends the Azure OpenAI Client to provide authentication via token.
References:
https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#authentication