(Refactor) - Re use litellm.completion/litellm.embedding etc for health checks (#7455)

* add mode: realtime

* add _realtime_health_check

* test_realtime_health_check

* azure _realtime_health_check

* _realtime_health_check

* Realtime Models

* fix code quality

* delete OAI / Azure custom health check code

* simplest version of ahealth check

* update tests

* working health check post refactor

* working aspeech health check

* fix realtime health checks

* test_audio_transcription_health_check

* use get_audio_file_for_health_check

* test_text_completion_health_check

* ahealth_check

* simplify health check code

* update ahealth_check

* fix import

* fix unused imports

* fix ahealth_check

* fix local testing

* test_async_realtime_health_check
This commit is contained in:
Ishaan Jaff 2024-12-28 18:38:54 -08:00 committed by GitHub
parent 4825e3eee5
commit 71f5e83ed3
9 changed files with 188 additions and 373 deletions

View file

@ -118,9 +118,9 @@ async def _arealtime(
async def _realtime_health_check(
model: str,
api_base: str,
custom_llm_provider: str,
api_key: Optional[str],
api_base: Optional[str] = None,
api_version: Optional[str] = None,
):
"""
@ -143,12 +143,14 @@ async def _realtime_health_check(
url: Optional[str] = None
if custom_llm_provider == "azure":
url = azure_realtime._construct_url(
api_base=api_base,
api_base=api_base or "",
model=model,
api_version=api_version or "2024-10-01-preview",
)
elif custom_llm_provider == "openai":
url = openai_realtime._construct_url(api_base=api_base, model=model)
url = openai_realtime._construct_url(
api_base=api_base or "https://api.openai.com/", model=model
)
async with websockets.connect( # type: ignore
url,
extra_headers={