From df151d60469188216b662150babc5aa908ab5cd1 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Fri, 26 Jun 2026 13:46:31 -0400 Subject: [PATCH 1/2] feat(client): forward max_retries through Client/ClientV2 constructors The base BaseCohere/AsyncBaseCohere constructors accept `max_retries`, but the hand-maintained Client, AsyncClient, ClientV2 and AsyncClientV2 override constructors never exposed it, so it could not be set at the client level (only per-request via request_options). Thread `max_retries: Optional[int] = None` through all four override constructors, forwarding to the respective super().__init__. The None default preserves the existing behavior (base applies its default of 2). --- src/cohere/client.py | 4 ++++ src/cohere/client_v2.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/cohere/client.py b/src/cohere/client.py index afe643213..dfb7e59f7 100644 --- a/src/cohere/client.py +++ b/src/cohere/client.py @@ -139,6 +139,7 @@ def __init__( environment: ClientEnvironment = ClientEnvironment.PRODUCTION, client_name: typing.Optional[str] = None, timeout: typing.Optional[float] = None, + max_retries: typing.Optional[int] = None, httpx_client: typing.Optional[httpx.Client] = None, thread_pool_executor: ThreadPoolExecutor = ThreadPoolExecutor(64), log_warning_experimental_features: bool = True, @@ -157,6 +158,7 @@ def __init__( client_name=client_name, token=api_key, timeout=timeout, + max_retries=max_retries, httpx_client=httpx_client, ) @@ -386,6 +388,7 @@ def __init__( environment: ClientEnvironment = ClientEnvironment.PRODUCTION, client_name: typing.Optional[str] = None, timeout: typing.Optional[float] = None, + max_retries: typing.Optional[int] = None, httpx_client: typing.Optional[httpx.AsyncClient] = None, thread_pool_executor: ThreadPoolExecutor = ThreadPoolExecutor(64), log_warning_experimental_features: bool = True, @@ -404,6 +407,7 @@ def __init__( client_name=client_name, token=api_key, timeout=timeout, + max_retries=max_retries, httpx_client=httpx_client, ) diff --git a/src/cohere/client_v2.py b/src/cohere/client_v2.py index fa28ea3a1..5a3633bbd 100644 --- a/src/cohere/client_v2.py +++ b/src/cohere/client_v2.py @@ -38,6 +38,7 @@ def __init__( environment: ClientEnvironment = ClientEnvironment.PRODUCTION, client_name: typing.Optional[str] = None, timeout: typing.Optional[float] = None, + max_retries: typing.Optional[int] = None, httpx_client: typing.Optional[httpx.Client] = None, thread_pool_executor: ThreadPoolExecutor = ThreadPoolExecutor(64), log_warning_experimental_features: bool = True, @@ -49,6 +50,7 @@ def __init__( environment=environment, client_name=client_name, timeout=timeout, + max_retries=max_retries, httpx_client=httpx_client, thread_pool_executor=thread_pool_executor, log_warning_experimental_features=log_warning_experimental_features, @@ -71,6 +73,7 @@ def __init__( environment: ClientEnvironment = ClientEnvironment.PRODUCTION, client_name: typing.Optional[str] = None, timeout: typing.Optional[float] = None, + max_retries: typing.Optional[int] = None, httpx_client: typing.Optional[httpx.AsyncClient] = None, thread_pool_executor: ThreadPoolExecutor = ThreadPoolExecutor(64), log_warning_experimental_features: bool = True, @@ -82,6 +85,7 @@ def __init__( environment=environment, client_name=client_name, timeout=timeout, + max_retries=max_retries, httpx_client=httpx_client, thread_pool_executor=thread_pool_executor, log_warning_experimental_features=log_warning_experimental_features, From 8fa36188b7fccaa5d1301b421bf588b19faa3417 Mon Sep 17 00:00:00 2001 From: jsklan Date: Mon, 29 Jun 2026 12:10:05 -0400 Subject: [PATCH 2/2] chore: bump version 7.0.4 -> 7.0.5 --- pyproject.toml | 2 +- src/cohere/core/client_wrapper.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ade050db7..ffb37590b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ dynamic = ["version"] [tool.poetry] name = "cohere" -version = "7.0.4" +version = "7.0.5" description = "" readme = "README.md" authors = [] diff --git a/src/cohere/core/client_wrapper.py b/src/cohere/core/client_wrapper.py index 437373480..858228f69 100644 --- a/src/cohere/core/client_wrapper.py +++ b/src/cohere/core/client_wrapper.py @@ -31,12 +31,12 @@ def get_headers(self) -> typing.Dict[str, str]: import platform headers: typing.Dict[str, str] = { - "User-Agent": "cohere/7.0.4", + "User-Agent": "cohere/7.0.5", "X-Fern-Language": "Python", "X-Fern-Runtime": f"python/{platform.python_version()}", "X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}", "X-Fern-SDK-Name": "cohere", - "X-Fern-SDK-Version": "7.0.4", + "X-Fern-SDK-Version": "7.0.5", **(self.get_custom_headers() or {}), } if self._client_name is not None: