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

using aoai model with azure Ad auth #820

Closed
MichaelBetser opened this issue Nov 30, 2023 · 11 comments
Closed

using aoai model with azure Ad auth #820

MichaelBetser opened this issue Nov 30, 2023 · 11 comments
Assignees
Labels
0.2 Issues which were filed before re-arch to 0.4

Comments

@MichaelBetser
Copy link

My gpt model instance is using an azure ad auth scheme.
The api is slightly different for azure ad and the autogen doc does not say if it supports it and how to do it.
is this supported?

Thanks.

@julianakiseleva
Copy link
Contributor

@MichaelBetser can you please give us more details?

@MichaelBetser
Copy link
Author

MichaelBetser commented Dec 2, 2023

using azure ad auth with python openai is described here: https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/migration?tabs=python%2Cdalle-fix#authentication
however if I try to use autogen with this config:
token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://my-resource.openai.azure.com/.default")
config_list = [
{
"model": "gpt-4-32k",
"azure_ad_token_provider": token_provider,
"azure_endpoint": "https://my-resource.openai.azure.com",
"api_type": "azure",
"api_version": "2023-07-01-preview",
}]
it does not work. I also tried variation on this, replacing 'azure_endpoint' with 'base_url', replacing 'azure_ad_token_provider' with 'api_key' and feeding the azure ad token (which is not an api_key)
so my question is: do you support azure ad auth and if yes how to do it?

@sonichi
Copy link
Contributor

sonichi commented Dec 3, 2023

I just found that there is an AzureOpenAI client in openai: https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/chatgpt?tabs=python-new&pivots=programming-language-chat-completions
This client must be added recently. We can switch to using this client instead of processing azure endpoints inside the OpenAIWrapper of autogen. @olgavrou for awareness.
For your use case though, does it work if you set "api_type" to be "azure_ad"? And use "api_key" and "base_url". I remember seeing someone else using "azure_ad" and it worked.

@MichaelBetser
Copy link
Author

Hi sonichi,
I have tried the suggested combination, and I get an error: 'model no found' even though the model exists and I am able to query using the openai azure api directly.

@sonichi
Copy link
Contributor

sonichi commented Dec 4, 2023

Not sure if @kevin666aa or others is making a PR to use AzureOpenAI. If not, my suggestion is to make sure the "model" value matches the deployment name in your endpoint.

@yiranwu0
Copy link
Collaborator

yiranwu0 commented Dec 4, 2023

I just made a draft PR to use AzureOpenAI in #868. @MichaelBetser Can you checkout out the branch to see if it works?

whiskyboy pushed a commit to whiskyboy/autogen that referenced this issue Apr 17, 2024
…cement. (microsoft#820)

* AAAI

* KDD

* Update README.md

Co-authored-by: Kevin Chen <74878789+int-chaos@users.noreply.github.com>

* Update README.md

Co-authored-by: Kevin Chen <74878789+int-chaos@users.noreply.github.com>

* revise

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Exchange_order

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
Co-authored-by: Kevin Chen <74878789+int-chaos@users.noreply.github.com>
@thegovind
Copy link

Could this be bumped? This still doesn't support token-based authentication. We want to avoid API keys as much as possible. Here's an example from oai client that could be used in #868. @yiranwu0, could you update your PR to factor this in?

@edmald
Copy link

edmald commented May 28, 2024

Hi everyone,

Is there a way to use Azure OpenAI and Autogen without having the API key? In my company, we only receive information for access via the token. Here are the details we have:

API_VERSION: '....'
AZURE_OPENAI_ENDPOINT: '....'
MODEL_NAME: '....'
URL_TOKEN: '....'
Any guidance on how to proceed with this setup would be greatly appreciated.

Thanks!

@cesarofuchi
Copy link

Could this be bumped? This still doesn't support token-based authentication. We want to avoid API keys as much as possible. Here's an example from oai client that could be used in #868. @yiranwu0, could you update your PR to factor this in?

It is still not working, right? @yiranwu0 is there someone working on this issue, or at least a roadmap for that?

@yiranwu0
Copy link
Collaborator

yiranwu0 commented Jun 7, 2024

Hello @cesarofuchi, can you take a look at this PR: #2879
Does it solve the problem?

@yiranwu0 yiranwu0 self-assigned this Jun 7, 2024
@rysweet rysweet added 0.2 Issues which were filed before re-arch to 0.4 needs-triage labels Oct 2, 2024
@rysweet
Copy link
Collaborator

rysweet commented Oct 18, 2024

resolved in #2879

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.2 Issues which were filed before re-arch to 0.4
Projects
None yet
Development

No branches or pull requests

8 participants