anthropic 0.66.0__py3-none-any.whl → 0.68.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- anthropic/__init__.py +3 -0
- anthropic/_base_client.py +3 -3
- anthropic/_compat.py +48 -48
- anthropic/_models.py +54 -45
- anthropic/_utils/__init__.py +8 -2
- anthropic/_utils/_compat.py +45 -0
- anthropic/_utils/_datetime_parse.py +136 -0
- anthropic/_utils/_transform.py +5 -1
- anthropic/_utils/_typing.py +1 -1
- anthropic/_utils/_utils.py +0 -1
- anthropic/_version.py +1 -1
- anthropic/lib/tools/__init__.py +20 -0
- anthropic/lib/tools/_beta_functions.py +289 -0
- anthropic/lib/tools/_beta_runner.py +405 -0
- anthropic/resources/beta/messages/messages.py +370 -1
- anthropic/types/beta/__init__.py +14 -0
- anthropic/types/beta/beta_base64_pdf_source.py +15 -0
- anthropic/types/beta/beta_citation_config.py +9 -0
- anthropic/types/beta/beta_content_block.py +2 -0
- anthropic/types/beta/beta_content_block_param.py +4 -0
- anthropic/types/beta/beta_document_block.py +26 -0
- anthropic/types/beta/beta_plain_text_source.py +15 -0
- anthropic/types/beta/beta_raw_content_block_start_event.py +2 -0
- anthropic/types/beta/beta_request_document_block_param.py +1 -1
- anthropic/types/beta/beta_server_tool_usage.py +3 -0
- anthropic/types/beta/beta_server_tool_use_block.py +1 -1
- anthropic/types/beta/beta_server_tool_use_block_param.py +3 -1
- anthropic/types/beta/beta_tool_union_param.py +2 -0
- anthropic/types/beta/beta_web_fetch_block.py +21 -0
- anthropic/types/beta/beta_web_fetch_block_param.py +22 -0
- anthropic/types/beta/beta_web_fetch_tool_20250910_param.py +46 -0
- anthropic/types/beta/beta_web_fetch_tool_result_block.py +20 -0
- anthropic/types/beta/beta_web_fetch_tool_result_block_param.py +25 -0
- anthropic/types/beta/beta_web_fetch_tool_result_error_block.py +14 -0
- anthropic/types/beta/beta_web_fetch_tool_result_error_block_param.py +15 -0
- anthropic/types/beta/beta_web_fetch_tool_result_error_code.py +16 -0
- anthropic/types/beta/message_count_tokens_params.py +2 -0
- anthropic/types/document_block_param.py +1 -1
- {anthropic-0.66.0.dist-info → anthropic-0.68.0.dist-info}/METADATA +51 -1
- {anthropic-0.66.0.dist-info → anthropic-0.68.0.dist-info}/RECORD +42 -25
- {anthropic-0.66.0.dist-info → anthropic-0.68.0.dist-info}/WHEEL +0 -0
- {anthropic-0.66.0.dist-info → anthropic-0.68.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import warnings
|
|
6
|
-
from typing import List, Union, Iterable, Optional
|
|
6
|
+
from typing import TYPE_CHECKING, Any, List, Union, Iterable, Optional, cast
|
|
7
7
|
from functools import partial
|
|
8
8
|
from itertools import chain
|
|
9
9
|
from typing_extensions import Literal, overload
|
|
@@ -24,6 +24,14 @@ from ...._utils import is_given, required_args, maybe_transform, strip_not_given
|
|
|
24
24
|
from ...._compat import cached_property
|
|
25
25
|
from ...._resource import SyncAPIResource, AsyncAPIResource
|
|
26
26
|
from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
|
|
27
|
+
from ....lib.tools import (
|
|
28
|
+
BetaToolRunner,
|
|
29
|
+
BetaFunctionTool,
|
|
30
|
+
BetaAsyncToolRunner,
|
|
31
|
+
BetaAsyncFunctionTool,
|
|
32
|
+
BetaStreamingToolRunner,
|
|
33
|
+
BetaAsyncStreamingToolRunner,
|
|
34
|
+
)
|
|
27
35
|
from ...._constants import DEFAULT_TIMEOUT, MODEL_NONSTREAMING_TOKENS
|
|
28
36
|
from ...._streaming import Stream, AsyncStream
|
|
29
37
|
from ....types.beta import (
|
|
@@ -47,6 +55,9 @@ from ....types.beta.beta_thinking_config_param import BetaThinkingConfigParam
|
|
|
47
55
|
from ....types.beta.beta_raw_message_stream_event import BetaRawMessageStreamEvent
|
|
48
56
|
from ....types.beta.beta_request_mcp_server_url_definition_param import BetaRequestMCPServerURLDefinitionParam
|
|
49
57
|
|
|
58
|
+
if TYPE_CHECKING:
|
|
59
|
+
from ...._client import Anthropic, AsyncAnthropic
|
|
60
|
+
|
|
50
61
|
__all__ = ["Messages", "AsyncMessages"]
|
|
51
62
|
|
|
52
63
|
|
|
@@ -982,6 +993,185 @@ class Messages(SyncAPIResource):
|
|
|
982
993
|
stream_cls=Stream[BetaRawMessageStreamEvent],
|
|
983
994
|
)
|
|
984
995
|
|
|
996
|
+
@overload
|
|
997
|
+
def tool_runner(
|
|
998
|
+
self,
|
|
999
|
+
*,
|
|
1000
|
+
max_tokens: int,
|
|
1001
|
+
messages: Iterable[BetaMessageParam],
|
|
1002
|
+
model: ModelParam,
|
|
1003
|
+
tools: Iterable[BetaFunctionTool[Any]],
|
|
1004
|
+
max_iterations: int | NotGiven = NOT_GIVEN,
|
|
1005
|
+
container: Optional[str] | NotGiven = NOT_GIVEN,
|
|
1006
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | NotGiven = NOT_GIVEN,
|
|
1007
|
+
metadata: BetaMetadataParam | NotGiven = NOT_GIVEN,
|
|
1008
|
+
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
1009
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
1010
|
+
stream: Literal[False] | NotGiven = NOT_GIVEN,
|
|
1011
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
1012
|
+
temperature: float | NotGiven = NOT_GIVEN,
|
|
1013
|
+
top_k: int | NotGiven = NOT_GIVEN,
|
|
1014
|
+
top_p: float | NotGiven = NOT_GIVEN,
|
|
1015
|
+
thinking: BetaThinkingConfigParam | NotGiven = NOT_GIVEN,
|
|
1016
|
+
tool_choice: BetaToolChoiceParam | NotGiven = NOT_GIVEN,
|
|
1017
|
+
betas: List[AnthropicBetaParam] | NotGiven = NOT_GIVEN,
|
|
1018
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1019
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1020
|
+
extra_headers: Headers | None = None,
|
|
1021
|
+
extra_query: Query | None = None,
|
|
1022
|
+
extra_body: Body | None = None,
|
|
1023
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1024
|
+
) -> BetaToolRunner: ...
|
|
1025
|
+
|
|
1026
|
+
@overload
|
|
1027
|
+
def tool_runner(
|
|
1028
|
+
self,
|
|
1029
|
+
*,
|
|
1030
|
+
max_tokens: int,
|
|
1031
|
+
messages: Iterable[BetaMessageParam],
|
|
1032
|
+
model: ModelParam,
|
|
1033
|
+
tools: Iterable[BetaFunctionTool[Any]],
|
|
1034
|
+
stream: Literal[True],
|
|
1035
|
+
max_iterations: int | NotGiven = NOT_GIVEN,
|
|
1036
|
+
container: Optional[str] | NotGiven = NOT_GIVEN,
|
|
1037
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | NotGiven = NOT_GIVEN,
|
|
1038
|
+
metadata: BetaMetadataParam | NotGiven = NOT_GIVEN,
|
|
1039
|
+
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
1040
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
1041
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
1042
|
+
temperature: float | NotGiven = NOT_GIVEN,
|
|
1043
|
+
top_k: int | NotGiven = NOT_GIVEN,
|
|
1044
|
+
top_p: float | NotGiven = NOT_GIVEN,
|
|
1045
|
+
thinking: BetaThinkingConfigParam | NotGiven = NOT_GIVEN,
|
|
1046
|
+
tool_choice: BetaToolChoiceParam | NotGiven = NOT_GIVEN,
|
|
1047
|
+
betas: List[AnthropicBetaParam] | NotGiven = NOT_GIVEN,
|
|
1048
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1049
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1050
|
+
extra_headers: Headers | None = None,
|
|
1051
|
+
extra_query: Query | None = None,
|
|
1052
|
+
extra_body: Body | None = None,
|
|
1053
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1054
|
+
) -> BetaStreamingToolRunner: ...
|
|
1055
|
+
|
|
1056
|
+
@overload
|
|
1057
|
+
def tool_runner(
|
|
1058
|
+
self,
|
|
1059
|
+
*,
|
|
1060
|
+
max_tokens: int,
|
|
1061
|
+
messages: Iterable[BetaMessageParam],
|
|
1062
|
+
model: ModelParam,
|
|
1063
|
+
tools: Iterable[BetaFunctionTool[Any]],
|
|
1064
|
+
stream: bool,
|
|
1065
|
+
max_iterations: int | NotGiven = NOT_GIVEN,
|
|
1066
|
+
container: Optional[str] | NotGiven = NOT_GIVEN,
|
|
1067
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | NotGiven = NOT_GIVEN,
|
|
1068
|
+
metadata: BetaMetadataParam | NotGiven = NOT_GIVEN,
|
|
1069
|
+
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
1070
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
1071
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
1072
|
+
temperature: float | NotGiven = NOT_GIVEN,
|
|
1073
|
+
top_k: int | NotGiven = NOT_GIVEN,
|
|
1074
|
+
top_p: float | NotGiven = NOT_GIVEN,
|
|
1075
|
+
thinking: BetaThinkingConfigParam | NotGiven = NOT_GIVEN,
|
|
1076
|
+
tool_choice: BetaToolChoiceParam | NotGiven = NOT_GIVEN,
|
|
1077
|
+
betas: List[AnthropicBetaParam] | NotGiven = NOT_GIVEN,
|
|
1078
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1079
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1080
|
+
extra_headers: Headers | None = None,
|
|
1081
|
+
extra_query: Query | None = None,
|
|
1082
|
+
extra_body: Body | None = None,
|
|
1083
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1084
|
+
) -> BetaStreamingToolRunner | BetaToolRunner: ...
|
|
1085
|
+
|
|
1086
|
+
def tool_runner(
|
|
1087
|
+
self,
|
|
1088
|
+
*,
|
|
1089
|
+
max_tokens: int,
|
|
1090
|
+
messages: Iterable[BetaMessageParam],
|
|
1091
|
+
model: ModelParam,
|
|
1092
|
+
tools: Iterable[BetaFunctionTool[Any]],
|
|
1093
|
+
max_iterations: int | NotGiven = NOT_GIVEN,
|
|
1094
|
+
container: Optional[str] | NotGiven = NOT_GIVEN,
|
|
1095
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | NotGiven = NOT_GIVEN,
|
|
1096
|
+
metadata: BetaMetadataParam | NotGiven = NOT_GIVEN,
|
|
1097
|
+
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
1098
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
1099
|
+
stream: bool | NotGiven = NOT_GIVEN,
|
|
1100
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
1101
|
+
temperature: float | NotGiven = NOT_GIVEN,
|
|
1102
|
+
top_k: int | NotGiven = NOT_GIVEN,
|
|
1103
|
+
top_p: float | NotGiven = NOT_GIVEN,
|
|
1104
|
+
thinking: BetaThinkingConfigParam | NotGiven = NOT_GIVEN,
|
|
1105
|
+
tool_choice: BetaToolChoiceParam | NotGiven = NOT_GIVEN,
|
|
1106
|
+
betas: List[AnthropicBetaParam] | NotGiven = NOT_GIVEN,
|
|
1107
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1108
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1109
|
+
extra_headers: Headers | None = None,
|
|
1110
|
+
extra_query: Query | None = None,
|
|
1111
|
+
extra_body: Body | None = None,
|
|
1112
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1113
|
+
) -> BetaToolRunner | BetaStreamingToolRunner:
|
|
1114
|
+
"""Create a Message stream"""
|
|
1115
|
+
if model in DEPRECATED_MODELS:
|
|
1116
|
+
warnings.warn(
|
|
1117
|
+
f"The model '{model}' is deprecated and will reach end-of-life on {DEPRECATED_MODELS[model]}.\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.",
|
|
1118
|
+
DeprecationWarning,
|
|
1119
|
+
stacklevel=3,
|
|
1120
|
+
)
|
|
1121
|
+
|
|
1122
|
+
extra_headers = {
|
|
1123
|
+
"X-Stainless-Helper": "beta.messages.tool_runner",
|
|
1124
|
+
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}),
|
|
1125
|
+
**(extra_headers or {}),
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
params = cast(
|
|
1129
|
+
message_create_params.MessageCreateParamsNonStreaming,
|
|
1130
|
+
{
|
|
1131
|
+
"max_tokens": max_tokens,
|
|
1132
|
+
"messages": messages,
|
|
1133
|
+
"model": model,
|
|
1134
|
+
"container": container,
|
|
1135
|
+
"mcp_servers": mcp_servers,
|
|
1136
|
+
"metadata": metadata,
|
|
1137
|
+
"service_tier": service_tier,
|
|
1138
|
+
"stop_sequences": stop_sequences,
|
|
1139
|
+
"system": system,
|
|
1140
|
+
"temperature": temperature,
|
|
1141
|
+
"thinking": thinking,
|
|
1142
|
+
"tool_choice": tool_choice,
|
|
1143
|
+
"tools": [tool.to_dict() for tool in tools],
|
|
1144
|
+
"top_k": top_k,
|
|
1145
|
+
"top_p": top_p,
|
|
1146
|
+
},
|
|
1147
|
+
)
|
|
1148
|
+
|
|
1149
|
+
if stream:
|
|
1150
|
+
return BetaStreamingToolRunner(
|
|
1151
|
+
tools=tools,
|
|
1152
|
+
params=params,
|
|
1153
|
+
options={
|
|
1154
|
+
"extra_headers": extra_headers,
|
|
1155
|
+
"extra_query": extra_query,
|
|
1156
|
+
"extra_body": extra_body,
|
|
1157
|
+
"timeout": timeout,
|
|
1158
|
+
},
|
|
1159
|
+
client=cast("Anthropic", self._client),
|
|
1160
|
+
max_iterations=max_iterations if is_given(max_iterations) else None,
|
|
1161
|
+
)
|
|
1162
|
+
return BetaToolRunner(
|
|
1163
|
+
tools=tools,
|
|
1164
|
+
params=params,
|
|
1165
|
+
options={
|
|
1166
|
+
"extra_headers": extra_headers,
|
|
1167
|
+
"extra_query": extra_query,
|
|
1168
|
+
"extra_body": extra_body,
|
|
1169
|
+
"timeout": timeout,
|
|
1170
|
+
},
|
|
1171
|
+
client=cast("Anthropic", self._client),
|
|
1172
|
+
max_iterations=max_iterations if is_given(max_iterations) else None,
|
|
1173
|
+
)
|
|
1174
|
+
|
|
985
1175
|
def stream(
|
|
986
1176
|
self,
|
|
987
1177
|
*,
|
|
@@ -2223,6 +2413,185 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2223
2413
|
stream_cls=AsyncStream[BetaRawMessageStreamEvent],
|
|
2224
2414
|
)
|
|
2225
2415
|
|
|
2416
|
+
@overload
|
|
2417
|
+
def tool_runner(
|
|
2418
|
+
self,
|
|
2419
|
+
*,
|
|
2420
|
+
max_tokens: int,
|
|
2421
|
+
messages: Iterable[BetaMessageParam],
|
|
2422
|
+
model: ModelParam,
|
|
2423
|
+
tools: Iterable[BetaAsyncFunctionTool[Any]],
|
|
2424
|
+
max_iterations: int | NotGiven = NOT_GIVEN,
|
|
2425
|
+
container: Optional[str] | NotGiven = NOT_GIVEN,
|
|
2426
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | NotGiven = NOT_GIVEN,
|
|
2427
|
+
metadata: BetaMetadataParam | NotGiven = NOT_GIVEN,
|
|
2428
|
+
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
2429
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
2430
|
+
stream: Literal[False] | NotGiven = NOT_GIVEN,
|
|
2431
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
2432
|
+
temperature: float | NotGiven = NOT_GIVEN,
|
|
2433
|
+
top_k: int | NotGiven = NOT_GIVEN,
|
|
2434
|
+
top_p: float | NotGiven = NOT_GIVEN,
|
|
2435
|
+
thinking: BetaThinkingConfigParam | NotGiven = NOT_GIVEN,
|
|
2436
|
+
tool_choice: BetaToolChoiceParam | NotGiven = NOT_GIVEN,
|
|
2437
|
+
betas: List[AnthropicBetaParam] | NotGiven = NOT_GIVEN,
|
|
2438
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2439
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2440
|
+
extra_headers: Headers | None = None,
|
|
2441
|
+
extra_query: Query | None = None,
|
|
2442
|
+
extra_body: Body | None = None,
|
|
2443
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2444
|
+
) -> BetaAsyncToolRunner: ...
|
|
2445
|
+
|
|
2446
|
+
@overload
|
|
2447
|
+
def tool_runner(
|
|
2448
|
+
self,
|
|
2449
|
+
*,
|
|
2450
|
+
max_tokens: int,
|
|
2451
|
+
messages: Iterable[BetaMessageParam],
|
|
2452
|
+
model: ModelParam,
|
|
2453
|
+
tools: Iterable[BetaAsyncFunctionTool[Any]],
|
|
2454
|
+
stream: Literal[True],
|
|
2455
|
+
max_iterations: int | NotGiven = NOT_GIVEN,
|
|
2456
|
+
container: Optional[str] | NotGiven = NOT_GIVEN,
|
|
2457
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | NotGiven = NOT_GIVEN,
|
|
2458
|
+
metadata: BetaMetadataParam | NotGiven = NOT_GIVEN,
|
|
2459
|
+
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
2460
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
2461
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
2462
|
+
temperature: float | NotGiven = NOT_GIVEN,
|
|
2463
|
+
top_k: int | NotGiven = NOT_GIVEN,
|
|
2464
|
+
top_p: float | NotGiven = NOT_GIVEN,
|
|
2465
|
+
thinking: BetaThinkingConfigParam | NotGiven = NOT_GIVEN,
|
|
2466
|
+
tool_choice: BetaToolChoiceParam | NotGiven = NOT_GIVEN,
|
|
2467
|
+
betas: List[AnthropicBetaParam] | NotGiven = NOT_GIVEN,
|
|
2468
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2469
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2470
|
+
extra_headers: Headers | None = None,
|
|
2471
|
+
extra_query: Query | None = None,
|
|
2472
|
+
extra_body: Body | None = None,
|
|
2473
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2474
|
+
) -> BetaAsyncStreamingToolRunner: ...
|
|
2475
|
+
|
|
2476
|
+
@overload
|
|
2477
|
+
def tool_runner(
|
|
2478
|
+
self,
|
|
2479
|
+
*,
|
|
2480
|
+
max_tokens: int,
|
|
2481
|
+
messages: Iterable[BetaMessageParam],
|
|
2482
|
+
model: ModelParam,
|
|
2483
|
+
tools: Iterable[BetaAsyncFunctionTool[Any]],
|
|
2484
|
+
stream: bool,
|
|
2485
|
+
max_iterations: int | NotGiven = NOT_GIVEN,
|
|
2486
|
+
container: Optional[str] | NotGiven = NOT_GIVEN,
|
|
2487
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | NotGiven = NOT_GIVEN,
|
|
2488
|
+
metadata: BetaMetadataParam | NotGiven = NOT_GIVEN,
|
|
2489
|
+
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
2490
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
2491
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
2492
|
+
temperature: float | NotGiven = NOT_GIVEN,
|
|
2493
|
+
top_k: int | NotGiven = NOT_GIVEN,
|
|
2494
|
+
top_p: float | NotGiven = NOT_GIVEN,
|
|
2495
|
+
thinking: BetaThinkingConfigParam | NotGiven = NOT_GIVEN,
|
|
2496
|
+
tool_choice: BetaToolChoiceParam | NotGiven = NOT_GIVEN,
|
|
2497
|
+
betas: List[AnthropicBetaParam] | NotGiven = NOT_GIVEN,
|
|
2498
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2499
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2500
|
+
extra_headers: Headers | None = None,
|
|
2501
|
+
extra_query: Query | None = None,
|
|
2502
|
+
extra_body: Body | None = None,
|
|
2503
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2504
|
+
) -> BetaAsyncStreamingToolRunner | BetaAsyncToolRunner: ...
|
|
2505
|
+
|
|
2506
|
+
def tool_runner(
|
|
2507
|
+
self,
|
|
2508
|
+
*,
|
|
2509
|
+
max_tokens: int,
|
|
2510
|
+
messages: Iterable[BetaMessageParam],
|
|
2511
|
+
model: ModelParam,
|
|
2512
|
+
tools: Iterable[BetaAsyncFunctionTool[Any]],
|
|
2513
|
+
max_iterations: int | NotGiven = NOT_GIVEN,
|
|
2514
|
+
container: Optional[str] | NotGiven = NOT_GIVEN,
|
|
2515
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | NotGiven = NOT_GIVEN,
|
|
2516
|
+
metadata: BetaMetadataParam | NotGiven = NOT_GIVEN,
|
|
2517
|
+
service_tier: Literal["auto", "standard_only"] | NotGiven = NOT_GIVEN,
|
|
2518
|
+
stop_sequences: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
2519
|
+
stream: Literal[True] | Literal[False] | NotGiven = False,
|
|
2520
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | NotGiven = NOT_GIVEN,
|
|
2521
|
+
temperature: float | NotGiven = NOT_GIVEN,
|
|
2522
|
+
top_k: int | NotGiven = NOT_GIVEN,
|
|
2523
|
+
top_p: float | NotGiven = NOT_GIVEN,
|
|
2524
|
+
thinking: BetaThinkingConfigParam | NotGiven = NOT_GIVEN,
|
|
2525
|
+
tool_choice: BetaToolChoiceParam | NotGiven = NOT_GIVEN,
|
|
2526
|
+
betas: List[AnthropicBetaParam] | NotGiven = NOT_GIVEN,
|
|
2527
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2528
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2529
|
+
extra_headers: Headers | None = None,
|
|
2530
|
+
extra_query: Query | None = None,
|
|
2531
|
+
extra_body: Body | None = None,
|
|
2532
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2533
|
+
) -> BetaAsyncToolRunner | BetaAsyncStreamingToolRunner:
|
|
2534
|
+
"""Create a Message stream"""
|
|
2535
|
+
if model in DEPRECATED_MODELS:
|
|
2536
|
+
warnings.warn(
|
|
2537
|
+
f"The model '{model}' is deprecated and will reach end-of-life on {DEPRECATED_MODELS[model]}.\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.",
|
|
2538
|
+
DeprecationWarning,
|
|
2539
|
+
stacklevel=3,
|
|
2540
|
+
)
|
|
2541
|
+
|
|
2542
|
+
extra_headers = {
|
|
2543
|
+
"X-Stainless-Helper": "beta.messages.tool_runner",
|
|
2544
|
+
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}),
|
|
2545
|
+
**(extra_headers or {}),
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
params = cast(
|
|
2549
|
+
message_create_params.MessageCreateParamsBase,
|
|
2550
|
+
{
|
|
2551
|
+
"max_tokens": max_tokens,
|
|
2552
|
+
"messages": messages,
|
|
2553
|
+
"model": model,
|
|
2554
|
+
"container": container,
|
|
2555
|
+
"mcp_servers": mcp_servers,
|
|
2556
|
+
"metadata": metadata,
|
|
2557
|
+
"service_tier": service_tier,
|
|
2558
|
+
"stop_sequences": stop_sequences,
|
|
2559
|
+
"system": system,
|
|
2560
|
+
"temperature": temperature,
|
|
2561
|
+
"thinking": thinking,
|
|
2562
|
+
"tool_choice": tool_choice,
|
|
2563
|
+
"tools": [tool.to_dict() for tool in tools],
|
|
2564
|
+
"top_k": top_k,
|
|
2565
|
+
"top_p": top_p,
|
|
2566
|
+
},
|
|
2567
|
+
)
|
|
2568
|
+
|
|
2569
|
+
if stream:
|
|
2570
|
+
return BetaAsyncStreamingToolRunner(
|
|
2571
|
+
tools=tools,
|
|
2572
|
+
params=params,
|
|
2573
|
+
options={
|
|
2574
|
+
"extra_headers": extra_headers,
|
|
2575
|
+
"extra_query": extra_query,
|
|
2576
|
+
"extra_body": extra_body,
|
|
2577
|
+
"timeout": timeout,
|
|
2578
|
+
},
|
|
2579
|
+
client=cast("AsyncAnthropic", self._client),
|
|
2580
|
+
max_iterations=max_iterations if is_given(max_iterations) else None,
|
|
2581
|
+
)
|
|
2582
|
+
return BetaAsyncToolRunner(
|
|
2583
|
+
tools=tools,
|
|
2584
|
+
params=params,
|
|
2585
|
+
options={
|
|
2586
|
+
"extra_headers": extra_headers,
|
|
2587
|
+
"extra_query": extra_query,
|
|
2588
|
+
"extra_body": extra_body,
|
|
2589
|
+
"timeout": timeout,
|
|
2590
|
+
},
|
|
2591
|
+
client=cast("AsyncAnthropic", self._client),
|
|
2592
|
+
max_iterations=max_iterations if is_given(max_iterations) else None,
|
|
2593
|
+
)
|
|
2594
|
+
|
|
2226
2595
|
def stream(
|
|
2227
2596
|
self,
|
|
2228
2597
|
*,
|
anthropic/types/beta/__init__.py
CHANGED
|
@@ -19,17 +19,22 @@ from .beta_message_param import BetaMessageParam as BetaMessageParam
|
|
|
19
19
|
from .beta_text_citation import BetaTextCitation as BetaTextCitation
|
|
20
20
|
from .file_upload_params import FileUploadParams as FileUploadParams
|
|
21
21
|
from .beta_cache_creation import BetaCacheCreation as BetaCacheCreation
|
|
22
|
+
from .beta_document_block import BetaDocumentBlock as BetaDocumentBlock
|
|
22
23
|
from .beta_metadata_param import BetaMetadataParam as BetaMetadataParam
|
|
23
24
|
from .beta_thinking_block import BetaThinkingBlock as BetaThinkingBlock
|
|
24
25
|
from .beta_thinking_delta import BetaThinkingDelta as BetaThinkingDelta
|
|
25
26
|
from .beta_tool_use_block import BetaToolUseBlock as BetaToolUseBlock
|
|
27
|
+
from .beta_citation_config import BetaCitationConfig as BetaCitationConfig
|
|
26
28
|
from .beta_citations_delta import BetaCitationsDelta as BetaCitationsDelta
|
|
27
29
|
from .beta_signature_delta import BetaSignatureDelta as BetaSignatureDelta
|
|
30
|
+
from .beta_web_fetch_block import BetaWebFetchBlock as BetaWebFetchBlock
|
|
28
31
|
from .beta_input_json_delta import BetaInputJSONDelta as BetaInputJSONDelta
|
|
29
32
|
from .beta_text_block_param import BetaTextBlockParam as BetaTextBlockParam
|
|
30
33
|
from .beta_tool_union_param import BetaToolUnionParam as BetaToolUnionParam
|
|
31
34
|
from .message_create_params import MessageCreateParams as MessageCreateParams
|
|
35
|
+
from .beta_base64_pdf_source import BetaBase64PDFSource as BetaBase64PDFSource
|
|
32
36
|
from .beta_image_block_param import BetaImageBlockParam as BetaImageBlockParam
|
|
37
|
+
from .beta_plain_text_source import BetaPlainTextSource as BetaPlainTextSource
|
|
33
38
|
from .beta_server_tool_usage import BetaServerToolUsage as BetaServerToolUsage
|
|
34
39
|
from .beta_tool_choice_param import BetaToolChoiceParam as BetaToolChoiceParam
|
|
35
40
|
from .beta_mcp_tool_use_block import BetaMCPToolUseBlock as BetaMCPToolUseBlock
|
|
@@ -44,6 +49,7 @@ from .beta_mcp_tool_result_block import BetaMCPToolResultBlock as BetaMCPToolRes
|
|
|
44
49
|
from .beta_server_tool_use_block import BetaServerToolUseBlock as BetaServerToolUseBlock
|
|
45
50
|
from .beta_thinking_config_param import BetaThinkingConfigParam as BetaThinkingConfigParam
|
|
46
51
|
from .beta_tool_choice_any_param import BetaToolChoiceAnyParam as BetaToolChoiceAnyParam
|
|
52
|
+
from .beta_web_fetch_block_param import BetaWebFetchBlockParam as BetaWebFetchBlockParam
|
|
47
53
|
from .beta_base64_pdf_block_param import BetaBase64PDFBlockParam as BetaBase64PDFBlockParam
|
|
48
54
|
from .beta_citation_char_location import BetaCitationCharLocation as BetaCitationCharLocation
|
|
49
55
|
from .beta_citation_page_location import BetaCitationPageLocation as BetaCitationPageLocation
|
|
@@ -75,6 +81,7 @@ from .beta_file_document_source_param import BetaFileDocumentSourceParam as Beta
|
|
|
75
81
|
from .beta_code_execution_output_block import BetaCodeExecutionOutputBlock as BetaCodeExecutionOutputBlock
|
|
76
82
|
from .beta_code_execution_result_block import BetaCodeExecutionResultBlock as BetaCodeExecutionResultBlock
|
|
77
83
|
from .beta_server_tool_use_block_param import BetaServerToolUseBlockParam as BetaServerToolUseBlockParam
|
|
84
|
+
from .beta_web_fetch_tool_result_block import BetaWebFetchToolResultBlock as BetaWebFetchToolResultBlock
|
|
78
85
|
from .beta_citation_char_location_param import BetaCitationCharLocationParam as BetaCitationCharLocationParam
|
|
79
86
|
from .beta_citation_page_location_param import BetaCitationPageLocationParam as BetaCitationPageLocationParam
|
|
80
87
|
from .beta_container_upload_block_param import BetaContainerUploadBlockParam as BetaContainerUploadBlockParam
|
|
@@ -87,6 +94,7 @@ from .beta_raw_content_block_delta_event import BetaRawContentBlockDeltaEvent as
|
|
|
87
94
|
from .beta_raw_content_block_start_event import BetaRawContentBlockStartEvent as BetaRawContentBlockStartEvent
|
|
88
95
|
from .beta_redacted_thinking_block_param import BetaRedactedThinkingBlockParam as BetaRedactedThinkingBlockParam
|
|
89
96
|
from .beta_thinking_config_enabled_param import BetaThinkingConfigEnabledParam as BetaThinkingConfigEnabledParam
|
|
97
|
+
from .beta_web_fetch_tool_20250910_param import BetaWebFetchTool20250910Param as BetaWebFetchTool20250910Param
|
|
90
98
|
from .beta_web_search_result_block_param import BetaWebSearchResultBlockParam as BetaWebSearchResultBlockParam
|
|
91
99
|
from .beta_thinking_config_disabled_param import BetaThinkingConfigDisabledParam as BetaThinkingConfigDisabledParam
|
|
92
100
|
from .beta_web_search_tool_20250305_param import BetaWebSearchTool20250305Param as BetaWebSearchTool20250305Param
|
|
@@ -102,12 +110,15 @@ from .beta_code_execution_tool_result_block import BetaCodeExecutionToolResultBl
|
|
|
102
110
|
from .beta_code_execution_tool_result_error import BetaCodeExecutionToolResultError as BetaCodeExecutionToolResultError
|
|
103
111
|
from .beta_tool_computer_use_20241022_param import BetaToolComputerUse20241022Param as BetaToolComputerUse20241022Param
|
|
104
112
|
from .beta_tool_computer_use_20250124_param import BetaToolComputerUse20250124Param as BetaToolComputerUse20250124Param
|
|
113
|
+
from .beta_web_fetch_tool_result_error_code import BetaWebFetchToolResultErrorCode as BetaWebFetchToolResultErrorCode
|
|
105
114
|
from .beta_code_execution_output_block_param import (
|
|
106
115
|
BetaCodeExecutionOutputBlockParam as BetaCodeExecutionOutputBlockParam,
|
|
107
116
|
)
|
|
108
117
|
from .beta_code_execution_result_block_param import (
|
|
109
118
|
BetaCodeExecutionResultBlockParam as BetaCodeExecutionResultBlockParam,
|
|
110
119
|
)
|
|
120
|
+
from .beta_web_fetch_tool_result_block_param import BetaWebFetchToolResultBlockParam as BetaWebFetchToolResultBlockParam
|
|
121
|
+
from .beta_web_fetch_tool_result_error_block import BetaWebFetchToolResultErrorBlock as BetaWebFetchToolResultErrorBlock
|
|
111
122
|
from .beta_web_search_tool_result_error_code import BetaWebSearchToolResultErrorCode as BetaWebSearchToolResultErrorCode
|
|
112
123
|
from .beta_code_execution_tool_20250522_param import (
|
|
113
124
|
BetaCodeExecutionTool20250522Param as BetaCodeExecutionTool20250522Param,
|
|
@@ -163,6 +174,9 @@ from .beta_code_execution_tool_result_error_param import (
|
|
|
163
174
|
from .beta_request_mcp_server_url_definition_param import (
|
|
164
175
|
BetaRequestMCPServerURLDefinitionParam as BetaRequestMCPServerURLDefinitionParam,
|
|
165
176
|
)
|
|
177
|
+
from .beta_web_fetch_tool_result_error_block_param import (
|
|
178
|
+
BetaWebFetchToolResultErrorBlockParam as BetaWebFetchToolResultErrorBlockParam,
|
|
179
|
+
)
|
|
166
180
|
from .beta_code_execution_tool_result_block_content import (
|
|
167
181
|
BetaCodeExecutionToolResultBlockContent as BetaCodeExecutionToolResultBlockContent,
|
|
168
182
|
)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing_extensions import Literal
|
|
4
|
+
|
|
5
|
+
from ..._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["BetaBase64PDFSource"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BetaBase64PDFSource(BaseModel):
|
|
11
|
+
data: str
|
|
12
|
+
|
|
13
|
+
media_type: Literal["application/pdf"]
|
|
14
|
+
|
|
15
|
+
type: Literal["base64"]
|
|
@@ -12,6 +12,7 @@ from .beta_mcp_tool_result_block import BetaMCPToolResultBlock
|
|
|
12
12
|
from .beta_server_tool_use_block import BetaServerToolUseBlock
|
|
13
13
|
from .beta_container_upload_block import BetaContainerUploadBlock
|
|
14
14
|
from .beta_redacted_thinking_block import BetaRedactedThinkingBlock
|
|
15
|
+
from .beta_web_fetch_tool_result_block import BetaWebFetchToolResultBlock
|
|
15
16
|
from .beta_web_search_tool_result_block import BetaWebSearchToolResultBlock
|
|
16
17
|
from .beta_code_execution_tool_result_block import BetaCodeExecutionToolResultBlock
|
|
17
18
|
from .beta_bash_code_execution_tool_result_block import BetaBashCodeExecutionToolResultBlock
|
|
@@ -27,6 +28,7 @@ BetaContentBlock: TypeAlias = Annotated[
|
|
|
27
28
|
BetaToolUseBlock,
|
|
28
29
|
BetaServerToolUseBlock,
|
|
29
30
|
BetaWebSearchToolResultBlock,
|
|
31
|
+
BetaWebFetchToolResultBlock,
|
|
30
32
|
BetaCodeExecutionToolResultBlock,
|
|
31
33
|
BetaBashCodeExecutionToolResultBlock,
|
|
32
34
|
BetaTextEditorCodeExecutionToolResultBlock,
|
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
from typing import Union
|
|
6
6
|
from typing_extensions import TypeAlias
|
|
7
7
|
|
|
8
|
+
from .beta_content_block import BetaContentBlock
|
|
8
9
|
from .beta_text_block_param import BetaTextBlockParam
|
|
9
10
|
from .beta_image_block_param import BetaImageBlockParam
|
|
10
11
|
from .beta_thinking_block_param import BetaThinkingBlockParam
|
|
@@ -16,6 +17,7 @@ from .beta_server_tool_use_block_param import BetaServerToolUseBlockParam
|
|
|
16
17
|
from .beta_container_upload_block_param import BetaContainerUploadBlockParam
|
|
17
18
|
from .beta_request_document_block_param import BetaRequestDocumentBlockParam
|
|
18
19
|
from .beta_redacted_thinking_block_param import BetaRedactedThinkingBlockParam
|
|
20
|
+
from .beta_web_fetch_tool_result_block_param import BetaWebFetchToolResultBlockParam
|
|
19
21
|
from .beta_web_search_tool_result_block_param import BetaWebSearchToolResultBlockParam
|
|
20
22
|
from .beta_request_mcp_tool_result_block_param import BetaRequestMCPToolResultBlockParam
|
|
21
23
|
from .beta_code_execution_tool_result_block_param import BetaCodeExecutionToolResultBlockParam
|
|
@@ -35,10 +37,12 @@ BetaContentBlockParam: TypeAlias = Union[
|
|
|
35
37
|
BetaToolResultBlockParam,
|
|
36
38
|
BetaServerToolUseBlockParam,
|
|
37
39
|
BetaWebSearchToolResultBlockParam,
|
|
40
|
+
BetaWebFetchToolResultBlockParam,
|
|
38
41
|
BetaCodeExecutionToolResultBlockParam,
|
|
39
42
|
BetaBashCodeExecutionToolResultBlockParam,
|
|
40
43
|
BetaTextEditorCodeExecutionToolResultBlockParam,
|
|
41
44
|
BetaMCPToolUseBlockParam,
|
|
42
45
|
BetaRequestMCPToolResultBlockParam,
|
|
43
46
|
BetaContainerUploadBlockParam,
|
|
47
|
+
BetaContentBlock,
|
|
44
48
|
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Union, Optional
|
|
4
|
+
from typing_extensions import Literal, Annotated, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..._utils import PropertyInfo
|
|
7
|
+
from ..._models import BaseModel
|
|
8
|
+
from .beta_citation_config import BetaCitationConfig
|
|
9
|
+
from .beta_base64_pdf_source import BetaBase64PDFSource
|
|
10
|
+
from .beta_plain_text_source import BetaPlainTextSource
|
|
11
|
+
|
|
12
|
+
__all__ = ["BetaDocumentBlock", "Source"]
|
|
13
|
+
|
|
14
|
+
Source: TypeAlias = Annotated[Union[BetaBase64PDFSource, BetaPlainTextSource], PropertyInfo(discriminator="type")]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class BetaDocumentBlock(BaseModel):
|
|
18
|
+
citations: Optional[BetaCitationConfig] = None
|
|
19
|
+
"""Citation configuration for the document"""
|
|
20
|
+
|
|
21
|
+
source: Source
|
|
22
|
+
|
|
23
|
+
title: Optional[str] = None
|
|
24
|
+
"""The title of the document"""
|
|
25
|
+
|
|
26
|
+
type: Literal["document"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing_extensions import Literal
|
|
4
|
+
|
|
5
|
+
from ..._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["BetaPlainTextSource"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BetaPlainTextSource(BaseModel):
|
|
11
|
+
data: str
|
|
12
|
+
|
|
13
|
+
media_type: Literal["text/plain"]
|
|
14
|
+
|
|
15
|
+
type: Literal["text"]
|
|
@@ -13,6 +13,7 @@ from .beta_mcp_tool_result_block import BetaMCPToolResultBlock
|
|
|
13
13
|
from .beta_server_tool_use_block import BetaServerToolUseBlock
|
|
14
14
|
from .beta_container_upload_block import BetaContainerUploadBlock
|
|
15
15
|
from .beta_redacted_thinking_block import BetaRedactedThinkingBlock
|
|
16
|
+
from .beta_web_fetch_tool_result_block import BetaWebFetchToolResultBlock
|
|
16
17
|
from .beta_web_search_tool_result_block import BetaWebSearchToolResultBlock
|
|
17
18
|
from .beta_code_execution_tool_result_block import BetaCodeExecutionToolResultBlock
|
|
18
19
|
from .beta_bash_code_execution_tool_result_block import BetaBashCodeExecutionToolResultBlock
|
|
@@ -28,6 +29,7 @@ ContentBlock: TypeAlias = Annotated[
|
|
|
28
29
|
BetaToolUseBlock,
|
|
29
30
|
BetaServerToolUseBlock,
|
|
30
31
|
BetaWebSearchToolResultBlock,
|
|
32
|
+
BetaWebFetchToolResultBlock,
|
|
31
33
|
BetaCodeExecutionToolResultBlock,
|
|
32
34
|
BetaBashCodeExecutionToolResultBlock,
|
|
33
35
|
BetaTextEditorCodeExecutionToolResultBlock,
|
|
@@ -32,7 +32,7 @@ class BetaRequestDocumentBlockParam(TypedDict, total=False):
|
|
|
32
32
|
cache_control: Optional[BetaCacheControlEphemeralParam]
|
|
33
33
|
"""Create a cache control breakpoint at this content block."""
|
|
34
34
|
|
|
35
|
-
citations: BetaCitationsConfigParam
|
|
35
|
+
citations: Optional[BetaCitationsConfigParam]
|
|
36
36
|
|
|
37
37
|
context: Optional[str]
|
|
38
38
|
|
|
@@ -12,6 +12,6 @@ class BetaServerToolUseBlock(BaseModel):
|
|
|
12
12
|
|
|
13
13
|
input: object
|
|
14
14
|
|
|
15
|
-
name: Literal["web_search", "code_execution", "bash_code_execution", "text_editor_code_execution"]
|
|
15
|
+
name: Literal["web_search", "web_fetch", "code_execution", "bash_code_execution", "text_editor_code_execution"]
|
|
16
16
|
|
|
17
17
|
type: Literal["server_tool_use"]
|
|
@@ -15,7 +15,9 @@ class BetaServerToolUseBlockParam(TypedDict, total=False):
|
|
|
15
15
|
|
|
16
16
|
input: Required[object]
|
|
17
17
|
|
|
18
|
-
name: Required[
|
|
18
|
+
name: Required[
|
|
19
|
+
Literal["web_search", "web_fetch", "code_execution", "bash_code_execution", "text_editor_code_execution"]
|
|
20
|
+
]
|
|
19
21
|
|
|
20
22
|
type: Required[Literal["server_tool_use"]]
|
|
21
23
|
|
|
@@ -8,6 +8,7 @@ from typing_extensions import TypeAlias
|
|
|
8
8
|
from .beta_tool_param import BetaToolParam
|
|
9
9
|
from .beta_tool_bash_20241022_param import BetaToolBash20241022Param
|
|
10
10
|
from .beta_tool_bash_20250124_param import BetaToolBash20250124Param
|
|
11
|
+
from .beta_web_fetch_tool_20250910_param import BetaWebFetchTool20250910Param
|
|
11
12
|
from .beta_web_search_tool_20250305_param import BetaWebSearchTool20250305Param
|
|
12
13
|
from .beta_tool_text_editor_20241022_param import BetaToolTextEditor20241022Param
|
|
13
14
|
from .beta_tool_text_editor_20250124_param import BetaToolTextEditor20250124Param
|
|
@@ -33,4 +34,5 @@ BetaToolUnionParam: TypeAlias = Union[
|
|
|
33
34
|
BetaToolTextEditor20250429Param,
|
|
34
35
|
BetaToolTextEditor20250728Param,
|
|
35
36
|
BetaWebSearchTool20250305Param,
|
|
37
|
+
BetaWebFetchTool20250910Param,
|
|
36
38
|
]
|