Skip to content

Commit 5e6be60

Browse files
committed
docs: clarify that stream() yields strings, not SSE events
The API uses Server-Sent Events internally, but the Python client yields plain string chunks to the user, not SSE event objects.
1 parent ce20b68 commit 5e6be60

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ for event in replicate.stream(
128128
print(str(event), end="")
129129
```
130130

131-
The `stream()` method creates a prediction and returns an iterator that yields output chunks as they become available via Server-Sent Events (SSE). This is useful for language models where you want to display output as it's generated rather than waiting for the entire response.
131+
The `stream()` method creates a prediction and returns an iterator that yields output chunks as strings. This is useful for language models where you want to display output as it's generated rather than waiting for the entire response.
132132

133133
## Async usage
134134

src/replicate/_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def stream(
331331
Stream output from a model prediction.
332332
333333
This creates a prediction and returns an iterator that yields output chunks
334-
as they become available via Server-Sent Events (SSE).
334+
as strings as they become available from the streaming API.
335335
336336
Args:
337337
ref: Reference to the model or version to run. Can be:
@@ -754,7 +754,7 @@ async def stream(
754754
Stream output from a model prediction asynchronously.
755755
756756
This creates a prediction and returns an async iterator that yields output chunks
757-
as they become available via Server-Sent Events (SSE).
757+
as strings as they become available from the streaming API.
758758
759759
Args:
760760
ref: Reference to the model or version to run. Can be:

src/replicate/lib/_predictions_stream.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def stream(
2525
Stream output from a model prediction.
2626
2727
This creates a prediction and returns an iterator that yields output chunks
28-
as they become available via Server-Sent Events (SSE).
28+
as strings as they become available from the streaming API.
2929
3030
Args:
3131
client: The Replicate client instance
@@ -113,7 +113,7 @@ async def async_stream(
113113
Async stream output from a model prediction.
114114
115115
This creates a prediction and returns an async iterator that yields output chunks
116-
as they become available via Server-Sent Events (SSE).
116+
as strings as they become available from the streaming API.
117117
118118
Args:
119119
client: The AsyncReplicate client instance

0 commit comments

Comments
 (0)