diff --git a/cohere/compass/clients/compass.py b/cohere/compass/clients/compass.py index 3331b4c..a9c87e2 100644 --- a/cohere/compass/clients/compass.py +++ b/cohere/compass/clients/compass.py @@ -89,7 +89,8 @@ def __init__( username: Optional[str] = None, password: Optional[str] = None, bearer_token: Optional[str] = None, - default_timeout: int = _DEFAULT_TIMEOUT, + default_timeout: int | None = None, + http_session: Optional[requests.Session] = None, ): """ A compass client to interact with the Compass API @@ -100,9 +101,15 @@ def __init__( self.index_url = index_url self.username = username or os.getenv("COHERE_COMPASS_USERNAME") self.password = password or os.getenv("COHERE_COMPASS_PASSWORD") - self.session = SessionWithDefaultTimeout(default_timeout) + self.session = http_session or requests.Session() self.bearer_token = bearer_token + if default_timeout is not None: + logger.warning( + "Please note that the `default_timeout` variable is deprecated and won't have any effect." + "To specify a timeout for HTTP requests, please specify an `http_session` with your timeout value." + ) + self.api_method = { "create_index": self.session.put, "list_indexes": self.session.get,