Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md to use right variable name and skip "None" at end of stream #892

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

logankilpatrick
Copy link
Contributor

No description provided.

@logankilpatrick logankilpatrick requested a review from a team as a code owner November 28, 2023 21:25
@athyuttamre athyuttamre merged commit af67cfa into main Nov 28, 2023
1 check passed
@athyuttamre athyuttamre deleted the logankilpatrick-patch-2 branch November 28, 2023 21:44
Comment on lines +97 to +99
for chunk in stream:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on this instead @logankilpatrick @athyuttamre @RobertCraigie ? (just a question of cleaner python, and I'm not a pythonista)

Suggested change
for chunk in stream:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(either way, thanks for catching/fixing logan!)

megamanics pushed a commit to devops-testbed/openai-python that referenced this pull request Aug 14, 2024
cgayapr pushed a commit to cgayapr/openai-python that referenced this pull request Dec 14, 2024
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.

3 participants