Skip to content

Commit

Permalink
Fix handling of snapshot_ids ("gpt-4-turbo-2024-04-09" and "gpt-4o-20…
Browse files Browse the repository at this point in the history
…24-05-13") and alias "gpt-4-turbo". (#672)

Co-authored-by: rstaneker <[email protected]>
  • Loading branch information
st4r0 and rstaneker authored May 19, 2024
1 parent 00db862 commit c1aa5a1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions instructor/cli/usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ async def get_usage_for_past_n_days(n_days: int) -> list[dict[str, Any]]:
# Define the cost per unit for each model
MODEL_COSTS = {
"gpt-4o": {"prompt": 0.005 / 1000, "completion": 0.015 / 1000},
"gpt-4o-2024-05-13": {"prompt": 0.005 / 1000, "completion": 0.015 / 1000},
"gpt-4-turbo": {"prompt": 0.01 / 1000, "completion": 0.03 / 1000},
"gpt-4-turbo-2024-04-09": {"prompt": 0.01 / 1000, "completion": 0.03 / 1000},
"gpt-4-0125-preview": {"prompt": 0.01 / 1000, "completion": 0.03 / 1000},
"gpt-4-turbo-preview": {"prompt": 0.01 / 1000, "completion": 0.03 / 1000},
"gpt-4-1106-preview": {"prompt": 0.01 / 1000, "completion": 0.03 / 1000},
Expand Down Expand Up @@ -85,8 +88,12 @@ def get_model_cost(
return MODEL_COSTS["gpt-3.5-turbo-16k"]
elif model.startswith("gpt-3.5-turbo"):
return MODEL_COSTS["gpt-3.5-turbo"]
elif model.startswith("gpt-4-turbo"):
return MODEL_COSTS["gpt-4-turbo-preview"]
elif model.startswith("gpt-4-32k"):
return MODEL_COSTS["gpt-4-32k"]
elif model.startswith("gpt-4o"):
return MODEL_COSTS["gpt-4o"]
elif model.startswith("gpt-4"):
return MODEL_COSTS["gpt-4"]
else:
Expand Down

0 comments on commit c1aa5a1

Please sign in to comment.