mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
fix(health): keep realtime credential hydration immutable
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
123b76e2d8
commit
e668a31384
2 changed files with 11 additions and 5 deletions
|
|
@ -28,8 +28,9 @@ from litellm.types.realtime import (
|
|||
)
|
||||
from litellm.types.router import GenericLiteLLMParams
|
||||
from litellm.types.utils import CallTypes, LlmProviders
|
||||
from litellm.utils import ProviderConfigManager, load_credentials_from_list
|
||||
from litellm.utils import ProviderConfigManager
|
||||
|
||||
from ..litellm_core_utils.credential_accessor import CredentialAccessor
|
||||
from ..litellm_core_utils.get_litellm_params import get_litellm_params
|
||||
from ..litellm_core_utils.litellm_logging import Logging as LiteLLMLogging
|
||||
from ..llms.azure.common_utils import get_azure_ad_token
|
||||
|
|
@ -57,9 +58,11 @@ _EMPTY_MODEL_PARAMS: Final[Mapping[str, Any]] = MappingProxyType({})
|
|||
|
||||
|
||||
def _model_params_with_stored_credentials(model_params: Mapping[str, Any]) -> Mapping[str, Any]:
|
||||
hydrated: Final = dict(model_params)
|
||||
load_credentials_from_list(hydrated)
|
||||
return MappingProxyType(hydrated)
|
||||
credential_name: Final = model_params.get("litellm_credential_name")
|
||||
credential_values: Final = (
|
||||
CredentialAccessor.get_credential_values(credential_name) if isinstance(credential_name, str) else {}
|
||||
)
|
||||
return MappingProxyType({**credential_values, **model_params})
|
||||
|
||||
|
||||
def _with_resolved_session_model(session: dict[str, object], model_name: str) -> dict[str, object]:
|
||||
|
|
|
|||
|
|
@ -267,10 +267,13 @@ async def test_azure_health_check_resolves_stored_credentials(monkeypatch):
|
|||
model="gpt-realtime",
|
||||
custom_llm_provider="azure",
|
||||
api_key=None,
|
||||
realtime_protocol="beta",
|
||||
model_params={"model": "azure/gpt-realtime", "litellm_credential_name": "azure-rt"},
|
||||
)
|
||||
assert connect.kwargs["additional_headers"] == {"api-key": "sk-from-credential"}
|
||||
assert connect.url is not None and connect.url.startswith("wss://example.openai.azure.com")
|
||||
assert connect.url is not None
|
||||
assert connect.url.startswith("wss://example.openai.azure.com")
|
||||
assert "api-version=2025-04-01-preview" in connect.url
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue