1313from ldai import log
1414
1515if TYPE_CHECKING :
16- from ldai .providers .types import GraphMetrics , GraphMetricSummary , LDAIMetrics
16+ from ldai .providers .types import AIGraphMetrics , AIGraphMetricSummary , LDAIMetrics
1717
1818
1919class FeedbackKind (Enum ):
@@ -615,7 +615,7 @@ class AIGraphTracker:
615615 """
616616 Tracks graph-level metrics for AI agent graph operations.
617617
618- Maintains an internal :class:`~ldai.providers.types.GraphMetricSummary `
618+ Maintains an internal :class:`~ldai.providers.types.AIGraphMetricSummary `
619619 that is updated as tracking methods are called. Retrieve it via
620620 :meth:`get_summary`.
621621 """
@@ -643,15 +643,15 @@ def __init__(
643643 self ._version = version
644644 self ._context = context
645645
646- from ldai .providers .types import GraphMetricSummary
647- self ._summary = GraphMetricSummary ()
646+ from ldai .providers .types import AIGraphMetricSummary
647+ self ._summary = AIGraphMetricSummary ()
648648
649649 @property
650650 def graph_key (self ) -> str :
651651 """Graph configuration key used in tracking payloads."""
652652 return self ._graph_key
653653
654- def get_summary (self ) -> GraphMetricSummary :
654+ def get_summary (self ) -> AIGraphMetricSummary :
655655 """
656656 Get the current summary of graph-level metrics.
657657
@@ -820,10 +820,10 @@ def track_handoff_failure(self, source_key: str, target_key: str) -> None:
820820 def _track_from_graph_metrics (
821821 self ,
822822 result : Any ,
823- metrics_extractor : Callable [[Any ], Optional [GraphMetrics ]],
823+ metrics_extractor : Callable [[Any ], Optional [AIGraphMetrics ]],
824824 elapsed_ms : int ,
825825 ) -> None :
826- metrics : Optional [GraphMetrics ] = None
826+ metrics : Optional [AIGraphMetrics ] = None
827827 try :
828828 metrics = metrics_extractor (result )
829829 except Exception as exc :
@@ -845,24 +845,24 @@ def _track_from_graph_metrics(
845845
846846 def track_graph_metrics_of (
847847 self ,
848- metrics_extractor : Callable [[Any ], Optional [GraphMetrics ]],
848+ metrics_extractor : Callable [[Any ], Optional [AIGraphMetrics ]],
849849 func : Callable [[], Any ],
850850 ) -> Any :
851851 """
852852 Track graph-level metrics for a synchronous graph operation.
853853
854- Times the operation, extracts :class:`~ldai.providers.types.GraphMetrics `
854+ Times the operation, extracts :class:`~ldai.providers.types.AIGraphMetrics `
855855 via the provided extractor, and fires graph-level tracking events
856856 (path, duration, success/failure, total tokens).
857857
858- If the extracted ``GraphMetrics `` has a non-``None`` ``duration_ms``,
858+ If the extracted ``AIGraphMetrics `` has a non-``None`` ``duration_ms``,
859859 that value is used instead of the wall-clock elapsed time.
860860
861861 Node-level metrics are not tracked by this method.
862862
863863 For async operations, use :meth:`track_graph_metrics_of_async`.
864864
865- :param metrics_extractor: Function that extracts GraphMetrics from the result
865+ :param metrics_extractor: Function that extracts AIGraphMetrics from the result
866866 :param func: Synchronous callable that runs the graph operation
867867 :return: The result of the operation
868868 """
@@ -881,15 +881,15 @@ def track_graph_metrics_of(
881881
882882 async def track_graph_metrics_of_async (
883883 self ,
884- metrics_extractor : Callable [[Any ], Optional [GraphMetrics ]],
884+ metrics_extractor : Callable [[Any ], Optional [AIGraphMetrics ]],
885885 func : Callable [[], Any ],
886886 ) -> Any :
887887 """
888888 Track graph-level metrics for an async graph operation (``func`` is awaited).
889889
890890 Same event semantics as :meth:`track_graph_metrics_of`.
891891
892- :param metrics_extractor: Function that extracts GraphMetrics from the result
892+ :param metrics_extractor: Function that extracts AIGraphMetrics from the result
893893 :param func: Async callable that runs the graph operation
894894 :return: The result of the operation
895895 """
0 commit comments