Skip to content

Commit

Permalink
Update streaming-tasks.mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
jlowin committed Nov 14, 2024
1 parent feadc6c commit 7806321
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/patterns/streaming-tasks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ for event, snapshot, delta in cf.run(
You can focus on specific events using the `Stream` enum. Here, we return only content updates:

```python
from controlflow import Stream
import controlflow as cf

# Only stream content updates
for event, snapshot, delta in cf.run(
"Write a poem",
stream=Stream.CONTENT
stream=cf.Stream.CONTENT
):
print(delta if delta else snapshot)
```
Expand Down Expand Up @@ -119,11 +119,10 @@ Here's a complete example showing both approaches to display content in real-tim
<CodeGroup>
```python Streaming
import controlflow as cf
from controlflow import Stream

for event, snapshot, delta in cf.run(
"Write a story about time travel",
stream=Stream.CONTENT
stream=cf.Stream.CONTENT
):
# Print character by character
if delta:
Expand Down

0 comments on commit 7806321

Please sign in to comment.