Skip to content

Commit

Permalink
fix: calc run cost (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcrt committed Aug 3, 2024
1 parent 5889506 commit 531d4cb
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/backend/src/utils/calcCost.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sql from "./db"
import { setTimeout } from "timers/promises"
import * as Sentry from "@sentry/node"
import { filterAsync, findAsyncSequential } from "./misc"
import { setTimeout } from "timers/promises"
import sql from "./db"
import { findAsyncSequential } from "./misc"

interface ModelCost {
models: string[]
Expand Down Expand Up @@ -232,11 +232,10 @@ export async function calcRunCost(run: any) {
let inputUnits = 0
let outputUnits = 0

let inputCost = 0
let outputCost = 0
let inputCost = mapping.inputCost
let outputCost = mapping.outputCost

if (mapping.unit === "TOKENS") {
console.log(run, mapping)
inputUnits = run.promptTokens || 0
outputUnits = run.completionTokens || 0

Expand Down

0 comments on commit 531d4cb

Please sign in to comment.