Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
vachillo committed Oct 21, 2024
1 parent 1bb05ae commit 43d70ad
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions docs/griptape-framework/misc/src/events_chunk_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,14 @@
from griptape.tasks import ToolkitTask
from griptape.tools import PromptSummaryTool, WebScraperTool


def action_chunk_listener(event: ActionChunkEvent) -> None:
if event.tag is not None and event.name is not None and event.path is not None:
print(f"{event.name}.{event.tag} ({event.path}) ", end="", flush=True)
if event.partial_input is not None:
print(event.partial_input, end="", flush=True)


EventBus.add_event_listeners(
[
EventListener(
lambda e: print(e.token, end="", flush=True),
lambda e: print(str(e), end="", flush=True),
event_types=[TextChunkEvent],
),
EventListener(
action_chunk_listener,
lambda e: print(str(e), end="", flush=True),
event_types=[ActionChunkEvent],
),
]
Expand Down

0 comments on commit 43d70ad

Please sign in to comment.