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.81.0"
".": "0.82.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 34
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-5387c517ad6a3b9790063962c2956476b24a17d163c68c8d091367f6db8cf4ed.yml
openapi_spec_hash: 13d3d0a8e62a955b8b4df99c18d387d0
config_hash: 4f1b01a1e5768795f83a32fb65c24c06
config_hash: 4e204fead5f0af80eb9effa1d1e34dca
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.82.0 (2026-02-18)

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

### Features

* **api:** fix shared UserLocation and error code types ([da3b931](https://github.com/anthropics/anthropic-sdk-python/commit/da3b931a2be768d77c228a4804d2f7f75caeb71c))


### Bug Fixes

* add backward-compat aliases for removed nested UserLocation classes ([#1409](https://github.com/anthropics/anthropic-sdk-python/issues/1409)) ([56db1e3](https://github.com/anthropics/anthropic-sdk-python/commit/56db1e3db6108e1c0f4e9363a5f23b54976dc877))

## 0.81.0 (2026-02-18)

Full Changelog: [v0.80.0...v0.81.0](https://github.com/anthropics/anthropic-sdk-python/compare/v0.80.0...v0.81.0)
Expand Down
2 changes: 2 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ from anthropic.types import (
URLImageSource,
URLPDFSource,
Usage,
UserLocation,
WebFetchBlock,
WebFetchBlockParam,
WebFetchTool20250910,
Expand All @@ -175,6 +176,7 @@ from anthropic.types import (
WebSearchToolResultBlockParam,
WebSearchToolResultBlockParamContent,
WebSearchToolResultError,
WebSearchToolResultErrorCode,
MessageStreamEvent,
MessageStartEvent,
MessageDeltaEvent,
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.81.0"
version = "0.82.0"
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.81.0" # x-release-please-version
__version__ = "0.82.0" # x-release-please-version
2 changes: 2 additions & 0 deletions src/anthropic/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
from .message_start_event import MessageStartEvent as MessageStartEvent
from .output_config_param import OutputConfigParam as OutputConfigParam
from .text_citation_param import TextCitationParam as TextCitationParam
from .user_location_param import UserLocationParam as UserLocationParam
from .anthropic_beta_param import AnthropicBetaParam as AnthropicBetaParam
from .beta_not_found_error import BetaNotFoundError as BetaNotFoundError
from .document_block_param import DocumentBlockParam as DocumentBlockParam
Expand Down Expand Up @@ -159,6 +160,7 @@
from .server_tool_caller_20260120_param import ServerToolCaller20260120Param as ServerToolCaller20260120Param
from .web_fetch_tool_result_block_param import WebFetchToolResultBlockParam as WebFetchToolResultBlockParam
from .web_fetch_tool_result_error_block import WebFetchToolResultErrorBlock as WebFetchToolResultErrorBlock
from .web_search_tool_result_error_code import WebSearchToolResultErrorCode as WebSearchToolResultErrorCode
from .code_execution_tool_20250522_param import CodeExecutionTool20250522Param as CodeExecutionTool20250522Param
from .code_execution_tool_20250825_param import CodeExecutionTool20250825Param as CodeExecutionTool20250825Param
from .code_execution_tool_20260120_param import CodeExecutionTool20260120Param as CodeExecutionTool20260120Param
Expand Down
28 changes: 28 additions & 0 deletions src/anthropic/types/user_location_param.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Optional
from typing_extensions import Literal, Required, TypedDict

__all__ = ["UserLocationParam"]


class UserLocationParam(TypedDict, total=False):
type: Required[Literal["approximate"]]

city: Optional[str]
"""The city of the user."""

country: Optional[str]
"""
The two letter
[ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
user.
"""

region: Optional[str]
"""The region of the user."""

timezone: Optional[str]
"""The [IANA timezone](https://nodatime.org/TimeZones) of the user."""
31 changes: 5 additions & 26 deletions src/anthropic/types/web_search_tool_20250305_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,12 @@
from typing_extensions import Literal, Required, TypedDict

from .._types import SequenceNotStr
from .user_location_param import UserLocationParam
from .cache_control_ephemeral_param import CacheControlEphemeralParam

__all__ = ["WebSearchTool20250305Param", "UserLocation"]


class UserLocation(TypedDict, total=False):
"""Parameters for the user's location.

Used to provide more relevant search results.
"""

type: Required[Literal["approximate"]]

city: Optional[str]
"""The city of the user."""

country: Optional[str]
"""
The two letter
[ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
user.
"""

region: Optional[str]
"""The region of the user."""

timezone: Optional[str]
"""The [IANA timezone](https://nodatime.org/TimeZones) of the user."""


class WebSearchTool20250305Param(TypedDict, total=False):
name: Required[Literal["web_search"]]
"""Name of the tool.
Expand Down Expand Up @@ -74,8 +50,11 @@ class WebSearchTool20250305Param(TypedDict, total=False):
strict: bool
"""When true, guarantees schema validation on tool names and inputs"""

user_location: Optional[UserLocation]
user_location: Optional[UserLocationParam]
"""Parameters for the user's location.

Used to provide more relevant search results.
"""


UserLocation = UserLocationParam # backward compat alias
31 changes: 5 additions & 26 deletions src/anthropic/types/web_search_tool_20260209_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,12 @@
from typing_extensions import Literal, Required, TypedDict

from .._types import SequenceNotStr
from .user_location_param import UserLocationParam
from .cache_control_ephemeral_param import CacheControlEphemeralParam

__all__ = ["WebSearchTool20260209Param", "UserLocation"]


class UserLocation(TypedDict, total=False):
"""Parameters for the user's location.

Used to provide more relevant search results.
"""

type: Required[Literal["approximate"]]

city: Optional[str]
"""The city of the user."""

country: Optional[str]
"""
The two letter
[ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
user.
"""

region: Optional[str]
"""The region of the user."""

timezone: Optional[str]
"""The [IANA timezone](https://nodatime.org/TimeZones) of the user."""


class WebSearchTool20260209Param(TypedDict, total=False):
name: Required[Literal["web_search"]]
"""Name of the tool.
Expand Down Expand Up @@ -74,8 +50,11 @@ class WebSearchTool20260209Param(TypedDict, total=False):
strict: bool
"""When true, guarantees schema validation on tool names and inputs"""

user_location: Optional[UserLocation]
user_location: Optional[UserLocationParam]
"""Parameters for the user's location.

Used to provide more relevant search results.
"""


UserLocation = UserLocationParam # backward compat alias
13 changes: 3 additions & 10 deletions src/anthropic/types/web_search_tool_request_error_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,12 @@

from typing_extensions import Literal, Required, TypedDict

from .web_search_tool_result_error_code import WebSearchToolResultErrorCode

__all__ = ["WebSearchToolRequestErrorParam"]


class WebSearchToolRequestErrorParam(TypedDict, total=False):
error_code: Required[
Literal[
"invalid_tool_input",
"unavailable",
"max_uses_exceeded",
"too_many_requests",
"query_too_long",
"request_too_large",
]
]
error_code: Required[WebSearchToolResultErrorCode]

type: Required[Literal["web_search_tool_result_error"]]
10 changes: 2 additions & 8 deletions src/anthropic/types/web_search_tool_result_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
from typing_extensions import Literal

from .._models import BaseModel
from .web_search_tool_result_error_code import WebSearchToolResultErrorCode

__all__ = ["WebSearchToolResultError"]


class WebSearchToolResultError(BaseModel):
error_code: Literal[
"invalid_tool_input",
"unavailable",
"max_uses_exceeded",
"too_many_requests",
"query_too_long",
"request_too_large",
]
error_code: WebSearchToolResultErrorCode

type: Literal["web_search_tool_result_error"]
9 changes: 9 additions & 0 deletions src/anthropic/types/web_search_tool_result_error_code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing_extensions import Literal, TypeAlias

__all__ = ["WebSearchToolResultErrorCode"]

WebSearchToolResultErrorCode: TypeAlias = Literal[
"invalid_tool_input", "unavailable", "max_uses_exceeded", "too_many_requests", "query_too_long", "request_too_large"
]
Loading