(feat) cost: azure gpt + testing

This commit is contained in:
ishaan-jaff 2023-11-23 14:20:48 -08:00
parent 90a9116a17
commit bb00595429
2 changed files with 28 additions and 2 deletions

View file

@ -1678,7 +1678,7 @@ def completion_cost(
# get input/output tokens from completion_response
prompt_tokens = completion_response['usage']['prompt_tokens']
completion_tokens = completion_response['usage']['completion_tokens']
model = completion_response['model'] # get model from completion_response
model = model or completion_response['model'] # check if user passed an override for model, if it's none check completion_response['model']
else:
prompt_tokens = token_counter(model=model, text=prompt)
completion_tokens = token_counter(model=model, text=completion)