Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 0.36.1 #692

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.36.0"
".": "0.36.1"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 9
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-aedee7570aa925baba404fc5bd3c8c1fffe8845517e492751db9b175c5cae9da.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-b629ddf1f1f1473462fc9bdb605abd5b7be51c3ba91c34750cd46e8404aec356.yml
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.36.1 (2024-10-15)

Full Changelog: [v0.36.0...v0.36.1](https://github.com/anthropics/anthropic-sdk-python/compare/v0.36.0...v0.36.1)

### Bug Fixes

* allow header params to override default headers ([#690](https://github.com/anthropics/anthropic-sdk-python/issues/690)) ([56f195f](https://github.com/anthropics/anthropic-sdk-python/commit/56f195ff1a67f2ba6e546ad897cbb0fe39f36a3b))
* **beta:** merge betas param with the default value ([#695](https://github.com/anthropics/anthropic-sdk-python/issues/695)) ([f52eac9](https://github.com/anthropics/anthropic-sdk-python/commit/f52eac9357c0c496f1307def2628376d8a36e5ba))


### Chores

* **internal:** update spec URL ([#694](https://github.com/anthropics/anthropic-sdk-python/issues/694)) ([1b437cc](https://github.com/anthropics/anthropic-sdk-python/commit/1b437cc40f2e02e59df06744cc1458ee0cae202a))

## 0.36.0 (2024-10-08)

Full Changelog: [v0.35.0...v0.36.0](https://github.com/anthropics/anthropic-sdk-python/compare/v0.35.0...v0.36.0)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "anthropic"
version = "0.36.0"
version = "0.36.1"
description = "The official Python library for the anthropic API"
dynamic = ["readme"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/anthropic/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "anthropic"
__version__ = "0.36.0" # x-release-please-version
__version__ = "0.36.1" # x-release-please-version
101 changes: 81 additions & 20 deletions src/anthropic/resources/beta/messages/batches.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

from typing import List, Iterable
from itertools import chain

import httpx

Expand Down Expand Up @@ -81,11 +82,17 @@ def create(

timeout: Override the client-level default timeout for this request, in seconds
"""
extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(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 {})}
return self._post(
"/v1/messages/batches?beta=true",
body=maybe_transform({"requests": requests}, batch_create_params.BatchCreateParams),
Expand Down Expand Up @@ -128,11 +135,17 @@ 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 = {"anthropic-beta": "message-batches-2024-09-24", **(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 {})}
return self._get(
f"/v1/messages/batches/{message_batch_id}?beta=true",
options=make_request_options(
Expand Down Expand Up @@ -179,11 +192,17 @@ def list(

timeout: Override the client-level default timeout for this request, in seconds
"""
extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(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 {})}
return self._get_api_list(
"/v1/messages/batches?beta=true",
page=SyncPage[BetaMessageBatch],
Expand Down Expand Up @@ -236,11 +255,17 @@ 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 = {"anthropic-beta": "message-batches-2024-09-24", **(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 {})}
return self._post(
f"/v1/messages/batches/{message_batch_id}/cancel?beta=true",
options=make_request_options(
Expand Down Expand Up @@ -290,12 +315,18 @@ def results(
f"No `results_url` for the given batch; Has it finished processing? {batch.processing_status}"
)

extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(extra_headers or {})}
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 {})}
return self._get(
batch.results_url,
options=make_request_options(
Expand Down Expand Up @@ -358,11 +389,17 @@ async def create(

timeout: Override the client-level default timeout for this request, in seconds
"""
extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(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 {})}
return await self._post(
"/v1/messages/batches?beta=true",
body=await async_maybe_transform({"requests": requests}, batch_create_params.BatchCreateParams),
Expand Down Expand Up @@ -405,11 +442,17 @@ 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 = {"anthropic-beta": "message-batches-2024-09-24", **(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 {})}
return await self._get(
f"/v1/messages/batches/{message_batch_id}?beta=true",
options=make_request_options(
Expand Down Expand Up @@ -456,11 +499,17 @@ def list(

timeout: Override the client-level default timeout for this request, in seconds
"""
extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(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 {})}
return self._get_api_list(
"/v1/messages/batches?beta=true",
page=AsyncPage[BetaMessageBatch],
Expand Down Expand Up @@ -513,11 +562,17 @@ 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 = {"anthropic-beta": "message-batches-2024-09-24", **(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 {})}
return await self._post(
f"/v1/messages/batches/{message_batch_id}/cancel?beta=true",
options=make_request_options(
Expand Down Expand Up @@ -567,12 +622,18 @@ async def results(
f"No `results_url` for the given batch; Has it finished processing? {batch.processing_status}"
)

extra_headers = {"anthropic-beta": "message-batches-2024-09-24", **(extra_headers or {})}
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 {})}
return await self._get(
batch.results_url,
options=make_request_options(
Expand Down
21 changes: 17 additions & 4 deletions src/anthropic/resources/beta/prompt_caching/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from typing import List, Union, Iterable
from functools import partial
from itertools import chain
from typing_extensions import Literal, overload

import httpx
Expand Down Expand Up @@ -878,11 +879,17 @@ def create(
) -> PromptCachingBetaMessage | Stream[RawPromptCachingBetaMessageStreamEvent]:
if not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT:
timeout = 600
extra_headers = {"anthropic-beta": "prompt-caching-2024-07-31", **(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), ["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 {})}
return self._post(
"/v1/messages?beta=prompt_caching",
body=maybe_transform(
Expand Down Expand Up @@ -1808,11 +1815,17 @@ async def create(
) -> PromptCachingBetaMessage | AsyncStream[RawPromptCachingBetaMessageStreamEvent]:
if not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT:
timeout = 600
extra_headers = {"anthropic-beta": "prompt-caching-2024-07-31", **(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), ["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 {})}
return await self._post(
"/v1/messages?beta=prompt_caching",
body=await async_maybe_transform(
Expand Down
Loading