mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
* fix: rust ocr tests finally pass * fix: move realtime dir * fix(realtime): normalize azure realtime api_base to host for Foundry endpoints The azure realtime handler appended the realtime path to api_base verbatim, so a Foundry base carrying a project path (.../api/projects/<name>) produced an invalid realtime URL and the websocket handshake hung. Normalize api_base to scheme and host before building the realtime path so both Azure OpenAI and Foundry bases connect Point the e2e realtime azure deployment at the GA gpt-realtime model and stop passing the os.environ refs the realtime path never unwraps, resolving them from the gateway env by name instead. Drop the local docker-compose scaffolding from the tree * test(e2e): add Gateway.list_files and list_fine_tuning_jobs for the discovery suite The discovery endpoints suite calls client.gateway.list_files and list_fine_tuning_jobs, which did not exist on Gateway, so both tests errored with AttributeError before reaching the proxy. Add the two GET wrappers using the existing FileListResponse / FineTuningJobsResponse models * revert(realtime): drop azure realtime api_base host-normalization The azure realtime handshake failure was a config issue, not a litellm bug: the realtime base was set to the Azure AI Foundry project endpoint (.../api/projects/<p>), but the OpenAI-compatible realtime route lives at the resource root. litellm correctly appends the realtime path to whatever base it is given, so pointing the realtime deployment at the resource root is the fix and no core change is needed * fix(ocr): route azure_ai doc-intelligence to its own endpoint at the source get_llm_provider inherits AZURE_AI_API_BASE into api_base for every azure_ai/* OCR model, but Azure Document Intelligence is a separate resource reached via AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT, so doc-intelligence requests went to the wrong host. Stop inheriting the azure_ai base for doc-intelligence models so api_base stays unset and both the rust bridge and the python get_complete_url fall back to the document-intelligence endpoint. This drops the earlier _rust_bridge_api_base reorder, which only covered the rust path and let the env silently override an explicit api_base * refactor(ocr): consolidate azure doc-intelligence detection; keep explicit api_base Extract is_azure_document_intelligence_model as the single source of truth for the azure_ai doc-intelligence sub-route so the check is no longer duplicated across _prepare_ocr_request and _rust_bridge_api_base, and gate the dynamic_api_base suppression on the caller not supplying an api_base so an explicit endpoint is always honoured. Restore xai to the realtime PROVIDERS as a documented disabled entry instead of dropping it silently, and add a regression test pinning doc-intelligence api_base resolution. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Mubashir Osmani <mubashir@berri.ai> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
37 lines
1.5 KiB
Python
37 lines
1.5 KiB
Python
"""Realtime suite's `client` and `realtime_models` fixtures.
|
|
|
|
The shared lifecycle (resources/scoped_key), proxy liveness skip, and e2e marker
|
|
live in the parent tests/e2e/conftest.py. RealtimeClient holds the shared Gateway,
|
|
so the `resources` fixture cleans up keys this suite creates.
|
|
|
|
`realtime_models` registers every provider's realtime deployment through /model/new
|
|
at session start and deletes them at teardown, so the suite provisions the models it
|
|
uses through the management endpoints instead of depending on a static (or
|
|
misconfigured) gateway model_list.
|
|
"""
|
|
|
|
from collections.abc import Iterator
|
|
|
|
import pytest
|
|
|
|
from realtime_client import PROVIDERS, RealtimeClient, build_client
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def client() -> RealtimeClient:
|
|
return build_client()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def realtime_models(client: RealtimeClient) -> Iterator[dict[str, str]]:
|
|
"""Provision each provider's realtime deployment via /model/new and yield a
|
|
provider-id -> model-name map the tests connect with; delete them on teardown.
|
|
Every provider is provisioned (never skipped): a provider whose credentials or
|
|
upstream model are missing on the gateway hard-fails its test, per the suite's
|
|
fail-on-behavior contract in tests/e2e/CLAUDE.md."""
|
|
records = tuple((provider.id, *client.provision(provider)) for provider in PROVIDERS)
|
|
try:
|
|
yield {provider_id: model_name for provider_id, model_name, _ in records}
|
|
finally:
|
|
for _, _, model_id in records:
|
|
client.gateway.delete_model(model_id)
|