mirror of
https://github.com/NCBM/plyngent.git
synced 2026-07-23 05:55:16 +08:00
core/agent: add ErrorEvent and CancelledEvent
This commit is contained in:
@@ -2,6 +2,8 @@ from .chat import ChatAgent as ChatAgent
|
||||
from .client import ChatClient as ChatClient
|
||||
from .events import AgentEvent as AgentEvent
|
||||
from .events import AssistantMessageEvent as AssistantMessageEvent
|
||||
from .events import CancelledEvent as CancelledEvent
|
||||
from .events import ErrorEvent as ErrorEvent
|
||||
from .events import MaxRoundsEvent as MaxRoundsEvent
|
||||
from .events import TextDeltaEvent as TextDeltaEvent
|
||||
from .events import ToolCallEvent as ToolCallEvent
|
||||
|
||||
@@ -28,4 +28,20 @@ class MaxRoundsEvent(Struct, tag_field="type", tag="max_rounds"):
|
||||
continued: bool = False
|
||||
|
||||
|
||||
type AgentEvent = TextDeltaEvent | AssistantMessageEvent | ToolCallEvent | ToolResultEvent | MaxRoundsEvent
|
||||
class ErrorEvent(Struct, tag_field="type", tag="error"):
|
||||
message: str
|
||||
|
||||
|
||||
class CancelledEvent(Struct, tag_field="type", tag="cancelled"):
|
||||
pass
|
||||
|
||||
|
||||
type AgentEvent = (
|
||||
TextDeltaEvent
|
||||
| AssistantMessageEvent
|
||||
| ToolCallEvent
|
||||
| ToolResultEvent
|
||||
| MaxRoundsEvent
|
||||
| ErrorEvent
|
||||
| CancelledEvent
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user