My Teams bot cannot access the OpenAI API, Error 401/404 - I tried several alternatives without success

Rian 5 Reputation points
2024-10-04T01:19:51.73+00:00

Basically I deployed a ChatGPT 3.5 Turbo as well as created an index for my data, all using AI Studio. I downloaded the code that is generated for Teams and followed the README steps in the documentation using the Teams Toolkit in VS Code.

The only modification I needed to make to the code was to change the embedding_dependency authentication method, as the original couldnt run locally. After carrying out the provisioning and deploying steps, bot was deployed in Azure along with its related resources. As instructed in the README, I changed the Managed Identity permission linked to the chatbot webapp by assigning the Cognitive Service OpenAI User. After all the steps followed, it is not possible to contact the bot via the webapp, in Test in Webchat, or in Teams.

In the Log Stream, when trying to contact the bot through Teams, the message returned is the following:

SCM_LOGSTREAM_TIMEOUT (in seconds).CHAT PROMPT:[{"role": "system","content": "# Note\n// To update the model instructions directing how your custom copilot should behave when generating a response, \n// please update the role_information parameter located in the src\\prompts\\chat\\config.json file.\n// The skprompt.txt file is not used by Azure OpenAI On Your Data.\n"},{"role": "user","content": "hi"}]Request failed with status code 400

In the logs from App Insight it's possible to see that the webapp is getting Error 404 by calling GET to the API

User's image

The dependencies shows the following error
User's image

This error is presented under several hypotheses that I have already tested, between em: changing the search service authentication method to APIKey in the prompt\config and not Managed identity; assign permission for Cognitive OpenAI Service Contributor to Managed Identity; they all return the same error. I hope I can find an alternative so I can make this work.

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,286 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,330 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.