Skip to content

Add missing stream=True to chat_history_stream.py - #16

Merged
Pamela Fox (pamelafox) merged 3 commits into
mainfrom
copilot/fix-streaming-example
Apr 2, 2026
Merged

Add missing stream=True to chat_history_stream.py#16
Pamela Fox (pamelafox) merged 3 commits into
mainfrom
copilot/fix-streaming-example

Conversation

Copilot AI commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

chat_history_stream.py iterates over the response as a stream (event.choices[0].delta.content) but never passes stream=True to client.chat.completions.create(), causing a runtime failure.

response = client.chat.completions.create(
    model=MODEL_NAME,
    messages=messages,
    temperature=0.7,
    stream=True,  # was missing
)

The Spanish translation (spanish/chat_history_stream.py) already had this parameter.

Copilot AI changed the title [WIP] Fix streaming example by adding stream=True parameter Add missing stream=True to chat_history_stream.py Apr 2, 2026
@madebygps
Gwyneth Peña-Siguenza (madebygps) marked this pull request as ready for review April 2, 2026 17:29
@pamelafox

Copy link
Copy Markdown
Contributor

Copilot fix the ruff issue

Copilot AI commented Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

Copilot fix the ruff issue

Fixed in 31e97f0. Changed class DayOfWeek(str, Enum) to class DayOfWeek(StrEnum) in both structured_outputs_enum.py and spanish/structured_outputs_enum.py to resolve the ruff UP042 errors.

@pamelafox
Pamela Fox (pamelafox) merged commit 76eebf9 into main Apr 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streaming example missing stream=True in chat.completions.create()

3 participants