Stream options are not available for Azure openAI #6201

Closed
opened 2026-02-21 18:14:31 -05:00 by yindo · 2 comments
Owner

Originally created by @dale22 on GitHub (Oct 21, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.9.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Azure openAI not support stream options

2024-10-21 08:05:21,141.141 ERROR [Thread-141 (_generate_worker)] [logging_callback.py:169] - Error code: 403 - {'message': 'Streaming requests are not yet allowed.'}
Traceback (most recent call last):
File "/app/api/core/model_runtime/model_providers/__base/large_language_model.py", line 110, in invoke
result = self._invoke(model, credentials, prompt_messages, model_parameters, tools, stop, stream, user)
File "/app/api/core/model_runtime/model_providers/azure_openai/llm/llm.py", line 55, in _invoke
return self._chat_generate(
File "/app/api/core/model_runtime/model_providers/azure_openai/llm/llm.py", line 331, in _chat_generate
response = client.chat.completions.create(
File "/app/api/.venv/lib/python3.10/site-packages/openai/_utils/_utils.py", line 277, in wrapper
return func(*args, **kwargs)
File "/app/api/.venv/lib/python3.10/site-packages/openai/resources/chat/completions.py", line 590, in create
return self._post(
File "/app/api/.venv/lib/python3.10/site-packages/openai/_base_client.py", line 1240, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
File "/app/api/.venv/lib/python3.10/site-packages/openai/_base_client.py", line 921, in request
return self._request(
File "/app/api/.venv/lib/python3.10/site-packages/openai/_base_client.py", line 1020, in _request
raise self._make_status_error_from_response(err.response) from None
openai.PermissionDeniedError: Error code: 403 - {'message': 'Streaming requests are not yet allowed.'}

image

✔️ Expected Behavior

return result

Actual Behavior

return 403

Originally created by @dale22 on GitHub (Oct 21, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.9.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Azure openAI not support stream options 2024-10-21 08:05:21,141.141 ERROR [Thread-141 (_generate_worker)] [logging_callback.py:169] - Error code: 403 - {'message': 'Streaming requests are not yet allowed.'} Traceback (most recent call last): File "/app/api/core/model_runtime/model_providers/__base/large_language_model.py", line 110, in invoke result = self._invoke(model, credentials, prompt_messages, model_parameters, tools, stop, stream, user) File "/app/api/core/model_runtime/model_providers/azure_openai/llm/llm.py", line 55, in _invoke return self._chat_generate( File "/app/api/core/model_runtime/model_providers/azure_openai/llm/llm.py", line 331, in _chat_generate response = client.chat.completions.create( File "/app/api/.venv/lib/python3.10/site-packages/openai/_utils/_utils.py", line 277, in wrapper return func(*args, **kwargs) File "/app/api/.venv/lib/python3.10/site-packages/openai/resources/chat/completions.py", line 590, in create return self._post( File "/app/api/.venv/lib/python3.10/site-packages/openai/_base_client.py", line 1240, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) File "/app/api/.venv/lib/python3.10/site-packages/openai/_base_client.py", line 921, in request return self._request( File "/app/api/.venv/lib/python3.10/site-packages/openai/_base_client.py", line 1020, in _request raise self._make_status_error_from_response(err.response) from None openai.PermissionDeniedError: Error code: 403 - {'message': 'Streaming requests are not yet allowed.'} ![image](https://github.com/user-attachments/assets/a2a5498b-4f16-4d12-a9a2-4fa9ffe24615) ### ✔️ Expected Behavior return result ### ❌ Actual Behavior return 403
yindo added the 🐞 bug label 2026-02-21 18:14:31 -05:00
yindo closed this issue 2026-02-21 18:14:31 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 21, 2024):

The 403 error with the message 'Streaming requests are not yet allowed' occurs because the stream option is set to True in the _invoke method of the AzureOpenAILargeLanguageModel class. Azure OpenAI currently does not support streaming requests, which is why the request is being denied. To resolve this issue, you should set the stream parameter to False when invoking the model. This will allow the method to execute without attempting to stream, thus avoiding the 403 error [1].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 21, 2024): <!-- Answer --> The 403 error with the message 'Streaming requests are not yet allowed' occurs because the `stream` option is set to `True` in the `_invoke` method of the `AzureOpenAILargeLanguageModel` class. Azure OpenAI currently does not support streaming requests, which is why the request is being denied. To resolve this issue, you should set the `stream` parameter to `False` when invoking the model. This will allow the method to execute without attempting to stream, thus avoiding the 403 error <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/azure_ai_studio/llm/llm.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Oct 21, 2024):

We have removed this options in latest version, please upgrade to v0.10.0

@crazywoola commented on GitHub (Oct 21, 2024): We have removed this options in latest version, please upgrade to v0.10.0
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6201