Skip to content

Commit ac6ef35

Browse files
committed
Add RunContext to doc and improve protocol description
1 parent bb8fe0a commit ac6ef35

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

docs/source/types.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,16 @@ EventCallbackProtocol
177177

178178
.. autoclass:: neo4j_graphrag.experimental.pipeline.notification.EventCallbackProtocol
179179
:members: __call__
180+
181+
182+
TaskProgressCallbackProtocol
183+
============================
184+
185+
.. autoclass:: neo4j_graphrag.experimental.pipeline.types.context.TaskProgressCallbackProtocol
186+
:members: __call__
187+
188+
189+
RunContext
190+
==========
191+
192+
.. autoclass:: neo4j_graphrag.experimental.pipeline.types.context.RunContext

src/neo4j_graphrag/experimental/pipeline/notification.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ class TaskEvent(Event):
6868

6969

7070
class EventCallbackProtocol(Protocol):
71+
"""This protocol is used to send events about pipeline progress
72+
from the pipeline itself. It will receive either PipelineEvent or
73+
TaskEvent depending on the event type.
74+
"""
7175
def __call__(self, event: Event) -> Awaitable[None]: ...
7276

7377

src/neo4j_graphrag/experimental/pipeline/types/context.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020

2121
@runtime_checkable
2222
class TaskProgressCallbackProtocol(Protocol):
23+
"""This protocol is used to send events from within the component.
24+
The final event will be of type TaskEvent, but event type and task name
25+
are predefined and can not be changed by the user calling this protocol.
26+
"""
2327
def __call__(self, message: str, data: dict[str, Any]) -> Awaitable[None]: ...
2428

2529

0 commit comments

Comments
 (0)