forked from phoenix/litellm-mirror
* docs(prompt_caching.md): add prompt caching cost calc example to docs * docs(prompt_caching.md): add proxy examples to docs * feat(utils.py): expose new helper `supports_prompt_caching()` to check if a model supports prompt caching * docs(prompt_caching.md): add docs on checking model support for prompt caching * build: fix invalid json
25 lines
625 B
Python
25 lines
625 B
Python
import os, sys, traceback
|
|
import importlib.resources
|
|
import json
|
|
|
|
sys.path.insert(
|
|
0, os.path.abspath("../..")
|
|
) # Adds the parent directory to the system path
|
|
import litellm
|
|
import pytest
|
|
|
|
|
|
def test_get_model_cost_map():
|
|
try:
|
|
print(litellm.get_model_cost_map(url="fake-url"))
|
|
except Exception as e:
|
|
pytest.fail(f"An exception occurred: {e}")
|
|
|
|
|
|
def test_get_backup_model_cost_map():
|
|
with importlib.resources.open_text(
|
|
"litellm", "model_prices_and_context_window_backup.json"
|
|
) as f:
|
|
print("inside backup")
|
|
content = json.load(f)
|
|
print("content", content)
|