Azure OpenAI resource not found

Leabriah Spencer 45 Reputation points
2023-10-24T14:56:29.9466667+00:00

Hello,

I am trying to follow along the microsoft learn tutorial for "Integrating Azure OpenAI into your app" (https://microsoftlearning.github.io/mslearn-openai/Instructions/Labs/02-natural-language-azure-openai.html) but I cant get the intended result.

When I use an endpoint in the bash terminal (following the tutorial), I get a syntactical error with an arrow under the colon in any given endpoint address i use:

aoai error

Out of curiosity, I copied and pasted my endpoint in the address bar of my browser and it returned a 404 not found message. I tried the same after creating a completely new resource and got the same error message:resource error message

What could I be doing wrong? What can be done about an azure openai endpoint that appears to be expired(?) or in a different file directory(?).

Thank you.

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,644 questions
0 comments No comments
{count} votes

Accepted answer
  1. Saurabh Sharma 23,791 Reputation points Microsoft Employee
    2023-10-24T17:15:54.9366667+00:00

    Hi @Leabriah Spencer

    Welcome to Microsoft Q&A! Thanks for posting the question.

    If you are using function os.getenv() then you need to pass the environment variables which you have configured in your machine. For example, If have setup environment variables as

    • AZURE_OAI_ENDPOINT with value https://testopenai.openai.azure.com/,
    • AZURE_OAI_KEY with xxxxxxxxxxxxxx and
    • AZURE_OAI_MODEL with value gpt35turbo

    then you need to use the function os.getenv() like below -

    azure_oai_endpoint = os.getenv("AZURE_OAI_ENDPOINT")
    azure_oai_key = os.getenv("AZURE_OAI_KEY")
    azure_oai_model = os.getenv("AZURE_OAI_MODEL")
    

    Please refer to this document to setup the environment variables.

    Also, if you want to hardcode these values then you need to use assign the values like below -

    azure_oai_endpoint = "https://testopenai.openai.azure.com/"
    azure_oai_key = "xxxxxxxxxxxxxxxx"
    azure_oai_model = "gpt35turbo"
    

    Please let me know if you have any other questions.
    Thanks,

    Saurabh


    Please 'Accept as answer' and Upvote if it helped so that it can help others in the community looking for help on similar topics.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Dillon Silzer 56,681 Reputation points
    2023-10-24T16:21:48.3766667+00:00

    Hi Leabriah,

    For your azure_oai_endpoint and azure_oai_key try putting them in single quotes (') or double quotes ("). The invalid syntax at the beginning of the string indicates where the error is coming from.


    If this is helpful please accept answer.

    1 person found this answer helpful.
    0 comments No comments