Team Ai
Apppublic

Underground-Digital/Workflow-Engine

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
node_entities.py45 linesDownload Raw Back to entities
1from collections.abc import Mapping2from enum import Enum3from typing import Any, Optional4 5from pydantic import BaseModel6 7from core.model_runtime.entities.llm_entities import LLMUsage8from models.workflow import WorkflowNodeExecutionStatus9 10 11class NodeRunMetadataKey(str, Enum):12    """13    Node Run Metadata Key.14    """15 16    TOTAL_TOKENS = "total_tokens"17    TOTAL_PRICE = "total_price"18    CURRENCY = "currency"19    TOOL_INFO = "tool_info"20    ITERATION_ID = "iteration_id"21    ITERATION_INDEX = "iteration_index"22    PARALLEL_ID = "parallel_id"23    PARALLEL_START_NODE_ID = "parallel_start_node_id"24    PARENT_PARALLEL_ID = "parent_parallel_id"25    PARENT_PARALLEL_START_NODE_ID = "parent_parallel_start_node_id"26    PARALLEL_MODE_RUN_ID = "parallel_mode_run_id"27 28 29class NodeRunResult(BaseModel):30    """31    Node Run Result.32    """33 34    status: WorkflowNodeExecutionStatus = WorkflowNodeExecutionStatus.RUNNING35 36    inputs: Optional[Mapping[str, Any]] = None  # node inputs37    process_data: Optional[dict[str, Any]] = None  # process data38    outputs: Optional[dict[str, Any]] = None  # node outputs39    metadata: Optional[dict[NodeRunMetadataKey, Any]] = None  # node metadata40    llm_usage: Optional[LLMUsage] = None  # llm usage41 42    edge_source_handle: Optional[str] = None  # source handle id of node with multiple branches43 44    error: Optional[str] = None  # error message if status is failed45