feat: add workflow action outcomes and tracing
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
from uuid import uuid4
|
||||
|
||||
from pipecat.frames.frames import OutputTransportMessageUrgentFrame, TTSSpeakFrame
|
||||
from pipecat.utils.time import time_now_iso8601
|
||||
@@ -67,6 +68,29 @@ class WorkflowOutput:
|
||||
if node_id:
|
||||
await self.emit({"type": "node-active", "nodeId": node_id})
|
||||
|
||||
async def emit_trace(
|
||||
self,
|
||||
event: str,
|
||||
*,
|
||||
revision: str,
|
||||
transition_id: int,
|
||||
**details: Any,
|
||||
) -> None:
|
||||
"""Publish one ordered, machine-readable Workflow runtime event."""
|
||||
|
||||
await self.emit(
|
||||
{
|
||||
"type": "workflow-event",
|
||||
"eventId": f"wfe_{uuid4().hex[:20]}",
|
||||
"event": event,
|
||||
"timestamp": time_now_iso8601(),
|
||||
"sessionId": self._runtime.session_id,
|
||||
"workflowRevision": revision,
|
||||
"transitionId": transition_id,
|
||||
**details,
|
||||
}
|
||||
)
|
||||
|
||||
async def emit_variables(
|
||||
self,
|
||||
*,
|
||||
|
||||
Reference in New Issue
Block a user