Skip to content

Commit

Permalink
Fix example for inspecting payloads (#1249)
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter authored Oct 10, 2024
1 parent 2151f42 commit 3ac87d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/griptape-framework/misc/src/events_6.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from griptape.events import BaseEvent, EventBus, EventListener, StartPromptEvent
from griptape.structures import Agent

EventBus.add_event_listeners([EventListener(handler=lambda e: print(e), event_types=[StartPromptEvent])])


def handler(event: BaseEvent) -> None:
if isinstance(event, StartPromptEvent):
print("Prompt Stack Messages:")
for message in event.prompt_stack.messages:
print(f"{message.role}: {message.content}")
print(f"{message.role}: {message.to_text()}")


EventBus.add_event_listeners([EventListener(handler=handler, event_types=[StartPromptEvent])])

agent = Agent()

Expand Down

0 comments on commit 3ac87d2

Please sign in to comment.