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

handle_events must return the sub-handler results #91

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ricardofunke
Copy link

Issue #, if available:
When implementing handle_transcript_event() method, one might need to return values from there, but the upper class method handle_events() doesn't return anything, which leads to the lost of the returned value in the implemented method. Thus any calls to handle_events() returns None.
Description of changes:
Added the return clause to the handle_transcript_event() call inside handle_events()

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ricardofunke
Copy link
Author

ricardofunke commented May 2, 2023

Sorry, I didn't test this suggestion and I just realized I put a return clause inside a for loop. My goal is to have some sort of way to return the value from this method and the called method.

Maybe something like this, I don't know:

return [await self.handle_transcript_event(event) async for event in self._transcript_result_stream if isinstance(event, TranscriptEvent)]

This worked for me

@david-oliveira-br
Copy link

@ricardofunke Maybe you should treat as a generator and use yield instead of return

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.

2 participants