promptflow.tracing.contracts.trace module#

class promptflow.tracing.contracts.trace.Trace(name: str, type: TraceType, inputs: Dict[str, Any], output: Optional[Any] = None, start_time: Optional[float] = None, end_time: Optional[float] = None, error: Optional[str] = None, children: Optional[List[Trace]] = None, node_name: Optional[str] = None, parent_id: str = '', id: str = '', function: str = '')#

Bases: object

A dataclass that represents a trace of a program execution.

Parameters:
  • name (str) – The name of the trace.

  • type (TraceType) – The type of the trace.

  • inputs (Dict[str, Any]) – The inputs of the trace.

  • output (Optional[Any]) – The output of the trace, or None if not available.

  • start_time (Optional[float]) – The timestamp of the start time, or None if not available.

  • end_time (Optional[float]) – The timestamp of the end time, or None if not available.

  • error (Optional[str]) – The error message of the trace, or None if no error occurred.

  • children (Optional[List[Trace]]) – The list of child traces, or None if no children.

  • node_name (Optional[str]) – The node name of the trace, used for flow level trace, or None if not applicable.

children: Optional[List[Trace]] = None#
end_time: Optional[float] = None#
error: Optional[str] = None#
function: str = ''#
id: str = ''#
inputs: Dict[str, Any]#
name: str#
node_name: Optional[str] = None#
output: Optional[Any] = None#
parent_id: str = ''#
start_time: Optional[float] = None#
type: TraceType#
class promptflow.tracing.contracts.trace.TraceType(value)#

Bases: str, Enum

An enumeration class to represent different types of traces.

EMBEDDING = 'Embedding'#
FLOW = 'Flow'#
FUNCTION = 'Function'#
LANGCHAIN = 'LangChain'#
LLM = 'LLM'#
RETRIEVAL = 'Retrieval'#