Skip to content

trace

CompletionRequestEvent

Bases: TraceEventBase

A class representing a completion request event.

metadata class-attribute instance-attribute

metadata: Optional[Dict] = None

The meta data of the event.

name instance-attribute

name: str

The name of the event.

parent_func class-attribute instance-attribute

parent_func: Optional[str] = None

The name of the parent function.

time_stamp class-attribute instance-attribute

time_stamp: float = None

The time stamp of the event.

CompletionResponseEvent

Bases: TraceEventBase

A class representing a completion response event.

args instance-attribute

args: Dict

The arguments of the completion call.

cost instance-attribute

cost: Optional[float]

The api cost of the completion call.

metadata class-attribute instance-attribute

metadata: Optional[Dict] = None

The meta data of the event.

name instance-attribute

name: str

The name of the event.

ret instance-attribute

ret: Any

The return value of the completion call.

time_stamp class-attribute instance-attribute

time_stamp: float = None

The time stamp of the event.

FunctionCallEvent

Bases: TraceEventBase

A class representing a function call event.

args instance-attribute

args: Dict

The arguments of the function call.

metadata class-attribute instance-attribute

metadata: Optional[Dict] = None

The meta data of the event.

name instance-attribute

name: str

The name of the event.

parent_func class-attribute instance-attribute

parent_func: Optional[str] = None

The name of the parent function.

time_stamp class-attribute instance-attribute

time_stamp: float = None

The time stamp of the event.

FunctionReturnEvent

Bases: TraceEventBase

A class representing a function return event.

metadata class-attribute instance-attribute

metadata: Optional[Dict] = None

The meta data of the event.

name instance-attribute

name: str

The name of the event.

ret class-attribute instance-attribute

ret: Any = None

The return value of the function.

time_stamp class-attribute instance-attribute

time_stamp: float = None

The time stamp of the event.

GenerationInitEvent

Bases: TraceEventBase

A class representing a generation init event.

metadata class-attribute instance-attribute

metadata: Optional[Dict] = None

The meta data of the event.

name instance-attribute

name: str

The name of the event.

parent_func class-attribute instance-attribute

parent_func: Optional[str] = None

The name of the parent function.

time_stamp class-attribute instance-attribute

time_stamp: float = None

The time stamp of the event.

GenerationResponseEvent

Bases: TraceEventBase

A class representing a generation response event.

args instance-attribute

args: Dict

The arguments of the generation call.

metadata class-attribute instance-attribute

metadata: Optional[Dict] = None

The meta data of the event.

name instance-attribute

name: str

The name of the event.

ret instance-attribute

ret: Any

The return value of the generation call.

time_stamp class-attribute instance-attribute

time_stamp: float = None

The time stamp of the event.

TraceEngineBase

Bases: ABC

A base class for trace engines.

events abstractmethod property

The list of events in the trace.

min_timestamp cached property

min_timestamp: float

The minimum time stamp of the events in the trace.

trace_nodes abstractmethod property

trace_nodes: Dict[str, TraceNode]

The dictionary of trace nodes in the trace.

append abstractmethod

append(event: TraceEventBase) -> None

Append an event to the trace.

Source code in src/appl/core/types/trace.py
@abstractmethod
def append(self, event: TraceEventBase) -> None:
    """Append an event to the trace."""
    raise NotImplementedError

find_cache abstractmethod

find_cache(name: str, args: Dict[str, Any]) -> Any

Find a completion result in the cache.

Parameters:

  • name (str) –

    The name of the completion.

  • args (Dict[str, Any]) –

    The arguments of the completion.

Returns:

  • Any

    The completion result if found, otherwise None.

Source code in src/appl/core/types/trace.py
@abstractmethod
def find_cache(self, name: str, args: Dict[str, Any]) -> Any:
    """Find a completion result in the cache.

    Args:
        name: The name of the completion.
        args: The arguments of the completion.

    Returns:
        The completion result if found, otherwise None.
    """
    raise NotImplementedError

TraceEventBase

Bases: BaseModel

A base class for trace events.

metadata class-attribute instance-attribute

metadata: Optional[Dict] = None

The meta data of the event.

name instance-attribute

name: str

The name of the event.

time_stamp class-attribute instance-attribute

time_stamp: float = None

The time stamp of the event.

TraceNode

Bases: BaseModel

The node of a trace tree containing information about trace events.

args class-attribute instance-attribute

args: Optional[Dict] = None

The arguments of the trace node.

children class-attribute instance-attribute

children: List[TraceNode] = []

The children of the trace node.

end_time class-attribute instance-attribute

end_time: float = 0.0

The end time of the trace node.

info class-attribute instance-attribute

info: Dict = {}

The extra information of the trace node.

metadata class-attribute instance-attribute

metadata: Optional[Dict] = None

The meta data of the trace node.

name instance-attribute

name: str

The name of the trace node.

parent class-attribute instance-attribute

parent: Optional[TraceNode] = None

The parent of the trace node.

ret class-attribute instance-attribute

ret: Any = None

The return value of the trace node.

runtime property

runtime: float

The runtime of the trace node.

start_time class-attribute instance-attribute

start_time: float = 0.0

The start time of the trace node.

type instance-attribute

type: str

The type of the trace node.

TracePrinterBase

Bases: ABC

A base class for trace printers.

print abstractmethod

print(
    trace: TraceEngineBase,
    trace_metadata: Optional[Dict[str, Any]] = None,
) -> Any

Print the trace.

Source code in src/appl/core/types/trace.py
@abstractmethod
def print(
    self, trace: TraceEngineBase, trace_metadata: Optional[Dict[str, Any]] = None
) -> Any:
    """Print the trace."""
    raise NotImplementedError