litellm/tests/unit/integrations/websearch_interception/conftest.py
mateo-berri e7025a62ba test(tool-choice): adapt the picked tests to lts/1.108.x
The picked test files reach a few names the line does not have, so this
ports them to the line's code without bringing those features over.
The MCP response tests stub the line's own proxy_server imports, the
web search tests get main's perplexity_search fixture, and the chat and
Responses hook tests expect what the line does. An excluded chat hook
call answers 400, and native /v1/responses hooks run as before since
the line cannot end a Responses turn early
2026-11-07 02:05:07 -08:00

18 lines
629 B
Python

from typing import Final
import pytest
import respx
import litellm
PERPLEXITY_SEARCH_URL: Final = "https://api.perplexity.ai/search"
@pytest.fixture
def perplexity_search(monkeypatch: pytest.MonkeyPatch, respx_mock: respx.MockRouter) -> respx.Route:
monkeypatch.setenv("PERPLEXITYAI_API_KEY", "test-perplexity-key")
monkeypatch.delenv("PERPLEXITY_API_BASE", raising=False)
monkeypatch.setattr(litellm, "disable_aiohttp_transport", True)
return respx_mock.post(PERPLEXITY_SEARCH_URL).respond(
json={"results": [{"title": "AI news", "url": "https://example.com/ai-news", "snippet": "AI news."}]}
)