nat.plugins.profiler.runtime_evaluator.atif_evaluate#
ATIF-native runtime evaluators for the profiler package.
Classes#
ATIF-native mean latency between LLM start and end for agent steps with metrics. |
|
ATIF-native workflow runtime per item: max(step.timestamp) - min(step.timestamp) across all steps. |
|
ATIF-native count of LLM calls per item: agent steps with metrics. |
|
ATIF-native average total tokens per LLM call: (prompt_tokens + completion_tokens) from step.metrics. |
Functions#
|
Convert ISO 8601 timestamp to epoch seconds, or None if invalid. |
|
Return the LLM start-to-end latency (seconds) for one ATIF agent step. |
Module Contents#
- _iso_to_epoch(ts: str | None) float | None#
Convert ISO 8601 timestamp to epoch seconds, or None if invalid.
- _step_llm_latency(step: nat.atif.Step) float | None#
Return the LLM start-to-end latency (seconds) for one ATIF agent step.
Prefers the converter-written
step.extra["invocation"]timing (start_timestamp/end_timestampin epoch seconds), which is what the ATOF-to-ATIF converter actually emits. Falls back to the legacystep.extra["span_event_timestamp"](ISO start) paired withstep.timestamp(ISO end) for producers that emit that shape instead.Returns
Nonewhen neither timing source is present, or when the invocation timestamps are not finite, so the caller can skip the step rather than record a spurious zero.
- class AverageLLMLatencyAtifEvaluator(max_concurrency: int = 8)#
Bases:
nat.plugins.eval.evaluator.atif_base_evaluator.AtifBaseEvaluatorATIF-native mean latency between LLM start and end for agent steps with metrics.
Per step, prefers the
step.extra["invocation"]start/end timestamps written by the ATOF-to-ATIF converter, and falls back tostep.extra["span_event_timestamp"](start) paired withstep.timestamp(end). A step is skipped only when neither timing source is available (see NEP-008 for ATIF profiling metadata).- async evaluate_atif_item( ) nat.plugins.eval.data_models.evaluator_io.EvalOutputItem#
Evaluate one ATIF sample and return a single output item.
- class AverageWorkflowRuntimeAtifEvaluator(max_concurrency: int = 8)#
Bases:
nat.plugins.eval.evaluator.atif_base_evaluator.AtifBaseEvaluatorATIF-native workflow runtime per item: max(step.timestamp) - min(step.timestamp) across all steps.
- async evaluate_atif_item( ) nat.plugins.eval.data_models.evaluator_io.EvalOutputItem#
Evaluate one ATIF sample and return a single output item.
- class AverageNumberOfLLMCallsAtifEvaluator(max_concurrency: int = 8)#
Bases:
nat.plugins.eval.evaluator.atif_base_evaluator.AtifBaseEvaluatorATIF-native count of LLM calls per item: agent steps with metrics.
- async evaluate_atif_item( ) nat.plugins.eval.data_models.evaluator_io.EvalOutputItem#
Evaluate one ATIF sample and return a single output item.
- class AverageTokensPerLLMEndAtifEvaluator(max_concurrency: int = 8)#
Bases:
nat.plugins.eval.evaluator.atif_base_evaluator.AtifBaseEvaluatorATIF-native average total tokens per LLM call: (prompt_tokens + completion_tokens) from step.metrics.
- async evaluate_atif_item( ) nat.plugins.eval.data_models.evaluator_io.EvalOutputItem#
Evaluate one ATIF sample and return a single output item.