diff --git a/src/promptflow-tracing/promptflow/tracing/_openai_utils.py b/src/promptflow-tracing/promptflow/tracing/_openai_utils.py index 3ef876faf17..e4defb44293 100644 --- a/src/promptflow-tracing/promptflow/tracing/_openai_utils.py +++ b/src/promptflow-tracing/promptflow/tracing/_openai_utils.py @@ -197,7 +197,8 @@ def _get_completion_tokens_for_completion_api(self, output, enc): def merge_metrics_dict(self, metrics: dict, metrics_to_merge: dict): for k, v in metrics_to_merge.items(): - metrics[k] = metrics.get(k, 0) + v + if isinstance(v, int): + metrics[k] = metrics.get(k, 0) + v def _log_warning(self, msg): if self._logger: