diff --git a/.stats.yml b/.stats.yml index 70f28c76..150fc433 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 9 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-c7baafa4b7d58ae2b830c0d5b89248e98421c8a7cf135b7e62e6e215fa94c7f4.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-b629ddf1f1f1473462fc9bdb605abd5b7be51c3ba91c34750cd46e8404aec356.yml diff --git a/src/anthropic/resources/beta/messages/batches.py b/src/anthropic/resources/beta/messages/batches.py index 897445e5..045c0580 100644 --- a/src/anthropic/resources/beta/messages/batches.py +++ b/src/anthropic/resources/beta/messages/batches.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import List, Iterable +from itertools import chain import httpx @@ -90,7 +91,13 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}), + **strip_not_given( + { + "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) + if is_given(betas) + else NOT_GIVEN + } + ), **(extra_headers or {}), } extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(extra_headers or {})} @@ -137,7 +144,13 @@ def retrieve( if not message_batch_id: raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}), + **strip_not_given( + { + "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) + if is_given(betas) + else NOT_GIVEN + } + ), **(extra_headers or {}), } extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(extra_headers or {})} @@ -188,7 +201,13 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}), + **strip_not_given( + { + "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) + if is_given(betas) + else NOT_GIVEN + } + ), **(extra_headers or {}), } extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(extra_headers or {})} @@ -245,7 +264,13 @@ def cancel( if not message_batch_id: raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}), + **strip_not_given( + { + "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) + if is_given(betas) + else NOT_GIVEN + } + ), **(extra_headers or {}), } extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(extra_headers or {})} @@ -293,7 +318,13 @@ def results( raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") extra_headers = {"Accept": "application/binary", **(extra_headers or {})} extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}), + **strip_not_given( + { + "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) + if is_given(betas) + else NOT_GIVEN + } + ), **(extra_headers or {}), } extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(extra_headers or {})} @@ -359,7 +390,13 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}), + **strip_not_given( + { + "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) + if is_given(betas) + else NOT_GIVEN + } + ), **(extra_headers or {}), } extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(extra_headers or {})} @@ -406,7 +443,13 @@ async def retrieve( if not message_batch_id: raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}), + **strip_not_given( + { + "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) + if is_given(betas) + else NOT_GIVEN + } + ), **(extra_headers or {}), } extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(extra_headers or {})} @@ -457,7 +500,13 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}), + **strip_not_given( + { + "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) + if is_given(betas) + else NOT_GIVEN + } + ), **(extra_headers or {}), } extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(extra_headers or {})} @@ -514,7 +563,13 @@ async def cancel( if not message_batch_id: raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}), + **strip_not_given( + { + "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) + if is_given(betas) + else NOT_GIVEN + } + ), **(extra_headers or {}), } extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(extra_headers or {})} @@ -562,7 +617,13 @@ async def results( raise ValueError(f"Expected a non-empty value for `message_batch_id` but received {message_batch_id!r}") extra_headers = {"Accept": "application/binary", **(extra_headers or {})} extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}), + **strip_not_given( + { + "anthropic-beta": ",".join(chain((str(e) for e in betas), ["message-batches-2024-09-24"])) + if is_given(betas) + else NOT_GIVEN + } + ), **(extra_headers or {}), } extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(extra_headers or {})} diff --git a/src/anthropic/resources/beta/prompt_caching/messages.py b/src/anthropic/resources/beta/prompt_caching/messages.py index 7ce96c2e..522e9d37 100644 --- a/src/anthropic/resources/beta/prompt_caching/messages.py +++ b/src/anthropic/resources/beta/prompt_caching/messages.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import List, Union, Iterable +from itertools import chain from typing_extensions import Literal, overload import httpx @@ -877,7 +878,13 @@ def create( if not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT: timeout = 600 extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}), + **strip_not_given( + { + "anthropic-beta": ",".join(chain((str(e) for e in betas), ["prompt-caching-2024-07-31"])) + if is_given(betas) + else NOT_GIVEN + } + ), **(extra_headers or {}), } extra_headers = {"anthropic-beta": "prompt-caching-2024-07-31", **(extra_headers or {})} @@ -1748,7 +1755,13 @@ async def create( if not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT: timeout = 600 extra_headers = { - **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}), + **strip_not_given( + { + "anthropic-beta": ",".join(chain((str(e) for e in betas), ["prompt-caching-2024-07-31"])) + if is_given(betas) + else NOT_GIVEN + } + ), **(extra_headers or {}), } extra_headers = {"anthropic-beta": "prompt-caching-2024-07-31", **(extra_headers or {})}