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

Provide type hints for internal event emits #415

Open
ajbozarth opened this issue Feb 26, 2025 · 5 comments · May be fixed by #432
Open

Provide type hints for internal event emits #415

ajbozarth opened this issue Feb 26, 2025 · 5 comments · May be fixed by #432
Assignees
Labels
enhancement New feature or request python Python related functionality

Comments

@ajbozarth
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently the Emitter emits data as an Any object, in our internal emits that object is a dict. In TS that object is dynamically typed, something that's impossible in python. As I detailed in #378 (comment) there are many ways around this issue.

Describe the solution you'd like
To partially mirror the TS implementation I plan to create a dictionary of Types for each internal emit object that a user can then use to set their expected type for a given emit output.

Describe alternatives you've considered
I am yet unsure how I will code the above and am open to ideas. There a few alternative ideas that can work instead or in parallel to the above: enforcing a dict type or BaseModel type on the emit data instead of Any, create a similar typing object to TS and find a way to leverage it without knowing getting the key fro the same def line.

Additional context
This was originally part of the emitter followup work but was never split out into it's own subtask

@ajbozarth ajbozarth self-assigned this Feb 26, 2025
@ajbozarth ajbozarth added enhancement New feature or request python Python related functionality labels Feb 26, 2025
@ajbozarth
Copy link
Member Author

This is absolutely not a priority for the upcoming release. I opened it so I don't forget to come back to it later.

@ajbozarth
Copy link
Member Author

So I decided to take a stab at this and went down a hole for a while trying to type the emitter event data and ended up with main...ajbozarth:beeai-framework:event_type which is currently broken.
@Tomas2D if you want to take a quick look at that diff and see if that kind of an implementation is something we want to pursue, depending on interest I can work on it further.

After coming up short on that I wrote up a doc on our API as it is now (including some currently missing emits in runner) and with the new emits that will be added in #416
@jenna-winkler you can find that doc here on one of my branches, I can open a PR with it depending on how you'd like to integrate that content.

@jenna-winkler
Copy link
Contributor

@ajbozarth nice! 🙌 Please open a PR draft and I can add to it

@ajbozarth
Copy link
Member Author

Summary of todays discussion:

@ajbozarth
Copy link
Member Author

I've updated #432 with the latest status, we'll be pushing forward with #431 for this release but leave #432 open to come back to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request python Python related functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants