Skip to content

Commit

Permalink
Update README.md (#892)
Browse files Browse the repository at this point in the history
  • Loading branch information
logankilpatrick authored Nov 28, 2023
1 parent 9f828cb commit af67cfa
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ stream = client.chat.completions.create(
messages=[{"role": "user", "content": "Say this is a test"}],
stream=True,
)
for part in stream:
print(part.choices[0].delta.content or "")
for chunk in stream:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
```

The async client uses the exact same interface.
Expand All @@ -110,8 +111,9 @@ stream = await client.chat.completions.create(
messages=[{"role": "user", "content": "Say this is a test"}],
stream=True,
)
async for part in stream:
print(part.choices[0].delta.content or "")
async for chunk in stream:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
```

## Module-level client
Expand Down

0 comments on commit af67cfa

Please sign in to comment.