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

First code example does not work with Azure OpenAI #223

Closed
johnbatty opened this issue Dec 1, 2023 · 5 comments
Closed

First code example does not work with Azure OpenAI #223

johnbatty opened this issue Dec 1, 2023 · 5 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@johnbatty
Copy link

johnbatty commented Dec 1, 2023

Describe the bug

The introduction states that the code examples will use Azure OpenAI.

However the very first code example Exercise 2: OpenAI API Key Setup uses the (non-Azure) OpenAI API directly, which doesn't work for an Azure OpenAI deployment.

To Reproduce

Run Exercise 2: OpenAI API Key Setup using an Azure OpenAI endpoint URL/key - it fails with an exception.

Expected behavior

The example to work with Azure OpenAI.

I expect that this needs:

Copy link

github-actions bot commented Dec 1, 2023

👋 Thanks for contributing @johnbatty! We will review the issue and get back to you soon.

@johnbatty
Copy link
Author

Fyi, I did get the given code to work in the end by defining the following environment variables:

OPENAI_API_TYPE=azure
OPENAI_API_VERSION="2023-07-01-preview"
OPENAI_API_KEY=<my-azure-openai-api-key>
AZURE_OPENAI_API_KEY=<my-azure-openai-api-key>
AZURE_OPENAI_ENDPOINT="https://<my-azure-openai-base-url>/openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-07-01-preview"

This took quite a bit of trial and error. I'm also dubious that the AZURE_OPENAI_ENDPOINT value should be this entire URL - but this is the only value that I could get to work with the unmodified code.

I also tried modifying the code to use the Azure OpenAI variation, but have failed to get that to work (so far...).

@koreyspace
Copy link
Collaborator

I believe this is by design but @nitya please review to see if we can clear this up or also add Azure Open AI support for this lesson to avoid confusion

@koreyspace koreyspace added documentation Improvements or additions to documentation and removed needs-review labels Dec 5, 2023
@webr5214
Copy link

Related, the first lesson instructs the user to save their API key as a codespaces secret, but this lesson doesn't tell how to retrieve the secret in the .env file. Would have saved some time to know it's: OPENAI_API_KEY=${SECRET_NAME}

@johnbatty
Copy link
Author

It looks like this has been resolved via another PR: #188
I'll close my PR.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants