Skip to content
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.93.0"
".": "0.94.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 72
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-d87d3ef6f636c667a0256be82cebef0699d17403d409c26ec15813683cfc3263.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-dfe504526eed07979685a729ac9afd45e59cc2879291714b9f4674f2ef1247c7.yml
openapi_spec_hash: d849fdf2c4dd6631a60c4340e9bc1322
config_hash: 062be10c6bf39b6719b3a5ea2bf758b3
config_hash: 831f90480c5b2b863b726e89eabaa90c
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.94.0 (2026-04-10)

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

### Features

* vertex eu region ([#1658](https://github.com/anthropics/anthropic-sdk-python/issues/1658)) ([b7e157d](https://github.com/anthropics/anthropic-sdk-python/commit/b7e157d85f50b2900ddf896e8e80882dd7311bfd))


### Bug Fixes

* ensure file data are only sent as 1 parameter ([837b25b](https://github.com/anthropics/anthropic-sdk-python/commit/837b25bb6262186a5bae92aa70eb73c3cf8c90af))


### Documentation

* improve examples ([48089fd](https://github.com/anthropics/anthropic-sdk-python/commit/48089fdb788500d00718b9d4ae24cd34e5e91beb))
* update examples ([0f3c28b](https://github.com/anthropics/anthropic-sdk-python/commit/0f3c28b973026d135f91f38c4ad82ae2b1131522))

## 0.93.0 (2026-04-09)

Full Changelog: [v0.92.0...v0.93.0](https://github.com/anthropics/anthropic-sdk-python/compare/v0.92.0...v0.93.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.93.0"
version = "0.94.0"
description = "The official Python library for the anthropic API"
dynamic = ["readme"]
license = "MIT"
Expand Down
5 changes: 3 additions & 2 deletions src/anthropic/_utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ def _extract_items(
index += 1
if is_dict(obj):
try:
# We are at the last entry in the path so we must remove the field
if (len(path)) == index:
# Remove the field if there are no more dict keys in the path,
# only "<array>" traversal markers or end.
if all(p == "<array>" for p in path[index:]):
item = obj.pop(key)
else:
item = obj[key]
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.93.0" # x-release-please-version
__version__ = "0.94.0" # x-release-please-version
2 changes: 2 additions & 0 deletions src/anthropic/lib/vertex/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def __init__(
base_url = "https://aiplatform.googleapis.com/v1"
elif region == "us":
base_url = "https://aiplatform.us.rep.googleapis.com/v1"
elif region == "eu":
base_url = "https://aiplatform.eu.rep.googleapis.com/v1"
else:
base_url = f"https://{region}-aiplatform.googleapis.com/v1"

Expand Down
32 changes: 16 additions & 16 deletions tests/api_resources/beta/test_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,11 @@ def test_method_count_tokens(self, client: Anthropic) -> None:
message = client.beta.messages.count_tokens(
messages=[
{
"content": "string",
"content": "Hello, world",
"role": "user",
}
],
model="claude-mythos-preview",
model="claude-opus-4-6",
)
assert_matches_type(BetaMessageTokensCount, message, path=["response"])

Expand All @@ -405,11 +405,11 @@ def test_method_count_tokens_with_all_params(self, client: Anthropic) -> None:
message = client.beta.messages.count_tokens(
messages=[
{
"content": "string",
"content": "Hello, world",
"role": "user",
}
],
model="claude-mythos-preview",
model="claude-opus-4-6",
cache_control={
"type": "ephemeral",
"ttl": "5m",
Expand Down Expand Up @@ -516,11 +516,11 @@ def test_raw_response_count_tokens(self, client: Anthropic) -> None:
response = client.beta.messages.with_raw_response.count_tokens(
messages=[
{
"content": "string",
"content": "Hello, world",
"role": "user",
}
],
model="claude-mythos-preview",
model="claude-opus-4-6",
)

assert response.is_closed is True
Expand All @@ -533,11 +533,11 @@ def test_streaming_response_count_tokens(self, client: Anthropic) -> None:
with client.beta.messages.with_streaming_response.count_tokens(
messages=[
{
"content": "string",
"content": "Hello, world",
"role": "user",
}
],
model="claude-mythos-preview",
model="claude-opus-4-6",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand Down Expand Up @@ -941,11 +941,11 @@ async def test_method_count_tokens(self, async_client: AsyncAnthropic) -> None:
message = await async_client.beta.messages.count_tokens(
messages=[
{
"content": "string",
"content": "Hello, world",
"role": "user",
}
],
model="claude-mythos-preview",
model="claude-opus-4-6",
)
assert_matches_type(BetaMessageTokensCount, message, path=["response"])

Expand All @@ -954,11 +954,11 @@ async def test_method_count_tokens_with_all_params(self, async_client: AsyncAnth
message = await async_client.beta.messages.count_tokens(
messages=[
{
"content": "string",
"content": "Hello, world",
"role": "user",
}
],
model="claude-mythos-preview",
model="claude-opus-4-6",
cache_control={
"type": "ephemeral",
"ttl": "5m",
Expand Down Expand Up @@ -1065,11 +1065,11 @@ async def test_raw_response_count_tokens(self, async_client: AsyncAnthropic) ->
response = await async_client.beta.messages.with_raw_response.count_tokens(
messages=[
{
"content": "string",
"content": "Hello, world",
"role": "user",
}
],
model="claude-mythos-preview",
model="claude-opus-4-6",
)

assert response.is_closed is True
Expand All @@ -1082,11 +1082,11 @@ async def test_streaming_response_count_tokens(self, async_client: AsyncAnthropi
async with async_client.beta.messages.with_streaming_response.count_tokens(
messages=[
{
"content": "string",
"content": "Hello, world",
"role": "user",
}
],
model="claude-mythos-preview",
model="claude-opus-4-6",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand Down
32 changes: 16 additions & 16 deletions tests/api_resources/test_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TestCompletions:
def test_method_create_overload_1(self, client: Anthropic) -> None:
completion = client.completions.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
)
assert_matches_type(Completion, completion, path=["response"])
Expand All @@ -30,7 +30,7 @@ def test_method_create_overload_1(self, client: Anthropic) -> None:
def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> None:
completion = client.completions.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"},
stop_sequences=["string"],
Expand All @@ -46,7 +46,7 @@ def test_method_create_with_all_params_overload_1(self, client: Anthropic) -> No
def test_raw_response_create_overload_1(self, client: Anthropic) -> None:
response = client.completions.with_raw_response.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
)

Expand All @@ -59,7 +59,7 @@ def test_raw_response_create_overload_1(self, client: Anthropic) -> None:
def test_streaming_response_create_overload_1(self, client: Anthropic) -> None:
with client.completions.with_streaming_response.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
) as response:
assert not response.is_closed
Expand All @@ -74,7 +74,7 @@ def test_streaming_response_create_overload_1(self, client: Anthropic) -> None:
def test_method_create_overload_2(self, client: Anthropic) -> None:
completion_stream = client.completions.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
stream=True,
)
Expand All @@ -84,7 +84,7 @@ def test_method_create_overload_2(self, client: Anthropic) -> None:
def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> None:
completion_stream = client.completions.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
stream=True,
metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"},
Expand All @@ -100,7 +100,7 @@ def test_method_create_with_all_params_overload_2(self, client: Anthropic) -> No
def test_raw_response_create_overload_2(self, client: Anthropic) -> None:
response = client.completions.with_raw_response.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
stream=True,
)
Expand All @@ -113,7 +113,7 @@ def test_raw_response_create_overload_2(self, client: Anthropic) -> None:
def test_streaming_response_create_overload_2(self, client: Anthropic) -> None:
with client.completions.with_streaming_response.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
stream=True,
) as response:
Expand All @@ -135,7 +135,7 @@ class TestAsyncCompletions:
async def test_method_create_overload_1(self, async_client: AsyncAnthropic) -> None:
completion = await async_client.completions.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
)
assert_matches_type(Completion, completion, path=["response"])
Expand All @@ -144,7 +144,7 @@ async def test_method_create_overload_1(self, async_client: AsyncAnthropic) -> N
async def test_method_create_with_all_params_overload_1(self, async_client: AsyncAnthropic) -> None:
completion = await async_client.completions.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"},
stop_sequences=["string"],
Expand All @@ -160,7 +160,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn
async def test_raw_response_create_overload_1(self, async_client: AsyncAnthropic) -> None:
response = await async_client.completions.with_raw_response.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
)

Expand All @@ -173,7 +173,7 @@ async def test_raw_response_create_overload_1(self, async_client: AsyncAnthropic
async def test_streaming_response_create_overload_1(self, async_client: AsyncAnthropic) -> None:
async with async_client.completions.with_streaming_response.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
) as response:
assert not response.is_closed
Expand All @@ -188,7 +188,7 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncAnt
async def test_method_create_overload_2(self, async_client: AsyncAnthropic) -> None:
completion_stream = await async_client.completions.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
stream=True,
)
Expand All @@ -198,7 +198,7 @@ async def test_method_create_overload_2(self, async_client: AsyncAnthropic) -> N
async def test_method_create_with_all_params_overload_2(self, async_client: AsyncAnthropic) -> None:
completion_stream = await async_client.completions.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
stream=True,
metadata={"user_id": "13803d75-b4b5-4c3e-b2a2-6f21399b021b"},
Expand All @@ -214,7 +214,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn
async def test_raw_response_create_overload_2(self, async_client: AsyncAnthropic) -> None:
response = await async_client.completions.with_raw_response.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
stream=True,
)
Expand All @@ -227,7 +227,7 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncAnthropic
async def test_streaming_response_create_overload_2(self, async_client: AsyncAnthropic) -> None:
async with async_client.completions.with_streaming_response.create(
max_tokens_to_sample=256,
model="claude-mythos-preview",
model="claude-2.1",
prompt="\n\nHuman: Hello, world!\n\nAssistant:",
stream=True,
) as response:
Expand Down
Loading
Loading