Skip to content

Commit

Permalink
fix completion cost test
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaan-jaff committed May 8, 2024
1 parent 282b8d0 commit 33d6caa
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions litellm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4168,13 +4168,18 @@ def cost_per_token(
model_without_prefix = model_parts[1]
else:
model_without_prefix = model

if model in model_cost_ref: # Option 1. use model passed, model="gpt-4"
model = model
elif (
"""
Code block that formats model to lookup in litellm.model_cost
Option1. model = "bedrock/ap-northeast-1/anthropic.claude-instant-v1". This is the most accurate since it is region based. Should always be option 1
Option2. model = "openai/gpt-4" - model = provider/model
Option3. model = "anthropic.claude-3" - model = model
"""
if (
model_with_provider in model_cost_ref
): # Option 2. use model with provider, model = "openai/gpt-4"
model = model_with_provider
elif model in model_cost_ref: # Option 1. use model passed, model="gpt-4"
model = model
elif (
model_without_prefix in model_cost_ref
): # Option 3. if user passed model="bedrock/anthropic.claude-3", use model="anthropic.claude-3"
Expand Down

0 comments on commit 33d6caa

Please sign in to comment.