Skip to content
Open
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
6 changes: 6 additions & 0 deletions src/openai/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,12 @@ def __init__(
custom_headers=custom_headers,
_strict_response_validation=_strict_response_validation,
)
if http_client is not None and not isinstance(cast(Any, http_client), httpx.AsyncClient):
raise TypeError(
f"Expected http_client to be an instance of httpx.AsyncClient, but got {type(http_client)} instead. "
"If you are using AsyncOpenAI, you must pass an asynchronous HTTP client."
)

self._client = http_client or AsyncHttpxClientWrapper(
base_url=base_url,
# cast to a valid type because mypy doesn't understand our type narrowing
Expand Down