mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
test(search): make SerpApi cost metadata test independent
This commit is contained in:
parent
e75c3a09cf
commit
2fd7755ad2
1 changed files with 6 additions and 1 deletions
|
|
@ -391,10 +391,15 @@ def test_serpapi_unrecognized_response_shape_raises() -> None:
|
|||
assert exc_info.value.status_code == 200
|
||||
|
||||
|
||||
def test_serpapi_search_cost_metadata() -> None:
|
||||
def test_serpapi_search_cost_metadata(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
local_model_cost = TypeAdapter(dict[str, object]).validate_json(
|
||||
(Path(__file__).parents[2] / "model_prices_and_context_window.json").read_text()
|
||||
)
|
||||
monkeypatch.setattr(litellm, "model_cost", local_model_cost)
|
||||
model_info = get_model_info(
|
||||
model="serpapi/search",
|
||||
custom_llm_provider="serpapi",
|
||||
api_key="test-api-key",
|
||||
)
|
||||
|
||||
assert model_info.get("input_cost_per_query") == 0.025
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue