File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ def format_output(self) -> str:
110110
111111 # Add run information if available
112112 if self .cost_usd is not None :
113- output .append (f"Cost: $ { self .cost_usd } " )
113+ output .append (f"Cost: $ { self .cost_usd :.5f } " )
114114 if self .duration_seconds is not None :
115115 output .append (f"Latency: { self .duration_seconds :.2f} s" )
116116
Original file line number Diff line number Diff line change @@ -67,7 +67,29 @@ def test_format_output() -> None:
6767 "message": "hello"
6868}
6969==================================================
70- Cost: $ 0.001
70+ Cost: $ 0.00100
71+ Latency: 1.23s"""
72+
73+ assert run .format_output () == expected
74+
75+
76+ def test_format_output_very_low_cost () -> None :
77+ run = Run [_TestOutput ](
78+ id = "test-id" ,
79+ agent_id = "agent-1" ,
80+ schema_id = 1 ,
81+ output = _TestOutput (message = "hello" ),
82+ duration_seconds = 1.23 ,
83+ cost_usd = 4.97625e-05 ,
84+ )
85+
86+ expected = """\n Output:
87+ ==================================================
88+ {
89+ "message": "hello"
90+ }
91+ ==================================================
92+ Cost: $ 0.00005
7193Latency: 1.23s"""
7294
7395 assert run .format_output () == expected
You can’t perform that action at this time.
0 commit comments