diff --git a/langserve/client.py b/langserve/client.py index 1dde56c6..93e23919 100644 --- a/langserve/client.py +++ b/langserve/client.py @@ -21,7 +21,7 @@ from urllib.parse import urljoin import httpx -from httpx._types import AuthTypes, CertTypes, CookieTypes, HeaderTypes, VerifyTypes +from httpx._types import AuthTypes, CertTypes, CookieTypes, HeaderTypes from langchain_core.callbacks import ( AsyncCallbackManagerForChainRun, CallbackManagerForChainRun, @@ -49,6 +49,11 @@ logger = logging.getLogger(__name__) +import typing + +if typing.TYPE_CHECKING: # We simply follow the way httpx do + import ssl + def _is_json_serializable(obj: Any) -> bool: """Return True if the object is json serializable.""" @@ -281,7 +286,7 @@ def __init__( auth: Optional[AuthTypes] = None, headers: Optional[HeaderTypes] = None, cookies: Optional[CookieTypes] = None, - verify: VerifyTypes = True, + verify: ssl.SSLContext | str | bool = True, cert: Optional[CertTypes] = None, client_kwargs: Optional[Dict[str, Any]] = None, use_server_callback_events: bool = True,