Share via

After deplying Azure services successfully for chatbot , failing with deployment error when prompt request is made

Gagan Sharma 40 Reputation points
2025-03-31T13:06:07.2766667+00:00

openai.NotFoundError: Error code: 404 - {'error': {'code': 'DeploymentNotFound', 'message': 'The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.'}}

[2025-03-31 12:16:48 +0000] [17332] [INFO] 127.0.0.1:38752 POST /chat/stream 1.1 200 - 4850690

ERROR:root:Exception while generating response stream: Error code: 404 - {'error': {'code': 'DeploymentNotFound', 'message': 'The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.'}}

Traceback (most recent call last):

       ^^^^^^^^^^^^^^^^^

File "/workspaces/azure-search-openai-demo/.venv/lib/python3.11/site-packages/openai/_base_client.py", line 1856, in post

return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/workspaces/azure-search-openai-demo/.venv/lib/python3.11/site-packages/openai/_base_client.py", line 1550, in request

return await self._request(

       ^^^^^^^^^^^^^^^^^^^^

File "/workspaces/azure-search-openai-demo/.venv/lib/python3.11/site-packages/openai/_base_client.py", line 1651, in _request

raise self._make_status_error_from_response(err.response) from None
Azure OpenAI in Foundry Models

Answer accepted by question author

JAYA SHANKAR G S 4,195 Reputation points Microsoft External Staff Moderator
2025-04-04T16:17:32.0966667+00:00

Hello @Gagan Sharma ,

As discussed, please find below the summary of the issue and the fix.

The chatbot was not functioning correctly due to missing environment variables leading to issues with deployment process.

In order to resolve this blocker, upon troubleshooting it was identified that the AZURE_OPENAI_EMB_DEPLOYMENT environment variable was not set correctly, which was causing the issue.

To fix this, first authenticate using azd auth login command and create a new environment using the azd env new .

Finally, execute azd up command to deploy the resources and create the necessary environment variables.

Ensure that you delete old resource groups and creating new ones to avoid any conflicts.

As you can see in the below screenshot the embeddings were created correctly and the chatbot was able to respond as expected both on local and on the container app.

Output:

Local - enter image description here

Containerized environment (container apps)

enter image description here

Hope this was helpful, it would be great if you accept the answer for betterment of community.

Thank you

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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