mirror of
https://github.com/livekit/agents.git
synced 2026-12-06 04:08:35 +00:00
26 lines
773 B
Python
26 lines
773 B
Python
from __future__ import annotations
|
|
|
|
from collections.abc import Callable
|
|
|
|
import httpx2 as httpx
|
|
import pytest
|
|
|
|
from livekit.plugins import anthropic, openai
|
|
|
|
pytestmark = pytest.mark.unit
|
|
|
|
|
|
class PublicSDKClient:
|
|
base_url = httpx.URL("https://provider.example:8443/v1")
|
|
|
|
|
|
@pytest.mark.parametrize("factory", [openai.STT, openai.TTS, anthropic.LLM])
|
|
def test_provider_identity_uses_the_sdk_public_base_url(factory: Callable) -> None:
|
|
model = factory(api_key="test", client=PublicSDKClient())
|
|
assert model.provider == "provider.example:8443"
|
|
|
|
|
|
def test_a_native_openai_compatible_llm_is_named_by_its_base_url_host() -> None:
|
|
model = openai.LLM(api_key="test", base_url="https://provider.example:8443/v1")
|
|
assert model.provider == "provider.example:8443"
|