Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,15 @@ def _handle_request_error(self, ex: Exception) -> NoReturn:
inner_exception=ex,
) from ex

@override
def service_url(self) -> str:
"""Get the URL of the service.

Returns:
The base URL of the underlying OpenAI client, or ``"Unknown"`` if there is no client.
"""
return str(self.client.base_url) if self.client else "Unknown"

@override
def _inner_get_response(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ def test_init(openai_unit_test_env: dict[str, str]) -> None:
assert isinstance(openai_responses_client, SupportsChatGetResponse)


def test_service_url() -> None:
client = OpenAIChatClient(model="test-model", api_key="test-key", base_url="http://localhost:1234/v1")

assert client.service_url() == "http://localhost:1234/v1/"


def test_init_uses_explicit_parameters() -> None:
signature = inspect.signature(OpenAIChatClient.__init__)

Expand Down
Loading