mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
fix(model-prices): correct replicate model key typo (#34800)
This commit is contained in:
parent
55e666a05f
commit
e6e18d406a
3 changed files with 45 additions and 2 deletions
|
|
@ -33052,7 +33052,7 @@
|
|||
"supports_tool_choice": true,
|
||||
"supports_response_schema": true
|
||||
},
|
||||
"replicateopenai/gpt-oss-20b": {
|
||||
"replicate/openai/gpt-oss-20b": {
|
||||
"input_cost_per_token": 9e-08,
|
||||
"output_cost_per_token": 3.6e-07,
|
||||
"litellm_provider": "replicate",
|
||||
|
|
|
|||
|
|
@ -33143,7 +33143,7 @@
|
|||
"supports_tool_choice": true,
|
||||
"supports_response_schema": true
|
||||
},
|
||||
"replicateopenai/gpt-oss-20b": {
|
||||
"replicate/openai/gpt-oss-20b": {
|
||||
"input_cost_per_token": 9e-08,
|
||||
"output_cost_per_token": 3.6e-07,
|
||||
"litellm_provider": "replicate",
|
||||
|
|
|
|||
43
tests/test_litellm/test_replicate_model_key_format.py
Normal file
43
tests/test_litellm/test_replicate_model_key_format.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import json
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def model_cost() -> dict[str, Any]:
|
||||
json_path = Path(__file__).parents[2] / "model_prices_and_context_window.json"
|
||||
with open(json_path, encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def test_replicate_models_have_valid_key_prefix(model_cost: dict[str, Any]) -> None:
|
||||
replicate_models = {k for k, v in model_cost.items() if v.get("litellm_provider") == "replicate"}
|
||||
malformed = [k for k in replicate_models if not k.startswith("replicate/")]
|
||||
assert not malformed, (
|
||||
f"Replicate models must use 'replicate/owner/model' key format, found malformed keys: {malformed}"
|
||||
)
|
||||
|
||||
|
||||
def test_replicate_openai_gpt_oss_20b_key_exists(model_cost: dict[str, Any]) -> None:
|
||||
assert "replicate/openai/gpt-oss-20b" in model_cost
|
||||
info = model_cost["replicate/openai/gpt-oss-20b"]
|
||||
assert info["litellm_provider"] == "replicate"
|
||||
assert info["mode"] == "chat"
|
||||
assert info["supports_function_calling"] is True
|
||||
|
||||
|
||||
def test_replicate_backup_matches_main() -> None:
|
||||
repo_root = Path(__file__).parents[2]
|
||||
main_path = repo_root / "model_prices_and_context_window.json"
|
||||
backup_path = repo_root / "litellm" / "model_prices_and_context_window_backup.json"
|
||||
|
||||
with open(main_path, encoding="utf-8") as f:
|
||||
main_cost: dict[str, Any] = json.load(f)
|
||||
with open(backup_path, encoding="utf-8") as f:
|
||||
backup_cost: dict[str, Any] = json.load(f)
|
||||
|
||||
for key in main_cost:
|
||||
if main_cost[key].get("litellm_provider") == "replicate":
|
||||
assert backup_cost.get(key) == main_cost.get(key), f"{key} differs between main and backup model cost maps"
|
||||
Loading…
Add table
Reference in a new issue