Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add events util #1480

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add events util #1480

wants to merge 2 commits into from

Conversation

collindutter
Copy link
Member

@collindutter collindutter commented Dec 20, 2024

Describe your changes

Added

  • Structure.run_stream() for streaming Events from a Structure as an iterator.

Issue ticket number and link

Closes #1479

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@collindutter collindutter marked this pull request as ready for review December 20, 2024 23:43
Comment on lines +77 to +79
## Stream Iterator

You can use `Structure.run_stream()` for streaming Events from the `Structure` in the form of an iterator.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer a EventStream util like Stream that currently exists and punt more core API changes to the Structure api to a later time, but not going to block the PR based on that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The downside of this approach is that EventStream would need to support anything that might need this functionality (Structures, Tasks, Drivers, Tools, etc).

I'm just as nervous about modifying Structure's API, but this implementation does at least seem consistent with other similar frameworks.


!!! tip

Set `stream=True` on your [Prompt Driver](../drivers/prompt-drivers.md) in order to receive completion chunk events.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love to see this requirement be inferred based on Structure usage rather than needing it to be set in the constructor. Obviously out of scope, but writing it down until I have time to fill out an issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, we need a better way for framework components to broadcast that they publish stream-like events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Explore More Intuitive Event Mechanism
2 participants