Spaces:
Running
Running
Commit
·
788f67c
1
Parent(s):
20a9e6f
fix: Convert cost to float before formatting in thought graph
Browse filesHandle string values from dataset by converting to float before using .6f format
components/thought_graph.py
CHANGED
|
@@ -201,7 +201,8 @@ def create_thought_graph(spans: List[Dict[str, Any]], trace_id: str = "Unknown")
|
|
| 201 |
completion = int(node_data.get('completion_tokens', 0) or 0) # Handle None values and convert to int
|
| 202 |
hover += f"Tokens: {prompt + completion} (p:{prompt}, c:{completion})<br>"
|
| 203 |
if 'cost' in node_data and node_data['cost'] is not None:
|
| 204 |
-
|
|
|
|
| 205 |
|
| 206 |
hover_text.append(hover)
|
| 207 |
|
|
|
|
| 201 |
completion = int(node_data.get('completion_tokens', 0) or 0) # Handle None values and convert to int
|
| 202 |
hover += f"Tokens: {prompt + completion} (p:{prompt}, c:{completion})<br>"
|
| 203 |
if 'cost' in node_data and node_data['cost'] is not None:
|
| 204 |
+
cost = float(node_data['cost']) # Handle string values
|
| 205 |
+
hover += f"Cost: ${cost:.6f}<br>"
|
| 206 |
|
| 207 |
hover_text.append(hover)
|
| 208 |
|