caikit.runtime.client.utils
Helper utils for GRPC and HTTP connections
Functions
|
Helper function to construct a grpc Channel with the given TLS config |
|
Helper function to construct a requests Session object with the given TLS |
Module Contents
- caikit.runtime.client.utils.construct_grpc_channel(target: str, options: List[Tuple[str, str]] | None = None, tls: caikit.interfaces.common.data_model.ConnectionTlsInfo | None = None, retries: int | None = None, retry_options: Dict[str, str] | None = None) grpc.Channel[source]
Helper function to construct a grpc Channel with the given TLS config
- Args:
target (str): The target hostname options (Optional[List[Tuple[str, str]]], optional): List of tuples representing GRPC
options. Defaults to None.
- tls (Optional[ConnectionTlsInfo], optional): The TLS information for this channel.
Defaults to None.
retries (Optional[int], optional): The max number of retries to attempt. Defaults to None. retry_options (Optional[Dict[str, str]], optional): Dictionary to override fields
in the GRPC retry service config. Defaults to None.
- Returns:
grpc.Channel: The constructed channel
- caikit.runtime.client.utils.construct_requests_session(options: Dict[str, str] | None = None, tls: caikit.interfaces.common.data_model.ConnectionTlsInfo | None = None, timeout: int | None = None, retries: int | None = None, retry_options: Dict[str, str] | None = None) requests.Session[source]
Helper function to construct a requests Session object with the given TLS config
- Args:
- options (Optional[Dict[str, str]], optional): Dictionary of request kwargs to pass to
session creation. Defaults to None.
- tls (Optional[ConnectionTlsInfo], optional): The TLS information for this session.
Defaults to None.
retries (Optional[int], optional): The max number of retries to attempt. Defaults to None. retry_options (Optional[Dict[str, str]], optional): Dictionary to override kwargs passed
to the Retry object construction
- Returns:
Session: _description_