mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
test(proxy): inject a fake router for the search default model test
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
57e95cc66f
commit
c0631238bb
1 changed files with 6 additions and 4 deletions
|
|
@ -5,7 +5,6 @@ import pytest
|
|||
|
||||
from litellm.proxy import proxy_server
|
||||
from litellm.proxy._types import UserAPIKeyAuth
|
||||
from litellm.proxy.common_request_processing import ProxyBaseLLMRequestProcessing
|
||||
from litellm.proxy.route_llm_request import ProxyMissingRequiredParamError
|
||||
from litellm.proxy.search_endpoints.endpoints import search
|
||||
|
||||
|
|
@ -39,9 +38,9 @@ async def test_search_with_only_a_query_falls_back_to_the_proxy_default_model(mo
|
|||
else:
|
||||
monkeypatch.setitem(proxy_server.general_settings, "completion_model", "perplexity-search")
|
||||
search_result = {"object": "search", "results": []}
|
||||
monkeypatch.setattr(
|
||||
ProxyBaseLLMRequestProcessing, "base_process_llm_request", AsyncMock(return_value=search_result)
|
||||
)
|
||||
router = MagicMock()
|
||||
router.asearch = AsyncMock(return_value=search_result)
|
||||
monkeypatch.setattr(proxy_server, "llm_router", router)
|
||||
|
||||
response = await search(
|
||||
request=_json_request({"query": "litellm"}),
|
||||
|
|
@ -50,3 +49,6 @@ async def test_search_with_only_a_query_falls_back_to_the_proxy_default_model(mo
|
|||
)
|
||||
|
||||
assert response == search_result, response
|
||||
router.asearch.assert_awaited_once()
|
||||
assert router.asearch.await_args.kwargs["query"] == "litellm"
|
||||
assert router.asearch.await_args.kwargs["model"] == "perplexity-search"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue