Skip to content

Commit

Permalink
docs(readme): make print statements in streaming examples flush (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored and rattrayalex committed Aug 26, 2023
1 parent c8a587c commit d24dfaf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ stream = anthropic.completions.create(
stream=True,
)
for completion in stream:
print(completion.completion)
print(completion.completion, end="", flush=True)
```

The async client uses the exact same interface.
Expand All @@ -161,7 +161,7 @@ stream = await anthropic.completions.create(
stream=True,
)
async for completion in stream:
print(completion.completion)
print(completion.completion, end="", flush=True)
```

## Using Types
Expand Down
4 changes: 2 additions & 2 deletions examples/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def sync_stream() -> None:
)

for completion in stream:
print(completion.completion, end="")
print(completion.completion, end="", flush=True)

print()

Expand All @@ -35,7 +35,7 @@ async def async_stream() -> None:
)

async for completion in stream:
print(completion.completion, end="")
print(completion.completion, end="", flush=True)

print()

Expand Down

0 comments on commit d24dfaf

Please sign in to comment.