Skip to content

Commit a97b83d

Browse files
fix: missing model names in model cost litellm dict (#748)
1 parent f790afd commit a97b83d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/ragbits-core/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- Fix issue with cost calculation for some models (#748)
56
- Fix issue with improper convertion to json of tool call arguments (#737)
67
- Added Google Drive support (#686)
78
- Add LLM Usage to LLMResponseWithMetadata (#700)

packages/ragbits-core/src/ragbits/core/llms/litellm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def get_estimated_cost(self, prompt_tokens: int, completion_tokens: int) -> floa
116116
Returns:
117117
The estimated cost of the LLM call.
118118
"""
119-
response_cost = litellm.model_cost[self.model_name]
119+
response_cost = litellm.get_model_info(self.model_name)
120120
response_cost_input = prompt_tokens * response_cost["input_cost_per_token"]
121121
response_cost_output = completion_tokens * response_cost["output_cost_per_token"]
122122
return response_cost_input + response_cost_output

0 commit comments

Comments
 (0)