Skip to content

Commit cc72ddd

Browse files
gustavocidornelaswhoseoyster
authored andcommitted
Fixes OPEN-5842 Bug bubbling up the costs when model is unsupported
1 parent e45086e commit cc72ddd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

openlayer/constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@
7878
"input": 0.03e-3,
7979
"output": 0.06e-3,
8080
},
81+
"gpt-4-turbo-preview": {
82+
"input": 0.01e-3,
83+
"output": 0.03e-3,
84+
},
8185
"gpt-4-0125-preview": {
8286
"input": 0.01e-3,
8387
"output": 0.03e-3,

openlayer/tracing/tracer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ def bubble_up_costs_and_tokens(
176176
def add_step_costs_and_tokens(step: Dict[str, Any]) -> Tuple[float, int]:
177177
step_cost = step_tokens = 0
178178

179-
if "cost" in step:
179+
if "cost" in step and step["cost"] is not None:
180180
step_cost += step["cost"]
181-
if "tokens" in step:
181+
if "tokens" in step and step["tokens"] is not None:
182182
step_tokens += step["tokens"]
183183

184184
# Recursively add costs and tokens from nested steps

0 commit comments

Comments
 (0)