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

Batched EventListenerDrivers not getting flushed if not listening on FinishStructureRunEvent #1244

Open
1 task done
vachillo opened this issue Oct 9, 2024 · 0 comments · May be fixed by #1246
Open
1 task done
Labels
bug Something isn't working

Comments

@vachillo
Copy link
Member

vachillo commented Oct 9, 2024

Describe the bug
When using a batched EventListenerDriver, the last batch does not get flushed if it does not hit the max batch size. When a FinishStructureRunEvent is emitted, it uses flush=True, but if the listener is not listening on this event, it does not get flushed

To Reproduce

driver = GriptapeCloudEventListenerDriver(batched=True, batch_size=100)  # or any other driver

def stream_handler(event: CompletionChunkEvent) -> dict:
    return {
        "text": event.token,
    }

listener =  EventListener(
    stream_handler,
    event_types=[CompletionChunkEvent],
    driver=driver,
)

EventBus.add_event_listener(listener)

agent = Agent(stream=True).run("hello")

Expected behavior
There should be a signal to flush all EventListeners, regardless of the events they are listening on.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 0.5.1]

Additional context
Add any other context about the problem here.

@vachillo vachillo added the bug Something isn't working label Oct 9, 2024
@collindutter collindutter linked a pull request Oct 9, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant