Skip to content

Commit

Permalink
docs(readme): update examples (#893)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Nov 28, 2023
1 parent 11fcb2a commit 124da87
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ stream = client.chat.completions.create(
messages=[{"role": "user", "content": "Say this is a test"}],
stream=True,
)
for chunk in stream:
for part in stream:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
print(part.choices[0].delta.content)
```

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

## Module-level client
Expand Down

0 comments on commit 124da87

Please sign in to comment.