Skip to content

Commit

Permalink
Removes default timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
coessiane committed Dec 10, 2024
1 parent 5897ac5 commit 6f0ff1e
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions cohere/compass/clients/compass.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,9 @@ class RetryResult:
error: Optional[str] = None


_DEFAULT_TIMEOUT = 30


logger = logging.getLogger(__name__)


class SessionWithDefaultTimeout(requests.Session):
def __init__(self, timeout: int):
self._timeout = timeout
super().__init__()

def request(self, *args: Any, **kwargs: Any):
kwargs.setdefault("timeout", self._timeout)
return super().request(*args, **kwargs)


class CompassClient:
def __init__(
self,
Expand All @@ -89,7 +76,6 @@ def __init__(
username: Optional[str] = None,
password: Optional[str] = None,
bearer_token: Optional[str] = None,
default_timeout: int | None = None,
http_session: Optional[requests.Session] = None,
):
"""
Expand All @@ -104,12 +90,6 @@ def __init__(
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,
Expand Down

0 comments on commit 6f0ff1e

Please sign in to comment.