fix: SmartTurnMetricsData was reporting 0 for inference and processing time
This commit is contained in:
@@ -5,6 +5,13 @@ All notable changes to **Pipecat** will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed an issue where the `SmartTurnMetricsData` was reporting 0ms for
|
||||||
|
inference and processing time when using the `FalSmartTurnAnalyzer`.
|
||||||
|
|
||||||
## [0.0.65] - 2025-04-23 "Sant Jordi's release"
|
## [0.0.65] - 2025-04-23 "Sant Jordi's release"
|
||||||
|
|
||||||
https://en.wikipedia.org/wiki/Saint_George%27s_Day_in_Catalonia
|
https://en.wikipedia.org/wiki/Saint_George%27s_Day_in_Catalonia
|
||||||
|
|||||||
@@ -149,13 +149,18 @@ class BaseSmartTurn(BaseTurnAnalyzer):
|
|||||||
# Calculate processing time
|
# Calculate processing time
|
||||||
e2e_processing_time_ms = (end_time - start_time) * 1000
|
e2e_processing_time_ms = (end_time - start_time) * 1000
|
||||||
|
|
||||||
|
# Extract metrics from the nested structure
|
||||||
|
metrics = result.get("metrics", {})
|
||||||
|
inference_time = metrics.get("inference_time", 0)
|
||||||
|
total_time = metrics.get("total_time", 0)
|
||||||
|
|
||||||
# Prepare the result data
|
# Prepare the result data
|
||||||
result_data = SmartTurnMetricsData(
|
result_data = SmartTurnMetricsData(
|
||||||
processor="BaseSmartTurn",
|
processor="BaseSmartTurn",
|
||||||
is_complete=result["prediction"] == 1,
|
is_complete=result["prediction"] == 1,
|
||||||
probability=result["probability"],
|
probability=result["probability"],
|
||||||
inference_time_ms=result.get("inference_time", 0) * 1000,
|
inference_time_ms=inference_time * 1000,
|
||||||
server_total_time_ms=result.get("total_time", 0) * 1000,
|
server_total_time_ms=total_time * 1000,
|
||||||
e2e_processing_time_ms=e2e_processing_time_ms,
|
e2e_processing_time_ms=e2e_processing_time_ms,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user