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

Feature/better events #768

Merged
merged 17 commits into from
May 3, 2024
Merged

Feature/better events #768

merged 17 commits into from
May 3, 2024

Conversation

collindutter
Copy link
Member

@collindutter collindutter commented May 1, 2024

  • Revert breaking change of removing EventListener.handler
  • The return value of EventListener.handler will be passed to the EventListenerDriver.try_publish_event_payload's' event_payload parameter.
  • Removed LocalEventListenerDriver

https://griptape--768.org.readthedocs.build/768/

@collindutter collindutter force-pushed the feature/better-events branch 2 times, most recently from 9a76b01 to 6d148ee Compare May 2, 2024 00:05
Copy link
Member

@SavagePencil SavagePencil left a comment

Choose a reason for hiding this comment

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

Open questions.

CHANGELOG.md Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
- **BREAKING** Bumped `pinecone` from `^2` to `^3`.
- **BREAKING**: Removed `workdir`, `loaders`, `default_loader`, and `save_file_encoding` fields from `FileManager` and added `file_manager_driver`.
- **BREADKING**: Removed `mime_type` field from `ImageArtifact`. `mime_type` is now a property constructed using the Artifact type and `format` field.
- Improved RAG performance in `VectorQueryEngine`.
- Moved [Griptape Docs](https://github.com/griptape-ai/griptape-docs) to this repository.
- The return value of `EventListener.handler` will be passed to the `EventListenerDriver.try_publish_event_payload`'s' `event_payload` parameter.

### Fixed
- Type hint for parameter `azure_ad_token_provider` on Azure OpenAI drivers to `Optional[Callable[[], str]]`.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe "CHANGED" type hint? Can we clarify what this fixed?
Ditto for line 45 below. Did we SUPPLY the missing params?

Copy link
Member Author

Choose a reason for hiding this comment

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

This didn't fix anything, it updated the behavior of the handler function to use the user's return value in the Driver. Previously this return value was thrown away.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ditto for line 45 below.

Assuming you're talking about Missing parameters azure_ad_token and azure_ad_token_provider, this was a fix because the type hints were incorrect.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it's the missing parameters here, I was advocating for including a verb in the sentence, or at least clarifying what was wrong and what was done to fix it.

@@ -9,12 +9,17 @@

@define
class EventListener:
handler: Callable[[BaseEvent], Optional[dict]] = field(default=Factory(lambda: lambda event: event.to_dict()))
Copy link
Member

Choose a reason for hiding this comment

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

no action, but good god this is brutal to parse

griptape/events/start_structure_run_event.py Show resolved Hide resolved
@collindutter collindutter marked this pull request as ready for review May 2, 2024 17:46
@collindutter collindutter requested review from a team, dylanholmes and SavagePencil May 2, 2024 17:46
Copy link
Member

@SavagePencil SavagePencil left a comment

Choose a reason for hiding this comment

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

One comment

- **BREAKING** Bumped `pinecone` from `^2` to `^3`.
- **BREAKING**: Removed `workdir`, `loaders`, `default_loader`, and `save_file_encoding` fields from `FileManager` and added `file_manager_driver`.
- **BREADKING**: Removed `mime_type` field from `ImageArtifact`. `mime_type` is now a property constructed using the Artifact type and `format` field.
- Improved RAG performance in `VectorQueryEngine`.
- Moved [Griptape Docs](https://github.com/griptape-ai/griptape-docs) to this repository.
- The return value of `EventListener.handler` will be passed to the `EventListenerDriver.try_publish_event_payload`'s' `event_payload` parameter.

### Fixed
- Type hint for parameter `azure_ad_token_provider` on Azure OpenAI drivers to `Optional[Callable[[], str]]`.
Copy link
Member

Choose a reason for hiding this comment

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

Yes, it's the missing parameters here, I was advocating for including a verb in the sentence, or at least clarifying what was wrong and what was done to fix it.

@@ -1,6 +1,7 @@
## Overview

You can use [EventListener](../../reference/griptape/events/event_listener.md)s to listen for events during a Structure's execution.
See [Event Listener Drivers](../drivers/event-listener-drivers.md) for forwarding events to external services.
Copy link
Member

Choose a reason for hiding this comment

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

for examples of? guidance on?

Copy link
Contributor

@dylanholmes dylanholmes left a comment

Choose a reason for hiding this comment

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

Nice work!

Overall, I really like the decision to add back EventListener.handler. It avoids a breaking change, keeps the local usage simple, and at the same time enables clients to customize events sent to the drivers. So cool.

Requesting changes for minor typos; everything else is optional and I'll leave to your discretion.

CHANGELOG.md Outdated Show resolved Hide resolved
docs/griptape-framework/drivers/event-listener-drivers.md Outdated Show resolved Hide resolved
docs/griptape-framework/drivers/event-listener-drivers.md Outdated Show resolved Hide resolved
griptape/events/finish_structure_run_event.py Show resolved Hide resolved
griptape/structures/structure.py Show resolved Hide resolved
dylanholmes
dylanholmes previously approved these changes May 3, 2024
dylanholmes
dylanholmes previously approved these changes May 3, 2024
vachillo
vachillo previously approved these changes May 3, 2024
@collindutter collindutter dismissed stale reviews from vachillo and dylanholmes via 15a3180 May 3, 2024 20:08
@collindutter collindutter merged commit 333b4d5 into dev May 3, 2024
8 checks passed
@collindutter collindutter deleted the feature/better-events branch May 3, 2024 20:41
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.

None yet

4 participants