Skip to content

Commit

Permalink
only add when both of the side are int
Browse files Browse the repository at this point in the history
  • Loading branch information
zzn2 committed Sep 29, 2024
1 parent 14d8164 commit 6367e44
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/promptflow-tracing/promptflow/tracing/_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ def collect_openai_tokens_for_parent_span(self, span):
merged_tokens = {
key: self._span_id_to_tokens[parent_span_id].get(key, 0) + tokens.get(key, 0)
for key in set(self._span_id_to_tokens[parent_span_id]) | set(tokens)
if isinstance(self._span_id_to_tokens[parent_span_id].get(key, 0), int)
and isinstance(tokens.get(key, 0), int)
}
self._span_id_to_tokens[parent_span_id] = merged_tokens
else:
Expand Down

0 comments on commit 6367e44

Please sign in to comment.