From 5ebc27fb70ffe3f437b22a227a24fc310008624d Mon Sep 17 00:00:00 2001 From: glitterlight <48169215+glitterlight@users.noreply.github.com> Date: Tue, 4 Jul 2023 21:13:56 +1000 Subject: [PATCH 1/4] fix(tokenizer): encoding issues for special characters (#53) --- src/anthropic/_tokenizers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/anthropic/_tokenizers.py b/src/anthropic/_tokenizers.py index 8f1eda0..f3effa3 100644 --- a/src/anthropic/_tokenizers.py +++ b/src/anthropic/_tokenizers.py @@ -30,7 +30,7 @@ def sync_get_tokenizer() -> Tokenizer: return _tokenizer tokenizer_path = _get_tokenizer_cache_path() - text = tokenizer_path.read_text() + text = tokenizer_path.read_text(encoding='utf-8') return _load_tokenizer(text) @@ -39,5 +39,5 @@ async def async_get_tokenizer() -> Tokenizer: return _tokenizer tokenizer_path = AsyncPath(_get_tokenizer_cache_path()) - text = await tokenizer_path.read_text() + text = await tokenizer_path.read_text(encoding='utf-8') return _load_tokenizer(text) From 7dd41e76f3be4517d87c8978ce5f2140eaf17be7 Mon Sep 17 00:00:00 2001 From: Mike Lambert Date: Wed, 5 Jul 2023 17:40:26 -0700 Subject: [PATCH 2/4] Remove trailing semicolon from README (#54) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2bddf49..5ee6974 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The new version uses separate sync and async clients, unified streaming, typed p - client = anthropic.Client(os.environ["ANTHROPIC_API_KEY"]) + client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"]) # or, simply provide an ANTHROPIC_API_KEY environment variable: -+ client = anthropic.Anthropic(); ++ client = anthropic.Anthropic() - rsp = client.completion(**params) - rsp["completion"] From 31ae135bd54bb2701d1fad4ceba7aa013c963d94 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 7 Jul 2023 16:43:53 +0100 Subject: [PATCH 3/4] fix(client): bump default request timeout to 10 minutes (#56) Bumps the default timeout for the post /v1/complete endpoint to 10 minutes to improve the experience working with large completions. --------- Co-authored-by: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> --- src/anthropic/resources/completions.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/anthropic/resources/completions.py b/src/anthropic/resources/completions.py index 0cc2dae..89b9d4d 100644 --- a/src/anthropic/resources/completions.py +++ b/src/anthropic/resources/completions.py @@ -34,7 +34,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | None | NotGiven = NOT_GIVEN, + timeout: float | None | NotGiven = 600, ) -> Completion: """ Create a completion @@ -165,7 +165,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | None | NotGiven = NOT_GIVEN, + timeout: float | None | NotGiven = 600, ) -> Stream[Completion]: """ Create a completion @@ -298,7 +298,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | None | NotGiven = NOT_GIVEN, + timeout: float | None | NotGiven = 600, ) -> Completion | Stream[Completion]: return self._post( "/v1/complete", @@ -344,7 +344,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | None | NotGiven = NOT_GIVEN, + timeout: float | None | NotGiven = 600, ) -> Completion: """ Create a completion @@ -475,7 +475,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | None | NotGiven = NOT_GIVEN, + timeout: float | None | NotGiven = 600, ) -> AsyncStream[Completion]: """ Create a completion @@ -608,7 +608,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | None | NotGiven = NOT_GIVEN, + timeout: float | None | NotGiven = 600, ) -> Completion | AsyncStream[Completion]: return await self._post( "/v1/complete", From 35328e465d5146baf3b94b6088f608c0023735e1 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 7 Jul 2023 21:45:41 +0100 Subject: [PATCH 4/4] v0.3.3 (#57) --- pyproject.toml | 2 +- src/anthropic/_version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f3359f3..fe781b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "anthropic" -version = "0.3.2" +version = "0.3.3" description = "Client library for the anthropic API" readme = "README.md" authors = ["Anthropic "] diff --git a/src/anthropic/_version.py b/src/anthropic/_version.py index 635abb1..e545225 100644 --- a/src/anthropic/_version.py +++ b/src/anthropic/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. __title__ = "anthropic" -__version__ = "0.3.1" +__version__ = "0.3.3"