Skip to main content

GalileoBaseHandler

Callback handler for logging traces to the Galileo platform. Arguments
  • _galileo_logger (GalileoLogger): The Galileo logger instance.
  • _nodes (dict[UUID, Node]): A dictionary of nodes, where the key is the run_id and the value is the node.
  • _start_new_trace (bool): Whether to start a new trace when a chain starts. Set this to False to continue using the current trace.
  • _flush_on_chain_end (bool): Whether to flush the trace when a chain ends.
  • _root_node (Optional[Node]): The root node of the trace, if any.
  • _nodes (dict[str, Node]): A dictionary of nodes, where the key is the run_id as a string and the value is the Node object.
  • _integration (INTEGRATION): The integration type, e.g., “langchain”. This is used to identify the source of the trace.

commit

Commit the nodes to the trace using the Galileo Logger. Optionally flush the trace.

end_node

End a node in the chain. Commit the nodes to a trace if the run_id matches the root node. Arguments
  • run_id (UUID): The run ID.
  • **kwargs (Any): Additional parameters to update the span with.

get_node

Get a node by its run ID. Arguments
  • run_id (UUID): The run ID of the node to retrieve.
Returns
  • Optional[Node]: The node if found, otherwise None.

get_nodes

Get all nodes. Returns
  • dict[str, Node]: A dictionary of all nodes.

log_node_tree

Log a node and its children recursively. Arguments
  • node (Node): The node to log.

start_node

Start a new node in the chain. Arguments
  • node_type (NODE_TYPE): The type of node.
  • parent_run_id (Optional[UUID]): The parent run ID.
  • run_id (UUID): The run ID.
  • **kwargs (Any): Additional parameters for the span.
Returns
  • Node: The created node.