diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f8e21778..f24634e6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.81.0" + ".": "0.82.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index dee17896..f1589dd2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f220e05..354045dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/api.md b/api.md index 1e631853..a248f838 100644 --- a/api.md +++ b/api.md @@ -156,6 +156,7 @@ from anthropic.types import ( URLImageSource, URLPDFSource, Usage, + UserLocation, WebFetchBlock, WebFetchBlockParam, WebFetchTool20250910, @@ -175,6 +176,7 @@ from anthropic.types import ( WebSearchToolResultBlockParam, WebSearchToolResultBlockParamContent, WebSearchToolResultError, + WebSearchToolResultErrorCode, MessageStreamEvent, MessageStartEvent, MessageDeltaEvent, diff --git a/pyproject.toml b/pyproject.toml index f29687bf..63c7ab17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/src/anthropic/_version.py b/src/anthropic/_version.py index 624cc2aa..abf5e925 100644 --- a/src/anthropic/_version.py +++ b/src/anthropic/_version.py @@ -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 diff --git a/src/anthropic/types/__init__.py b/src/anthropic/types/__init__.py index faea3f95..50db66c7 100644 --- a/src/anthropic/types/__init__.py +++ b/src/anthropic/types/__init__.py @@ -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 @@ -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 diff --git a/src/anthropic/types/user_location_param.py b/src/anthropic/types/user_location_param.py new file mode 100644 index 00000000..b83daef4 --- /dev/null +++ b/src/anthropic/types/user_location_param.py @@ -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.""" diff --git a/src/anthropic/types/web_search_tool_20250305_param.py b/src/anthropic/types/web_search_tool_20250305_param.py index d2de4590..ecbdca1e 100644 --- a/src/anthropic/types/web_search_tool_20250305_param.py +++ b/src/anthropic/types/web_search_tool_20250305_param.py @@ -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. @@ -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 diff --git a/src/anthropic/types/web_search_tool_20260209_param.py b/src/anthropic/types/web_search_tool_20260209_param.py index be8fe3f3..7bf62f39 100644 --- a/src/anthropic/types/web_search_tool_20260209_param.py +++ b/src/anthropic/types/web_search_tool_20260209_param.py @@ -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. @@ -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 diff --git a/src/anthropic/types/web_search_tool_request_error_param.py b/src/anthropic/types/web_search_tool_request_error_param.py index 2e1964ab..fcbc62c5 100644 --- a/src/anthropic/types/web_search_tool_request_error_param.py +++ b/src/anthropic/types/web_search_tool_request_error_param.py @@ -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"]] diff --git a/src/anthropic/types/web_search_tool_result_error.py b/src/anthropic/types/web_search_tool_result_error.py index 5265b183..90a93dd0 100644 --- a/src/anthropic/types/web_search_tool_result_error.py +++ b/src/anthropic/types/web_search_tool_result_error.py @@ -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"] diff --git a/src/anthropic/types/web_search_tool_result_error_code.py b/src/anthropic/types/web_search_tool_result_error_code.py new file mode 100644 index 00000000..09148c73 --- /dev/null +++ b/src/anthropic/types/web_search_tool_result_error_code.py @@ -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" +]