mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-26 01:12:21 +00:00
fix(tests): backfill local backup entries into runtime model_cost
litellm.model_cost is loaded from LITELLM_MODEL_COST_MAP_URL (pinned to main) at import time, so any pricing entries added to the in-tree backup on this branch aren't visible at test runtime until they also land on main. The Mistral cassette currently returns model=ministral-8b-2512 and the cost-calculator lookup in test_completion_mistral_api / test_completion_mistral_api_modified_input fails despite the entry existing in the local backup. Backfill missing backup entries into litellm.model_cost in the local_testing conftest so these lookups succeed against the cassette state the branch is being tested with.
This commit is contained in:
parent
c826511330
commit
99fda58f57
1 changed files with 13 additions and 0 deletions
|
|
@ -22,6 +22,19 @@ sys.path.insert(
|
|||
) # Adds the parent directory to the system path
|
||||
import litellm
|
||||
|
||||
# ``litellm.model_cost`` is loaded at import time from the URL pinned to
|
||||
# ``main`` (``LITELLM_MODEL_COST_MAP_URL``). The in-tree backup ships with
|
||||
# this branch and can include pricing entries that main has not yet picked
|
||||
# up (e.g. an upstream provider rotates a model id and the test cassette
|
||||
# records the new name). Backfill any entries that are missing from the
|
||||
# remote-fetched map so cost-calculator lookups in tests succeed against
|
||||
# the cassette state the branch is being tested with.
|
||||
from litellm.litellm_core_utils.get_model_cost_map import GetModelCostMap
|
||||
|
||||
for _k, _v in GetModelCostMap.load_local_model_cost_map().items():
|
||||
litellm.model_cost.setdefault(_k, _v)
|
||||
del _k, _v
|
||||
|
||||
from tests._vcr_conftest_common import ( # noqa: E402,F401
|
||||
VerboseReporterState,
|
||||
_pin_multipart_boundary,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue