forked from phoenix/litellm-mirror
(test) cost calc on azure
This commit is contained in:
parent
5408a40cc8
commit
da7c07574f
2 changed files with 4 additions and 1 deletions
|
@ -594,6 +594,9 @@ def test_completion_azure():
|
||||||
# )
|
# )
|
||||||
# Add any assertions here to check the response
|
# Add any assertions here to check the response
|
||||||
print(response)
|
print(response)
|
||||||
|
|
||||||
|
cost = completion_cost(completion_response=response)
|
||||||
|
print("Cost for azure completion request", cost)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
pytest.fail(f"Error occurred: {e}")
|
||||||
|
|
||||||
|
|
|
@ -1612,7 +1612,7 @@ def cost_per_token(model="gpt-3.5-turbo", prompt_tokens=0, completion_tokens=0):
|
||||||
)
|
)
|
||||||
return prompt_tokens_cost_usd_dollar, completion_tokens_cost_usd_dollar
|
return prompt_tokens_cost_usd_dollar, completion_tokens_cost_usd_dollar
|
||||||
else:
|
else:
|
||||||
# calculate average input cost
|
# calculate average input cost, azure/gpt-deployments can potentially go here if users don't specify, gpt-4, gpt-3.5-turbo. LLMs litellm knows
|
||||||
input_cost_sum = 0
|
input_cost_sum = 0
|
||||||
output_cost_sum = 0
|
output_cost_sum = 0
|
||||||
model_cost_ref = litellm.model_cost
|
model_cost_ref = litellm.model_cost
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue