mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-30 01:08:33 +00:00
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
18 lines
629 B
Python
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."}]}
|
|
)
|