mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-27 01:22:18 +00:00
The llm_translation suite drove /v1/responses, /v1/messages, /embeddings, /v1/images/generations, /v1/moderations and /v1/audio/* through a bespoke endpoints_client wrapper that no customer runs. Tests now call the proxy the way customers do: the OpenAI SDK for the OpenAI-compatible surface and the Anthropic SDK for /v1/messages, wired through a session-scoped sdk fixture (sdk_clients.py) that points both SDKs at the proxy with a virtual key. Endpoints no official SDK covers keep the shared typed transport: rerank moves onto ProxyClient (RerankBody/RerankResponse in models.py) and the passthrough header test parses with the shared AnthropicMessagesResponse model. Files that only used endpoints_client for model registration now use the proxy fixture directly. endpoints_client.py is deleted; anthropic joins the e2e-dev dependency group so the lint env resolves the SDK imports. Resolves LIT-4577
31 lines
1,011 B
Python
31 lines
1,011 B
Python
"""LLM-translation suite's `client` fixture.
|
|
|
|
The shared lifecycle (resources/scoped_key), proxy liveness gate, and e2e marker
|
|
live in the parent tests/e2e/conftest.py. PassthroughClient holds the shared
|
|
ProxyClient, so the `resources` fixture cleans up keys this suite creates. The
|
|
`sdk` fixture hands tests real provider SDK clients (OpenAI, Anthropic) pointed
|
|
at the proxy, the way customers actually call it.
|
|
"""
|
|
|
|
import pytest
|
|
|
|
from passthrough_client import PassthroughClient, build_client
|
|
from proxy_client import ProxyClient
|
|
from sdk_clients import SdkClients, build_sdk_clients
|
|
|
|
|
|
def pytest_configure(config: pytest.Config) -> None:
|
|
config.addinivalue_line(
|
|
"markers",
|
|
"covers: registry cell a test covers, e.g. llm.chat_completions.provider.basic.nonstream.works",
|
|
)
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def client(proxy: ProxyClient) -> PassthroughClient:
|
|
return build_client(proxy)
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def sdk() -> SdkClients:
|
|
return build_sdk_clients()
|