Skip to content

Commit 124da87

Browse files
docs(readme): update examples (#893)
1 parent 11fcb2a commit 124da87

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ stream = client.chat.completions.create(
9494
messages=[{"role": "user", "content": "Say this is a test"}],
9595
stream=True,
9696
)
97-
for chunk in stream:
97+
for part in stream:
9898
if chunk.choices[0].delta.content is not None:
99-
print(chunk.choices[0].delta.content, end="")
99+
print(part.choices[0].delta.content)
100100
```
101101

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

119119
## Module-level client

0 commit comments

Comments
 (0)