Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eval_protocol/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ class CostMetrics(BaseModel):

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

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


class ExecutionMetadata(BaseModel):
Expand Down
4 changes: 2 additions & 2 deletions eval_protocol/pytest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def add_cost_metrics(row: EvaluationRow) -> None:
row.execution_metadata.cost_metrics = CostMetrics(
input_cost=0.0,
output_cost=0.0,
total_cost=0.0,
total_cost_dollar=0.0,
)
return

Expand Down Expand Up @@ -461,5 +461,5 @@ def add_cost_metrics(row: EvaluationRow) -> None:
row.execution_metadata.cost_metrics = CostMetrics(
input_cost=input_cost,
output_cost=output_cost,
total_cost=total_cost,
total_cost_dollar=total_cost,
)
10 changes: 5 additions & 5 deletions tests/pytest/test_execution_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_single_model_with_provider(self):
assert row.execution_metadata.cost_metrics is not None
assert row.execution_metadata.cost_metrics.input_cost is not None
assert row.execution_metadata.cost_metrics.output_cost is not None
assert row.execution_metadata.cost_metrics.total_cost_dollars is not None
assert row.execution_metadata.cost_metrics.total_cost_dollar is not None

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

def test_no_usage_stats(self):
"""Test case with no usage statistics."""
Expand All @@ -71,7 +71,7 @@ def test_no_usage_stats(self):
assert row.execution_metadata.cost_metrics is not None
assert row.execution_metadata.cost_metrics.input_cost == 0.0
assert row.execution_metadata.cost_metrics.output_cost == 0.0
assert row.execution_metadata.cost_metrics.total_cost_dollars == 0.0
assert row.execution_metadata.cost_metrics.total_cost_dollar == 0.0

def test_no_completion_params(self):
"""Test case with empty completion parameters."""
Expand All @@ -88,7 +88,7 @@ def test_no_completion_params(self):
assert row.execution_metadata.cost_metrics is not None
assert row.execution_metadata.cost_metrics.input_cost == 0.0
assert row.execution_metadata.cost_metrics.output_cost == 0.0
assert row.execution_metadata.cost_metrics.total_cost_dollars == 0.0
assert row.execution_metadata.cost_metrics.total_cost_dollar == 0.0

def test_zero_tokens(self):
"""Test case with zero token usage."""
Expand All @@ -105,7 +105,7 @@ def test_zero_tokens(self):
assert row.execution_metadata.cost_metrics is not None
assert row.execution_metadata.cost_metrics.input_cost == 0.0
assert row.execution_metadata.cost_metrics.output_cost == 0.0
assert row.execution_metadata.cost_metrics.total_cost_dollars == 0.0
assert row.execution_metadata.cost_metrics.total_cost_dollar == 0.0

def test_provider_mapping_variations(self):
"""Test different provider mappings."""
Expand Down
2 changes: 1 addition & 1 deletion vite-app/src/GlobalState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const DEFAULT_QUALITY_PIVOT_CONFIG: PivotConfig = {
export const DEFAULT_COST_PIVOT_CONFIG: PivotConfig = {
selectedRowFields: ["$.eval_metadata.name"],
selectedColumnFields: ["$.input_metadata.completion_params.model"],
selectedValueField: "$.execution_metadata.cost_metrics.total_cost_dollars",
selectedValueField: "$.execution_metadata.cost_metrics.total_cost_dollar",
selectedAggregator: "sum",
};

Expand Down
2 changes: 1 addition & 1 deletion vite-app/src/components/PivotTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ const PivotTab = observer(() => {
variant="secondary"
size="sm"
>
Cost (total_cost_dollars)
Cost (total_cost_dollar)
</Button>
<Button
onClick={() => resetPivotConfig(DEFAULT_SPEED_PIVOT_CONFIG)}
Expand Down
2 changes: 1 addition & 1 deletion vite-app/src/types/eval-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export const CostMetricsSchema = z.object({
.nullable()
.optional()
.describe("Cost in USD for output tokens."),
total_cost_dollars: z
total_cost_dollar: z
.number()
.nullable()
.optional()
Expand Down
Loading