-
-
Notifications
You must be signed in to change notification settings - Fork 11k
fix(realtime): azure Foundry realtime endpoints + self-provision e2e realtime suite #32558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
mubashir1osmani
wants to merge
6
commits into
BerriAI:litellm_internal_staging
from
mubashir1osmani:litellm_fix_failing
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0b1d328
fix: rust ocr tests finally pass
mubashir1osmani a239ab1
fix: move realtime dir
mubashir1osmani 23e608a
fix(realtime): normalize azure realtime api_base to host for Foundry …
mubashir1osmani 0ad562b
test(e2e): add Gateway.list_files and list_fine_tuning_jobs for the d…
mubashir1osmani 836f2d8
revert(realtime): drop azure realtime api_base host-normalization
mubashir1osmani 07218cb
fix(ocr): route azure_ai doc-intelligence to its own endpoint at the …
mubashir1osmani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
tests/e2e/llm_translation/realtime/REALTIME_COVERAGE_MATRIX.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Realtime e2e coverage | ||
|
|
||
| Live tests for the proxy realtime websocket endpoint (`/v1/realtime`). One | ||
| GA-speaking websocket client drives every provider; the proxy normalizes each | ||
| provider's stream into the OpenAI GA event schema, so the same assertions hold | ||
| across providers and only the model alias changes. | ||
|
|
||
| ## What is asserted | ||
|
|
||
| For each configured provider, `test_text_conversation` checks the session | ||
| lifecycle (`session.created`, then `session.update` echoed by `session.updated`), | ||
| the canonical response sequence (`response.created`, `response.output_item.added`, | ||
| through `response.done`), that the streamed deltas reconstruct a non-empty | ||
| transcript, and that `response.done` carries normalized usage. | ||
|
|
||
| `test_tool_call_round_trip` checks the full tool path: the model emits a | ||
| normalized `response.function_call_arguments.done` with valid JSON arguments and | ||
| a matching `function_call` output item, the test sends a `function_call_output` | ||
| back, and the follow-up response incorporates the result (the temperature 72 | ||
| appears). | ||
|
|
||
| `test_realtime_pipecat_e2e` is a realism layer that drives the same providers | ||
| through pipecat's GA `OpenAIRealtimeLLMService` (base_url pointed at the proxy) | ||
| rather than speaking the protocol by hand. Its assertions are coarse (the tool | ||
| callback fired, assistant text was produced); the raw-websocket suite is the | ||
| source of truth. It skips unless `pipecat-ai` is installed | ||
| (`uv pip install "pipecat-ai[openai]"`). | ||
|
|
||
| ## Provisioning | ||
|
|
||
| The suite registers every provider's realtime deployment through `/model/new` at | ||
| session start (the `realtime_models` fixture) and deletes them on teardown, so it | ||
| never depends on a static or misconfigured gateway `model_list`. Each deployment | ||
| is created with `model_info.mode: realtime` and marker-unique names, and its | ||
| `litellm_params` point the credentials at `os.environ/*` refs the gateway resolves | ||
| at call time. The provider table below is the source of truth; edit `PROVIDERS` in | ||
| `realtime_client.py` to change a model or add one. | ||
|
|
||
| | provider | model alias | upstream model | | ||
| |----------|-------------|----------------| | ||
| | openai | `openai-realtime` | `openai/gpt-realtime-2` | | ||
| | azure | `azure-realtime` | `azure/gpt-realtime-2` (GA protocol) | | ||
| | gemini | `gemini-realtime` | `gemini/gemini-3.1-flash-live-preview` | | ||
| | vertex_ai | `vertex-realtime` | `vertex_ai/gemini-live-2.5-flash-preview-native-audio-09-2025` | | ||
|
|
||
| Every provider is provisioned and asserted; the suite never skips a provider. Per | ||
| `tests/e2e/CLAUDE.md` the only sanctioned skip is the whole-suite proxy-liveness | ||
| skip, so a provider whose credentials or upstream realtime model are missing on the | ||
| gateway is a hard failure, not a skip. Give the gateway each provider's credentials | ||
| to turn its tests green. | ||
|
|
||
| ## Running | ||
|
|
||
| Start a proxy with the provider keys set in its environment (the suite registers | ||
| the deployments itself), then | ||
|
|
||
| ``` | ||
| uv run pytest tests/e2e/llm_translation/realtime/ -v | ||
| ``` | ||
|
|
||
| The whole suite skips only when no proxy answers `GET /health/liveliness` at | ||
| `LITELLM_PROXY_URL` (default `http://localhost:4000`). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| """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) | ||
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.