fix completion cost test

This commit is contained in:
Ishaan Jaff 2024-05-08 15:51:30 -07:00
parent 282b8d0ae4
commit 33d6caa889

View file

@ -4168,13 +4168,18 @@ def cost_per_token(
model_without_prefix = model_parts[1] model_without_prefix = model_parts[1]
else: else:
model_without_prefix = model model_without_prefix = model
"""
if model in model_cost_ref: # Option 1. use model passed, model="gpt-4" Code block that formats model to lookup in litellm.model_cost
model = model 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
elif ( Option2. model = "openai/gpt-4" - model = provider/model
Option3. model = "anthropic.claude-3" - model = model
"""
if (
model_with_provider in model_cost_ref model_with_provider in model_cost_ref
): # Option 2. use model with provider, model = "openai/gpt-4" ): # Option 2. use model with provider, model = "openai/gpt-4"
model = model_with_provider model = model_with_provider
elif model in model_cost_ref: # Option 1. use model passed, model="gpt-4"
model = model
elif ( elif (
model_without_prefix in model_cost_ref model_without_prefix in model_cost_ref
): # Option 3. if user passed model="bedrock/anthropic.claude-3", use model="anthropic.claude-3" ): # Option 3. if user passed model="bedrock/anthropic.claude-3", use model="anthropic.claude-3"