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()