Azure OpenAI stream get ChunkEncodingError
Cooltruster
0
Reputation points
Hi I have always been using OpenAI and recently switched to using Azure OpenAI.
In OpenAI I have always been able to stream responses but when I switched over to using Azure, I get ChunkEncodingError. For reference this is my code below.
import openai
openai.api_type = "azure"
openai.api_base = os.getenv("OPENAI_API_BASE")
openai.api_version = "2023-08-01-preview"
openai.api_key = os.getenv("AZURE_OPENAI_API_KEY")
response = openai.ChatCompletion.create(
engine="gpt-4",
temperature=0,
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hi there"}
],
stream=True,
)
for chunk in response:
print(chunk)
This is the error message that I get. Would be appreciative to anyone who can explain to be what I did wrong.
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,942 questions
Sign in to answer