Skip to content

Commit fbe8fce

Browse files
committed
docs: update streaming section to show replicate.use() with streaming=True
Update migration guide to reflect that replicate.use() with streaming=True is the preferred approach for streaming in v2. Mention that replicate.stream() still works but is deprecated, without showing a code example.
1 parent f1dc6b0 commit fbe8fce

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

UPGRADING.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ The `api_token` parameter is still accepted for backward compatibility, but `bea
7777

7878
## Streaming output
7979

80-
Streaming works similarly, but prediction objects no longer have a `stream()` method.
80+
Streaming works differently in v2. Prediction objects no longer have a `stream()` method. Use `replicate.use()` with `streaming=True` for streaming output.
8181

8282
### Before (v1)
8383

@@ -98,20 +98,17 @@ for event in prediction.stream():
9898
### After (v2)
9999

100100
```python
101-
# Top-level streaming (same)
102-
for event in replicate.stream(
103-
"meta/meta-llama-3-70b-instruct",
104-
input={"prompt": "Write a haiku"}
105-
):
101+
# Use replicate.use() with streaming=True
102+
model = replicate.use("meta/meta-llama-3-70b-instruct", streaming=True)
103+
for event in model(prompt="Write a haiku"):
106104
print(str(event), end="")
107105

108-
# Streaming from prediction requires using stream() function
106+
# Streaming from prediction object is not available
109107
prediction = replicate.predictions.create(...)
110108
# prediction.stream() is not available in v2
111-
# Use replicate.stream() instead
112109
```
113110

114-
To stream a specific prediction in v2, use the top-level `stream()` function.
111+
Note: `replicate.stream()` still works in v2 but is deprecated and will be removed in a future version.
115112

116113
## Predictions
117114

0 commit comments

Comments
 (0)