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

WIP: fix: AzureOpenAI authentication to support API Key auth #583

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

younes-io
Copy link
Contributor

@younes-io younes-io commented Jan 11, 2024

Based on the notebook and the AzureOpenAI class code, authentication with API Key authentication is not supported.

The azure_deployment field is required to differentiate between the model and its Azure deployment, which is crucial when multiple deployments of the same model exist, or when the deployment is not named after the model..

from guidance import models, gen
import tiktoken

azureai_model = models.AzureOpenAI(
    model='gpt-3.5-turbo',
    azure_endpoint=azure_endpoint,
    azure_deployment='my_crazy_deployment_name',
    api_key=api_key,
)

@younes-io younes-io changed the title fix: AzureOpenAI authentication to support API Key auth WIP: fix: AzureOpenAI authentication to support API Key auth Jan 11, 2024
@younes-io
Copy link
Contributor Author

Required: to test using token_ad_provider (not yet)

@slundberg
Copy link
Contributor

Thanks @younes-io ! This looks good to me, @riedgar-ms or @Harsha-Nori any feedback?

@riedgar-ms
Copy link
Collaborator

riedgar-ms commented Jan 11, 2024

Isn't the deployment contained within the endpoint URI? I have always used URIs of the form:

https://< < Resource Name > >.openai.azure.com/openai/deployments/< < AOAI Deployment > >/chat/completions?api-version=2023-07-01-preview

Although I wouldn't be surprised if the information can be given in other ways.

@younes-io
Copy link
Contributor Author

@riedgar-ms : what you share is the full URL, which is constructed by the underlying library (langchain, etc).
This https://< < Resource Name > >.openai.azure.com is the base_url or (in the latest version) the azure_endpoint

@riedgar-ms
Copy link
Collaborator

I wouldn't object to passing through all the arguments (I assume that the AzureOpenAI object can sort everything out itself), although providing the 'full URL' as the endpoint does seem to work.

@younes-io
Copy link
Contributor Author

@riedgar-ms never tried that xD but that's a good thing :D

@slundberg
Copy link
Contributor

Sounds like this is a nice to have add-on, so I will merge :) Thanks @younes-io !

@slundberg slundberg merged commit d36601b into guidance-ai:main Jan 16, 2024
4 checks passed
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.

None yet

3 participants