Skip to content

Commit cbb505c

Browse files
authored
fix test / update to total_cost_dollar (remove the plural) (#207)
* fix the test * "total_cost_dollar"
1 parent 13fc911 commit cbb505c

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

eval_protocol/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ class CostMetrics(BaseModel):
525525

526526
output_cost: Optional[float] = Field(None, description="Cost in USD for output tokens.")
527527

528-
total_cost_dollars: Optional[float] = Field(None, description="Total cost in USD for the API call.")
528+
total_cost_dollar: Optional[float] = Field(None, description="Total cost in USD for the API call.")
529529

530530

531531
class ExecutionMetadata(BaseModel):

eval_protocol/pytest/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ def add_cost_metrics(row: EvaluationRow) -> None:
420420
row.execution_metadata.cost_metrics = CostMetrics(
421421
input_cost=0.0,
422422
output_cost=0.0,
423-
total_cost=0.0,
423+
total_cost_dollar=0.0,
424424
)
425425
return
426426

@@ -461,5 +461,5 @@ def add_cost_metrics(row: EvaluationRow) -> None:
461461
row.execution_metadata.cost_metrics = CostMetrics(
462462
input_cost=input_cost,
463463
output_cost=output_cost,
464-
total_cost=total_cost,
464+
total_cost_dollar=total_cost,
465465
)

tests/pytest/test_execution_metadata.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_single_model_with_provider(self):
2525
assert row.execution_metadata.cost_metrics is not None
2626
assert row.execution_metadata.cost_metrics.input_cost is not None
2727
assert row.execution_metadata.cost_metrics.output_cost is not None
28-
assert row.execution_metadata.cost_metrics.total_cost_dollars is not None
28+
assert row.execution_metadata.cost_metrics.total_cost_dollar is not None
2929

3030
@pytest.mark.skip(reason="Revisit when we figure out how to get cost metrics for multi-agent Pydantic.")
3131
def test_pydantic_ai_multi_agent_model_dict(self):
@@ -56,7 +56,7 @@ def test_pydantic_ai_multi_agent_model_dict(self):
5656
assert row.execution_metadata.cost_metrics is not None
5757
assert row.execution_metadata.cost_metrics.input_cost is not None
5858
assert row.execution_metadata.cost_metrics.output_cost is not None
59-
assert row.execution_metadata.cost_metrics.total_cost_dollars is not None
59+
assert row.execution_metadata.cost_metrics.total_cost_dollar is not None
6060

6161
def test_no_usage_stats(self):
6262
"""Test case with no usage statistics."""
@@ -71,7 +71,7 @@ def test_no_usage_stats(self):
7171
assert row.execution_metadata.cost_metrics is not None
7272
assert row.execution_metadata.cost_metrics.input_cost == 0.0
7373
assert row.execution_metadata.cost_metrics.output_cost == 0.0
74-
assert row.execution_metadata.cost_metrics.total_cost_dollars == 0.0
74+
assert row.execution_metadata.cost_metrics.total_cost_dollar == 0.0
7575

7676
def test_no_completion_params(self):
7777
"""Test case with empty completion parameters."""
@@ -88,7 +88,7 @@ def test_no_completion_params(self):
8888
assert row.execution_metadata.cost_metrics is not None
8989
assert row.execution_metadata.cost_metrics.input_cost == 0.0
9090
assert row.execution_metadata.cost_metrics.output_cost == 0.0
91-
assert row.execution_metadata.cost_metrics.total_cost_dollars == 0.0
91+
assert row.execution_metadata.cost_metrics.total_cost_dollar == 0.0
9292

9393
def test_zero_tokens(self):
9494
"""Test case with zero token usage."""
@@ -105,7 +105,7 @@ def test_zero_tokens(self):
105105
assert row.execution_metadata.cost_metrics is not None
106106
assert row.execution_metadata.cost_metrics.input_cost == 0.0
107107
assert row.execution_metadata.cost_metrics.output_cost == 0.0
108-
assert row.execution_metadata.cost_metrics.total_cost_dollars == 0.0
108+
assert row.execution_metadata.cost_metrics.total_cost_dollar == 0.0
109109

110110
def test_provider_mapping_variations(self):
111111
"""Test different provider mappings."""

vite-app/src/GlobalState.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const DEFAULT_QUALITY_PIVOT_CONFIG: PivotConfig = {
2727
export const DEFAULT_COST_PIVOT_CONFIG: PivotConfig = {
2828
selectedRowFields: ["$.eval_metadata.name"],
2929
selectedColumnFields: ["$.input_metadata.completion_params.model"],
30-
selectedValueField: "$.execution_metadata.cost_metrics.total_cost_dollars",
30+
selectedValueField: "$.execution_metadata.cost_metrics.total_cost_dollar",
3131
selectedAggregator: "sum",
3232
};
3333

vite-app/src/components/PivotTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ const PivotTab = observer(() => {
221221
variant="secondary"
222222
size="sm"
223223
>
224-
Cost (total_cost_dollars)
224+
Cost (total_cost_dollar)
225225
</Button>
226226
<Button
227227
onClick={() => resetPivotConfig(DEFAULT_SPEED_PIVOT_CONFIG)}

vite-app/src/types/eval-protocol.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ export const CostMetricsSchema = z.object({
290290
.nullable()
291291
.optional()
292292
.describe("Cost in USD for output tokens."),
293-
total_cost_dollars: z
293+
total_cost_dollar: z
294294
.number()
295295
.nullable()
296296
.optional()

0 commit comments

Comments
 (0)