Azure-Samples/contoso-chat

`aoai-connection` works in Codespace notebook but not when deployed to Azure AI Studio

Closed this issue · 4 comments

I got 401 errors when running the flow in Azure AI Studio, triggered in question_embedding and I think in llm_response. I had to change their connection values to Default_AzureOpenAI to get them to work.

But in my Codespace, the aoai-connection worked.

OpenAI connection selection

@nickcoast - if you look at the Azure AI Resource you are using (Azure AI Studio > Manage > Select your resource) and then click on the Connections in the sidebar:

What connections do you see listed there of type "Azure OpenAI"? The manual should have had a step that helped you set up the same named connections in both VS Code and Azure Open AI ahead of time so just checking if the latter was completed.

Hi @nitya thanks for taking the time. I have two connections of type "Azure OpenAI", the "Default" one shared to all projects, and the "aaoi_connection". Both have the same "Target" URI.

image

This is how I had set it up.
Following the instructions from the "AI Tour" event:

  1. I created the connections (including aoai-connection) in AI Studio and ML Studio
  2. I copied the keys and endpoints into .env in the Codespace
  3. I ran connections/create-connections.ipynb to set up local connections
  4. I ran /contoso-chat/flow.dag.yaml and it works, no connection errors.

@nickcoast that is strange. Yes the steps seem right and I can see you had both connections setup correctly. The only thing I can think of is that the Cloud connection (made via the Azure AI Studio UI) had the API Key wrong for some reason.

401 indicates it was an authorization issue.

Can you check the key in the AOAI Connection and verify it is the same as local? (BTW the cloud entry should NOT have " " enclosing the key value - I had that issue when I copied the stringified version directly from .env)

@nitya Quotes weren't the issue. But when I copy-pasted I somehow clipped 1 character from the beginning of the key. So that explains why the Flow worked in the Codespace but not on ai.azure.com.

After fixing that, this step works. But now the next one, the deploy step, fails with Environment '{}' is not registered.

I'll start a new issue for that. Thank you for looking into this!