From d24dfaffbfd7e82c20c7d846eeddd2af1404e26b Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 16 Aug 2023 18:50:56 +0100 Subject: [PATCH] docs(readme): make print statements in streaming examples flush (#123) --- README.md | 4 ++-- examples/streaming.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 385c7e56..d6a62cef 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 diff --git a/examples/streaming.py b/examples/streaming.py index 33d1aff9..2e6d85dd 100644 --- a/examples/streaming.py +++ b/examples/streaming.py @@ -21,7 +21,7 @@ def sync_stream() -> None: ) for completion in stream: - print(completion.completion, end="") + print(completion.completion, end="", flush=True) print() @@ -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()