Hello, I’m having the problem of “peer closed connection without sending complete message body (incomplete chunked read)” intermittently. I haven’t been able to identify the cause, but the application is already using the streaming method recommended by the OpenAI documentation (https://platform.openai.com/docs/guides/streaming-responses).
Example code:
<>
stream = self.client.responses.create(
model="gpt-4o",
instructions=prompt,
input=[
{
"role": "user",
"content": [
{"type": "input_text", "text": ocr_text},
{
"type": "input_image",
"image_url": f"data:image/png;base64,{base64_image}",
},
],
},
],
stream=True,
temperature=0,
)
result = ""
usage = None
for event in stream:
# Text streaming chunks
if event.type == "response.output_text.delta":
result += event.delta
# Final event with usage
elif event.type == "response.completed":
usage = event.response.usage
raw_output = rsult
</>
SDK version: 2.7.1
I’ve checked several forums here and it always comes back to this forum, so the problem is still unresolved?