mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
fix(batches): narrow batch cost kwargs before the breakdown and drop node access in test
This commit is contained in:
parent
06c860b60a
commit
538cd2c3b0
2 changed files with 12 additions and 6 deletions
|
|
@ -2906,7 +2906,11 @@ class Logging(LiteLLMLoggingBaseClass):
|
|||
result.usage = batch_usage
|
||||
batch_prompt_cost: Final = kwargs.get("batch_prompt_cost", None)
|
||||
batch_completion_cost: Final = kwargs.get("batch_completion_cost", None)
|
||||
if batch_prompt_cost is not None and batch_completion_cost is not None:
|
||||
if (
|
||||
isinstance(batch_prompt_cost, float)
|
||||
and isinstance(batch_completion_cost, float)
|
||||
and isinstance(batch_cost, float)
|
||||
):
|
||||
self.set_cost_breakdown(
|
||||
input_cost=batch_prompt_cost,
|
||||
output_cost=batch_completion_cost,
|
||||
|
|
|
|||
|
|
@ -163,11 +163,13 @@ describe("LogDetailContent", () => {
|
|||
/>,
|
||||
);
|
||||
|
||||
const section = screen.getByText("Batch Results").closest('[data-slot="card"]') as HTMLElement;
|
||||
expect(within(section).getByText("batch_abc123")).toBeInTheDocument();
|
||||
expect(within(section).getByText("2")).toBeInTheDocument();
|
||||
expect(within(section).getByText("1")).toBeInTheDocument();
|
||||
expect(within(section).getByText("gemini-2.5-flash")).toBeInTheDocument();
|
||||
expect(screen.getByText("Batch Results")).toBeInTheDocument();
|
||||
expect(screen.getByText("batch_abc123")).toBeInTheDocument();
|
||||
expect(screen.getByText("Successful Requests")).toBeInTheDocument();
|
||||
expect(screen.getByText("2")).toBeInTheDocument();
|
||||
expect(screen.getByText("Failed Requests")).toBeInTheDocument();
|
||||
expect(screen.getByText("1")).toBeInTheDocument();
|
||||
expect(screen.getByText("gemini-2.5-flash")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("still renders the batch id when a legacy row carries no counts", () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue