Skip to content

Commit

Permalink
update ssl verifying part to work with httpx 0.28.0 (#798)
Browse files Browse the repository at this point in the history
As the new httpx 0.28.0 removes VerifyTypes, we should update to follow
their change
See [issue](#796)

---------

Co-authored-by: Eugene Yurtsev <[email protected]>
  • Loading branch information
xxsl and eyurtsev authored Dec 19, 2024
1 parent 0ad075f commit 0d76017
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions langserve/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 0d76017

Please sign in to comment.