anthropic 0.68.0__py3-none-any.whl → 0.68.2__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 -1
- anthropic/_base_client.py +9 -9
- anthropic/_client.py +8 -8
- anthropic/_qs.py +7 -7
- anthropic/_types.py +18 -11
- anthropic/_utils/_transform.py +2 -2
- anthropic/_utils/_utils.py +4 -4
- anthropic/_version.py +1 -1
- anthropic/lib/tools/_beta_runner.py +0 -1
- anthropic/resources/beta/files.py +37 -37
- anthropic/resources/beta/messages/batches.py +43 -43
- anthropic/resources/beta/messages/messages.py +271 -271
- anthropic/resources/beta/models.py +19 -19
- anthropic/resources/completions.py +63 -63
- anthropic/resources/messages/batches.py +19 -19
- anthropic/resources/messages/messages.py +125 -125
- anthropic/resources/models.py +19 -19
- {anthropic-0.68.0.dist-info → anthropic-0.68.2.dist-info}/METADATA +1 -1
- {anthropic-0.68.0.dist-info → anthropic-0.68.2.dist-info}/RECORD +21 -21
- {anthropic-0.68.0.dist-info → anthropic-0.68.2.dist-info}/WHEEL +0 -0
- {anthropic-0.68.0.dist-info → anthropic-0.68.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -19,7 +19,7 @@ from .batches import (
|
|
|
19
19
|
BatchesWithStreamingResponse,
|
|
20
20
|
AsyncBatchesWithStreamingResponse,
|
|
21
21
|
)
|
|
22
|
-
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
|
|
22
|
+
from ...._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
|
|
23
23
|
from ...._utils import is_given, required_args, maybe_transform, strip_not_given, async_maybe_transform
|
|
24
24
|
from ...._compat import cached_property
|
|
25
25
|
from ...._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -92,26 +92,26 @@ class Messages(SyncAPIResource):
|
|
|
92
92
|
max_tokens: int,
|
|
93
93
|
messages: Iterable[BetaMessageParam],
|
|
94
94
|
model: ModelParam,
|
|
95
|
-
container: Optional[str] |
|
|
96
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
97
|
-
metadata: BetaMetadataParam |
|
|
98
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
99
|
-
stop_sequences: SequenceNotStr[str] |
|
|
100
|
-
stream: Literal[False] |
|
|
101
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
102
|
-
temperature: float |
|
|
103
|
-
thinking: BetaThinkingConfigParam |
|
|
104
|
-
tool_choice: BetaToolChoiceParam |
|
|
105
|
-
tools: Iterable[BetaToolUnionParam] |
|
|
106
|
-
top_k: int |
|
|
107
|
-
top_p: float |
|
|
108
|
-
betas: List[AnthropicBetaParam] |
|
|
95
|
+
container: Optional[str] | Omit = omit,
|
|
96
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
97
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
98
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
99
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
100
|
+
stream: Literal[False] | Omit = omit,
|
|
101
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
102
|
+
temperature: float | Omit = omit,
|
|
103
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
104
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
105
|
+
tools: Iterable[BetaToolUnionParam] | Omit = omit,
|
|
106
|
+
top_k: int | Omit = omit,
|
|
107
|
+
top_p: float | Omit = omit,
|
|
108
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
109
109
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
110
110
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
111
111
|
extra_headers: Headers | None = None,
|
|
112
112
|
extra_query: Query | None = None,
|
|
113
113
|
extra_body: Body | None = None,
|
|
114
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
114
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
115
115
|
) -> BetaMessage:
|
|
116
116
|
"""
|
|
117
117
|
Send a structured list of input messages with text and/or image content, and the
|
|
@@ -370,25 +370,25 @@ class Messages(SyncAPIResource):
|
|
|
370
370
|
messages: Iterable[BetaMessageParam],
|
|
371
371
|
model: ModelParam,
|
|
372
372
|
stream: Literal[True],
|
|
373
|
-
container: Optional[str] |
|
|
374
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
375
|
-
metadata: BetaMetadataParam |
|
|
376
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
377
|
-
stop_sequences: SequenceNotStr[str] |
|
|
378
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
379
|
-
temperature: float |
|
|
380
|
-
thinking: BetaThinkingConfigParam |
|
|
381
|
-
tool_choice: BetaToolChoiceParam |
|
|
382
|
-
tools: Iterable[BetaToolUnionParam] |
|
|
383
|
-
top_k: int |
|
|
384
|
-
top_p: float |
|
|
385
|
-
betas: List[AnthropicBetaParam] |
|
|
373
|
+
container: Optional[str] | Omit = omit,
|
|
374
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
375
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
376
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
377
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
378
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
379
|
+
temperature: float | Omit = omit,
|
|
380
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
381
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
382
|
+
tools: Iterable[BetaToolUnionParam] | Omit = omit,
|
|
383
|
+
top_k: int | Omit = omit,
|
|
384
|
+
top_p: float | Omit = omit,
|
|
385
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
386
386
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
387
387
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
388
388
|
extra_headers: Headers | None = None,
|
|
389
389
|
extra_query: Query | None = None,
|
|
390
390
|
extra_body: Body | None = None,
|
|
391
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
391
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
392
392
|
) -> Stream[BetaRawMessageStreamEvent]:
|
|
393
393
|
"""
|
|
394
394
|
Send a structured list of input messages with text and/or image content, and the
|
|
@@ -647,25 +647,25 @@ class Messages(SyncAPIResource):
|
|
|
647
647
|
messages: Iterable[BetaMessageParam],
|
|
648
648
|
model: ModelParam,
|
|
649
649
|
stream: bool,
|
|
650
|
-
container: Optional[str] |
|
|
651
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
652
|
-
metadata: BetaMetadataParam |
|
|
653
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
654
|
-
stop_sequences: SequenceNotStr[str] |
|
|
655
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
656
|
-
temperature: float |
|
|
657
|
-
thinking: BetaThinkingConfigParam |
|
|
658
|
-
tool_choice: BetaToolChoiceParam |
|
|
659
|
-
tools: Iterable[BetaToolUnionParam] |
|
|
660
|
-
top_k: int |
|
|
661
|
-
top_p: float |
|
|
662
|
-
betas: List[AnthropicBetaParam] |
|
|
650
|
+
container: Optional[str] | Omit = omit,
|
|
651
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
652
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
653
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
654
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
655
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
656
|
+
temperature: float | Omit = omit,
|
|
657
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
658
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
659
|
+
tools: Iterable[BetaToolUnionParam] | Omit = omit,
|
|
660
|
+
top_k: int | Omit = omit,
|
|
661
|
+
top_p: float | Omit = omit,
|
|
662
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
663
663
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
664
664
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
665
665
|
extra_headers: Headers | None = None,
|
|
666
666
|
extra_query: Query | None = None,
|
|
667
667
|
extra_body: Body | None = None,
|
|
668
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
668
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
669
669
|
) -> BetaMessage | Stream[BetaRawMessageStreamEvent]:
|
|
670
670
|
"""
|
|
671
671
|
Send a structured list of input messages with text and/or image content, and the
|
|
@@ -923,26 +923,26 @@ class Messages(SyncAPIResource):
|
|
|
923
923
|
max_tokens: int,
|
|
924
924
|
messages: Iterable[BetaMessageParam],
|
|
925
925
|
model: ModelParam,
|
|
926
|
-
container: Optional[str] |
|
|
927
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
928
|
-
metadata: BetaMetadataParam |
|
|
929
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
930
|
-
stop_sequences: SequenceNotStr[str] |
|
|
931
|
-
stream: Literal[False] | Literal[True] |
|
|
932
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
933
|
-
temperature: float |
|
|
934
|
-
thinking: BetaThinkingConfigParam |
|
|
935
|
-
tool_choice: BetaToolChoiceParam |
|
|
936
|
-
tools: Iterable[BetaToolUnionParam] |
|
|
937
|
-
top_k: int |
|
|
938
|
-
top_p: float |
|
|
939
|
-
betas: List[AnthropicBetaParam] |
|
|
926
|
+
container: Optional[str] | Omit = omit,
|
|
927
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
928
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
929
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
930
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
931
|
+
stream: Literal[False] | Literal[True] | Omit = omit,
|
|
932
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
933
|
+
temperature: float | Omit = omit,
|
|
934
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
935
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
936
|
+
tools: Iterable[BetaToolUnionParam] | Omit = omit,
|
|
937
|
+
top_k: int | Omit = omit,
|
|
938
|
+
top_p: float | Omit = omit,
|
|
939
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
940
940
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
941
941
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
942
942
|
extra_headers: Headers | None = None,
|
|
943
943
|
extra_query: Query | None = None,
|
|
944
944
|
extra_body: Body | None = None,
|
|
945
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
945
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
946
946
|
) -> BetaMessage | Stream[BetaRawMessageStreamEvent]:
|
|
947
947
|
if not stream and not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT:
|
|
948
948
|
timeout = self._client._calculate_nonstreaming_timeout(
|
|
@@ -957,7 +957,7 @@ class Messages(SyncAPIResource):
|
|
|
957
957
|
)
|
|
958
958
|
|
|
959
959
|
extra_headers = {
|
|
960
|
-
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else
|
|
960
|
+
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}),
|
|
961
961
|
**(extra_headers or {}),
|
|
962
962
|
}
|
|
963
963
|
return self._post(
|
|
@@ -1001,20 +1001,20 @@ class Messages(SyncAPIResource):
|
|
|
1001
1001
|
messages: Iterable[BetaMessageParam],
|
|
1002
1002
|
model: ModelParam,
|
|
1003
1003
|
tools: Iterable[BetaFunctionTool[Any]],
|
|
1004
|
-
max_iterations: int |
|
|
1005
|
-
container: Optional[str] |
|
|
1006
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
1007
|
-
metadata: BetaMetadataParam |
|
|
1008
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
1009
|
-
stop_sequences: SequenceNotStr[str] |
|
|
1010
|
-
stream: Literal[False] |
|
|
1011
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
1012
|
-
temperature: float |
|
|
1013
|
-
top_k: int |
|
|
1014
|
-
top_p: float |
|
|
1015
|
-
thinking: BetaThinkingConfigParam |
|
|
1016
|
-
tool_choice: BetaToolChoiceParam |
|
|
1017
|
-
betas: List[AnthropicBetaParam] |
|
|
1004
|
+
max_iterations: int | Omit = omit,
|
|
1005
|
+
container: Optional[str] | Omit = omit,
|
|
1006
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
1007
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
1008
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
1009
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
1010
|
+
stream: Literal[False] | Omit = omit,
|
|
1011
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
1012
|
+
temperature: float | Omit = omit,
|
|
1013
|
+
top_k: int | Omit = omit,
|
|
1014
|
+
top_p: float | Omit = omit,
|
|
1015
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
1016
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
1017
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
1018
1018
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1019
1019
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1020
1020
|
extra_headers: Headers | None = None,
|
|
@@ -1032,19 +1032,19 @@ class Messages(SyncAPIResource):
|
|
|
1032
1032
|
model: ModelParam,
|
|
1033
1033
|
tools: Iterable[BetaFunctionTool[Any]],
|
|
1034
1034
|
stream: Literal[True],
|
|
1035
|
-
max_iterations: int |
|
|
1036
|
-
container: Optional[str] |
|
|
1037
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
1038
|
-
metadata: BetaMetadataParam |
|
|
1039
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
1040
|
-
stop_sequences: SequenceNotStr[str] |
|
|
1041
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
1042
|
-
temperature: float |
|
|
1043
|
-
top_k: int |
|
|
1044
|
-
top_p: float |
|
|
1045
|
-
thinking: BetaThinkingConfigParam |
|
|
1046
|
-
tool_choice: BetaToolChoiceParam |
|
|
1047
|
-
betas: List[AnthropicBetaParam] |
|
|
1035
|
+
max_iterations: int | Omit = omit,
|
|
1036
|
+
container: Optional[str] | Omit = omit,
|
|
1037
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
1038
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
1039
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
1040
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
1041
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
1042
|
+
temperature: float | Omit = omit,
|
|
1043
|
+
top_k: int | Omit = omit,
|
|
1044
|
+
top_p: float | Omit = omit,
|
|
1045
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
1046
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
1047
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
1048
1048
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1049
1049
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1050
1050
|
extra_headers: Headers | None = None,
|
|
@@ -1062,19 +1062,19 @@ class Messages(SyncAPIResource):
|
|
|
1062
1062
|
model: ModelParam,
|
|
1063
1063
|
tools: Iterable[BetaFunctionTool[Any]],
|
|
1064
1064
|
stream: bool,
|
|
1065
|
-
max_iterations: int |
|
|
1066
|
-
container: Optional[str] |
|
|
1067
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
1068
|
-
metadata: BetaMetadataParam |
|
|
1069
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
1070
|
-
stop_sequences: SequenceNotStr[str] |
|
|
1071
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
1072
|
-
temperature: float |
|
|
1073
|
-
top_k: int |
|
|
1074
|
-
top_p: float |
|
|
1075
|
-
thinking: BetaThinkingConfigParam |
|
|
1076
|
-
tool_choice: BetaToolChoiceParam |
|
|
1077
|
-
betas: List[AnthropicBetaParam] |
|
|
1065
|
+
max_iterations: int | Omit = omit,
|
|
1066
|
+
container: Optional[str] | Omit = omit,
|
|
1067
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
1068
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
1069
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
1070
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
1071
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
1072
|
+
temperature: float | Omit = omit,
|
|
1073
|
+
top_k: int | Omit = omit,
|
|
1074
|
+
top_p: float | Omit = omit,
|
|
1075
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
1076
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
1077
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
1078
1078
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1079
1079
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1080
1080
|
extra_headers: Headers | None = None,
|
|
@@ -1090,20 +1090,20 @@ class Messages(SyncAPIResource):
|
|
|
1090
1090
|
messages: Iterable[BetaMessageParam],
|
|
1091
1091
|
model: ModelParam,
|
|
1092
1092
|
tools: Iterable[BetaFunctionTool[Any]],
|
|
1093
|
-
max_iterations: int |
|
|
1094
|
-
container: Optional[str] |
|
|
1095
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
1096
|
-
metadata: BetaMetadataParam |
|
|
1097
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
1098
|
-
stop_sequences: SequenceNotStr[str] |
|
|
1099
|
-
stream: bool |
|
|
1100
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
1101
|
-
temperature: float |
|
|
1102
|
-
top_k: int |
|
|
1103
|
-
top_p: float |
|
|
1104
|
-
thinking: BetaThinkingConfigParam |
|
|
1105
|
-
tool_choice: BetaToolChoiceParam |
|
|
1106
|
-
betas: List[AnthropicBetaParam] |
|
|
1093
|
+
max_iterations: int | Omit = omit,
|
|
1094
|
+
container: Optional[str] | Omit = omit,
|
|
1095
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
1096
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
1097
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
1098
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
1099
|
+
stream: bool | Omit = omit,
|
|
1100
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
1101
|
+
temperature: float | Omit = omit,
|
|
1102
|
+
top_k: int | Omit = omit,
|
|
1103
|
+
top_p: float | Omit = omit,
|
|
1104
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
1105
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
1106
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
1107
1107
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1108
1108
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1109
1109
|
extra_headers: Headers | None = None,
|
|
@@ -1120,7 +1120,7 @@ class Messages(SyncAPIResource):
|
|
|
1120
1120
|
)
|
|
1121
1121
|
|
|
1122
1122
|
extra_headers = {
|
|
1123
|
-
"X-Stainless-Helper": "
|
|
1123
|
+
"X-Stainless-Helper": "BetaToolRunner",
|
|
1124
1124
|
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}),
|
|
1125
1125
|
**(extra_headers or {}),
|
|
1126
1126
|
}
|
|
@@ -1178,19 +1178,19 @@ class Messages(SyncAPIResource):
|
|
|
1178
1178
|
max_tokens: int,
|
|
1179
1179
|
messages: Iterable[BetaMessageParam],
|
|
1180
1180
|
model: ModelParam,
|
|
1181
|
-
container: Optional[str] |
|
|
1182
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
1183
|
-
metadata: BetaMetadataParam |
|
|
1184
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
1185
|
-
stop_sequences: SequenceNotStr[str] |
|
|
1186
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
1187
|
-
temperature: float |
|
|
1188
|
-
thinking: BetaThinkingConfigParam |
|
|
1189
|
-
tool_choice: BetaToolChoiceParam |
|
|
1190
|
-
tools: Iterable[BetaToolUnionParam] |
|
|
1191
|
-
top_k: int |
|
|
1192
|
-
top_p: float |
|
|
1193
|
-
betas: List[AnthropicBetaParam] |
|
|
1181
|
+
container: Optional[str] | Omit = omit,
|
|
1182
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
1183
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
1184
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
1185
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
1186
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
1187
|
+
temperature: float | Omit = omit,
|
|
1188
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
1189
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
1190
|
+
tools: Iterable[BetaToolUnionParam] | Omit = omit,
|
|
1191
|
+
top_k: int | Omit = omit,
|
|
1192
|
+
top_p: float | Omit = omit,
|
|
1193
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
1194
1194
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1195
1195
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1196
1196
|
extra_headers: Headers | None = None,
|
|
@@ -1249,18 +1249,18 @@ class Messages(SyncAPIResource):
|
|
|
1249
1249
|
*,
|
|
1250
1250
|
messages: Iterable[BetaMessageParam],
|
|
1251
1251
|
model: ModelParam,
|
|
1252
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
1253
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
1254
|
-
thinking: BetaThinkingConfigParam |
|
|
1255
|
-
tool_choice: BetaToolChoiceParam |
|
|
1256
|
-
tools: Iterable[message_count_tokens_params.Tool] |
|
|
1257
|
-
betas: List[AnthropicBetaParam] |
|
|
1252
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
1253
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
1254
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
1255
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
1256
|
+
tools: Iterable[message_count_tokens_params.Tool] | Omit = omit,
|
|
1257
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
1258
1258
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1259
1259
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1260
1260
|
extra_headers: Headers | None = None,
|
|
1261
1261
|
extra_query: Query | None = None,
|
|
1262
1262
|
extra_body: Body | None = None,
|
|
1263
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
1263
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1264
1264
|
) -> BetaMessageTokensCount:
|
|
1265
1265
|
"""
|
|
1266
1266
|
Count the number of tokens in a Message.
|
|
@@ -1454,7 +1454,7 @@ class Messages(SyncAPIResource):
|
|
|
1454
1454
|
{
|
|
1455
1455
|
"anthropic-beta": ",".join(chain((str(e) for e in betas), ["token-counting-2024-11-01"]))
|
|
1456
1456
|
if is_given(betas)
|
|
1457
|
-
else
|
|
1457
|
+
else not_given
|
|
1458
1458
|
}
|
|
1459
1459
|
),
|
|
1460
1460
|
**(extra_headers or {}),
|
|
@@ -1512,26 +1512,26 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
1512
1512
|
max_tokens: int,
|
|
1513
1513
|
messages: Iterable[BetaMessageParam],
|
|
1514
1514
|
model: ModelParam,
|
|
1515
|
-
container: Optional[str] |
|
|
1516
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
1517
|
-
metadata: BetaMetadataParam |
|
|
1518
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
1519
|
-
stop_sequences: SequenceNotStr[str] |
|
|
1520
|
-
stream: Literal[False] |
|
|
1521
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
1522
|
-
temperature: float |
|
|
1523
|
-
thinking: BetaThinkingConfigParam |
|
|
1524
|
-
tool_choice: BetaToolChoiceParam |
|
|
1525
|
-
tools: Iterable[BetaToolUnionParam] |
|
|
1526
|
-
top_k: int |
|
|
1527
|
-
top_p: float |
|
|
1528
|
-
betas: List[AnthropicBetaParam] |
|
|
1515
|
+
container: Optional[str] | Omit = omit,
|
|
1516
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
1517
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
1518
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
1519
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
1520
|
+
stream: Literal[False] | Omit = omit,
|
|
1521
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
1522
|
+
temperature: float | Omit = omit,
|
|
1523
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
1524
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
1525
|
+
tools: Iterable[BetaToolUnionParam] | Omit = omit,
|
|
1526
|
+
top_k: int | Omit = omit,
|
|
1527
|
+
top_p: float | Omit = omit,
|
|
1528
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
1529
1529
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1530
1530
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1531
1531
|
extra_headers: Headers | None = None,
|
|
1532
1532
|
extra_query: Query | None = None,
|
|
1533
1533
|
extra_body: Body | None = None,
|
|
1534
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
1534
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1535
1535
|
) -> BetaMessage:
|
|
1536
1536
|
"""
|
|
1537
1537
|
Send a structured list of input messages with text and/or image content, and the
|
|
@@ -1790,25 +1790,25 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
1790
1790
|
messages: Iterable[BetaMessageParam],
|
|
1791
1791
|
model: ModelParam,
|
|
1792
1792
|
stream: Literal[True],
|
|
1793
|
-
container: Optional[str] |
|
|
1794
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
1795
|
-
metadata: BetaMetadataParam |
|
|
1796
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
1797
|
-
stop_sequences: SequenceNotStr[str] |
|
|
1798
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
1799
|
-
temperature: float |
|
|
1800
|
-
thinking: BetaThinkingConfigParam |
|
|
1801
|
-
tool_choice: BetaToolChoiceParam |
|
|
1802
|
-
tools: Iterable[BetaToolUnionParam] |
|
|
1803
|
-
top_k: int |
|
|
1804
|
-
top_p: float |
|
|
1805
|
-
betas: List[AnthropicBetaParam] |
|
|
1793
|
+
container: Optional[str] | Omit = omit,
|
|
1794
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
1795
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
1796
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
1797
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
1798
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
1799
|
+
temperature: float | Omit = omit,
|
|
1800
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
1801
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
1802
|
+
tools: Iterable[BetaToolUnionParam] | Omit = omit,
|
|
1803
|
+
top_k: int | Omit = omit,
|
|
1804
|
+
top_p: float | Omit = omit,
|
|
1805
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
1806
1806
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1807
1807
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1808
1808
|
extra_headers: Headers | None = None,
|
|
1809
1809
|
extra_query: Query | None = None,
|
|
1810
1810
|
extra_body: Body | None = None,
|
|
1811
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
1811
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1812
1812
|
) -> AsyncStream[BetaRawMessageStreamEvent]:
|
|
1813
1813
|
"""
|
|
1814
1814
|
Send a structured list of input messages with text and/or image content, and the
|
|
@@ -2067,25 +2067,25 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2067
2067
|
messages: Iterable[BetaMessageParam],
|
|
2068
2068
|
model: ModelParam,
|
|
2069
2069
|
stream: bool,
|
|
2070
|
-
container: Optional[str] |
|
|
2071
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
2072
|
-
metadata: BetaMetadataParam |
|
|
2073
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
2074
|
-
stop_sequences: SequenceNotStr[str] |
|
|
2075
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
2076
|
-
temperature: float |
|
|
2077
|
-
thinking: BetaThinkingConfigParam |
|
|
2078
|
-
tool_choice: BetaToolChoiceParam |
|
|
2079
|
-
tools: Iterable[BetaToolUnionParam] |
|
|
2080
|
-
top_k: int |
|
|
2081
|
-
top_p: float |
|
|
2082
|
-
betas: List[AnthropicBetaParam] |
|
|
2070
|
+
container: Optional[str] | Omit = omit,
|
|
2071
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
2072
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
2073
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
2074
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
2075
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
2076
|
+
temperature: float | Omit = omit,
|
|
2077
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
2078
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
2079
|
+
tools: Iterable[BetaToolUnionParam] | Omit = omit,
|
|
2080
|
+
top_k: int | Omit = omit,
|
|
2081
|
+
top_p: float | Omit = omit,
|
|
2082
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
2083
2083
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2084
2084
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2085
2085
|
extra_headers: Headers | None = None,
|
|
2086
2086
|
extra_query: Query | None = None,
|
|
2087
2087
|
extra_body: Body | None = None,
|
|
2088
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
2088
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
2089
2089
|
) -> BetaMessage | AsyncStream[BetaRawMessageStreamEvent]:
|
|
2090
2090
|
"""
|
|
2091
2091
|
Send a structured list of input messages with text and/or image content, and the
|
|
@@ -2343,26 +2343,26 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2343
2343
|
max_tokens: int,
|
|
2344
2344
|
messages: Iterable[BetaMessageParam],
|
|
2345
2345
|
model: ModelParam,
|
|
2346
|
-
container: Optional[str] |
|
|
2347
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
2348
|
-
metadata: BetaMetadataParam |
|
|
2349
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
2350
|
-
stop_sequences: SequenceNotStr[str] |
|
|
2351
|
-
stream: Literal[False] | Literal[True] |
|
|
2352
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
2353
|
-
temperature: float |
|
|
2354
|
-
thinking: BetaThinkingConfigParam |
|
|
2355
|
-
tool_choice: BetaToolChoiceParam |
|
|
2356
|
-
tools: Iterable[BetaToolUnionParam] |
|
|
2357
|
-
top_k: int |
|
|
2358
|
-
top_p: float |
|
|
2359
|
-
betas: List[AnthropicBetaParam] |
|
|
2346
|
+
container: Optional[str] | Omit = omit,
|
|
2347
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
2348
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
2349
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
2350
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
2351
|
+
stream: Literal[False] | Literal[True] | Omit = omit,
|
|
2352
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
2353
|
+
temperature: float | Omit = omit,
|
|
2354
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
2355
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
2356
|
+
tools: Iterable[BetaToolUnionParam] | Omit = omit,
|
|
2357
|
+
top_k: int | Omit = omit,
|
|
2358
|
+
top_p: float | Omit = omit,
|
|
2359
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
2360
2360
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2361
2361
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2362
2362
|
extra_headers: Headers | None = None,
|
|
2363
2363
|
extra_query: Query | None = None,
|
|
2364
2364
|
extra_body: Body | None = None,
|
|
2365
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
2365
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
2366
2366
|
) -> BetaMessage | AsyncStream[BetaRawMessageStreamEvent]:
|
|
2367
2367
|
if not stream and not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT:
|
|
2368
2368
|
timeout = self._client._calculate_nonstreaming_timeout(
|
|
@@ -2377,7 +2377,7 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2377
2377
|
)
|
|
2378
2378
|
|
|
2379
2379
|
extra_headers = {
|
|
2380
|
-
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else
|
|
2380
|
+
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}),
|
|
2381
2381
|
**(extra_headers or {}),
|
|
2382
2382
|
}
|
|
2383
2383
|
return await self._post(
|
|
@@ -2421,20 +2421,20 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2421
2421
|
messages: Iterable[BetaMessageParam],
|
|
2422
2422
|
model: ModelParam,
|
|
2423
2423
|
tools: Iterable[BetaAsyncFunctionTool[Any]],
|
|
2424
|
-
max_iterations: int |
|
|
2425
|
-
container: Optional[str] |
|
|
2426
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
2427
|
-
metadata: BetaMetadataParam |
|
|
2428
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
2429
|
-
stop_sequences: SequenceNotStr[str] |
|
|
2430
|
-
stream: Literal[False] |
|
|
2431
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
2432
|
-
temperature: float |
|
|
2433
|
-
top_k: int |
|
|
2434
|
-
top_p: float |
|
|
2435
|
-
thinking: BetaThinkingConfigParam |
|
|
2436
|
-
tool_choice: BetaToolChoiceParam |
|
|
2437
|
-
betas: List[AnthropicBetaParam] |
|
|
2424
|
+
max_iterations: int | Omit = omit,
|
|
2425
|
+
container: Optional[str] | Omit = omit,
|
|
2426
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
2427
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
2428
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
2429
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
2430
|
+
stream: Literal[False] | Omit = omit,
|
|
2431
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
2432
|
+
temperature: float | Omit = omit,
|
|
2433
|
+
top_k: int | Omit = omit,
|
|
2434
|
+
top_p: float | Omit = omit,
|
|
2435
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
2436
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
2437
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
2438
2438
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2439
2439
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2440
2440
|
extra_headers: Headers | None = None,
|
|
@@ -2452,19 +2452,19 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2452
2452
|
model: ModelParam,
|
|
2453
2453
|
tools: Iterable[BetaAsyncFunctionTool[Any]],
|
|
2454
2454
|
stream: Literal[True],
|
|
2455
|
-
max_iterations: int |
|
|
2456
|
-
container: Optional[str] |
|
|
2457
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
2458
|
-
metadata: BetaMetadataParam |
|
|
2459
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
2460
|
-
stop_sequences: SequenceNotStr[str] |
|
|
2461
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
2462
|
-
temperature: float |
|
|
2463
|
-
top_k: int |
|
|
2464
|
-
top_p: float |
|
|
2465
|
-
thinking: BetaThinkingConfigParam |
|
|
2466
|
-
tool_choice: BetaToolChoiceParam |
|
|
2467
|
-
betas: List[AnthropicBetaParam] |
|
|
2455
|
+
max_iterations: int | Omit = omit,
|
|
2456
|
+
container: Optional[str] | Omit = omit,
|
|
2457
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
2458
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
2459
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
2460
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
2461
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
2462
|
+
temperature: float | Omit = omit,
|
|
2463
|
+
top_k: int | Omit = omit,
|
|
2464
|
+
top_p: float | Omit = omit,
|
|
2465
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
2466
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
2467
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
2468
2468
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2469
2469
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2470
2470
|
extra_headers: Headers | None = None,
|
|
@@ -2482,19 +2482,19 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2482
2482
|
model: ModelParam,
|
|
2483
2483
|
tools: Iterable[BetaAsyncFunctionTool[Any]],
|
|
2484
2484
|
stream: bool,
|
|
2485
|
-
max_iterations: int |
|
|
2486
|
-
container: Optional[str] |
|
|
2487
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
2488
|
-
metadata: BetaMetadataParam |
|
|
2489
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
2490
|
-
stop_sequences: SequenceNotStr[str] |
|
|
2491
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
2492
|
-
temperature: float |
|
|
2493
|
-
top_k: int |
|
|
2494
|
-
top_p: float |
|
|
2495
|
-
thinking: BetaThinkingConfigParam |
|
|
2496
|
-
tool_choice: BetaToolChoiceParam |
|
|
2497
|
-
betas: List[AnthropicBetaParam] |
|
|
2485
|
+
max_iterations: int | Omit = omit,
|
|
2486
|
+
container: Optional[str] | Omit = omit,
|
|
2487
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
2488
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
2489
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
2490
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
2491
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
2492
|
+
temperature: float | Omit = omit,
|
|
2493
|
+
top_k: int | Omit = omit,
|
|
2494
|
+
top_p: float | Omit = omit,
|
|
2495
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
2496
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
2497
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
2498
2498
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2499
2499
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2500
2500
|
extra_headers: Headers | None = None,
|
|
@@ -2510,20 +2510,20 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2510
2510
|
messages: Iterable[BetaMessageParam],
|
|
2511
2511
|
model: ModelParam,
|
|
2512
2512
|
tools: Iterable[BetaAsyncFunctionTool[Any]],
|
|
2513
|
-
max_iterations: int |
|
|
2514
|
-
container: Optional[str] |
|
|
2515
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
2516
|
-
metadata: BetaMetadataParam |
|
|
2517
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
2518
|
-
stop_sequences: SequenceNotStr[str] |
|
|
2519
|
-
stream: Literal[True] | Literal[False] |
|
|
2520
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
2521
|
-
temperature: float |
|
|
2522
|
-
top_k: int |
|
|
2523
|
-
top_p: float |
|
|
2524
|
-
thinking: BetaThinkingConfigParam |
|
|
2525
|
-
tool_choice: BetaToolChoiceParam |
|
|
2526
|
-
betas: List[AnthropicBetaParam] |
|
|
2513
|
+
max_iterations: int | Omit = omit,
|
|
2514
|
+
container: Optional[str] | Omit = omit,
|
|
2515
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
2516
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
2517
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
2518
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
2519
|
+
stream: Literal[True] | Literal[False] | Omit = False,
|
|
2520
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
2521
|
+
temperature: float | Omit = omit,
|
|
2522
|
+
top_k: int | Omit = omit,
|
|
2523
|
+
top_p: float | Omit = omit,
|
|
2524
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
2525
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
2526
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
2527
2527
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2528
2528
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2529
2529
|
extra_headers: Headers | None = None,
|
|
@@ -2540,7 +2540,7 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2540
2540
|
)
|
|
2541
2541
|
|
|
2542
2542
|
extra_headers = {
|
|
2543
|
-
"X-Stainless-Helper": "
|
|
2543
|
+
"X-Stainless-Helper": "BetaToolRunner",
|
|
2544
2544
|
**strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else NOT_GIVEN}),
|
|
2545
2545
|
**(extra_headers or {}),
|
|
2546
2546
|
}
|
|
@@ -2598,19 +2598,19 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2598
2598
|
max_tokens: int,
|
|
2599
2599
|
messages: Iterable[BetaMessageParam],
|
|
2600
2600
|
model: ModelParam,
|
|
2601
|
-
metadata: BetaMetadataParam |
|
|
2602
|
-
container: Optional[str] |
|
|
2603
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
2604
|
-
service_tier: Literal["auto", "standard_only"] |
|
|
2605
|
-
stop_sequences: SequenceNotStr[str] |
|
|
2606
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
2607
|
-
temperature: float |
|
|
2608
|
-
thinking: BetaThinkingConfigParam |
|
|
2609
|
-
tool_choice: BetaToolChoiceParam |
|
|
2610
|
-
tools: Iterable[BetaToolUnionParam] |
|
|
2611
|
-
top_k: int |
|
|
2612
|
-
top_p: float |
|
|
2613
|
-
betas: List[AnthropicBetaParam] |
|
|
2601
|
+
metadata: BetaMetadataParam | Omit = omit,
|
|
2602
|
+
container: Optional[str] | Omit = omit,
|
|
2603
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
2604
|
+
service_tier: Literal["auto", "standard_only"] | Omit = omit,
|
|
2605
|
+
stop_sequences: SequenceNotStr[str] | Omit = omit,
|
|
2606
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
2607
|
+
temperature: float | Omit = omit,
|
|
2608
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
2609
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
2610
|
+
tools: Iterable[BetaToolUnionParam] | Omit = omit,
|
|
2611
|
+
top_k: int | Omit = omit,
|
|
2612
|
+
top_p: float | Omit = omit,
|
|
2613
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
2614
2614
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2615
2615
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2616
2616
|
extra_headers: Headers | None = None,
|
|
@@ -2667,18 +2667,18 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2667
2667
|
*,
|
|
2668
2668
|
messages: Iterable[BetaMessageParam],
|
|
2669
2669
|
model: ModelParam,
|
|
2670
|
-
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] |
|
|
2671
|
-
system: Union[str, Iterable[BetaTextBlockParam]] |
|
|
2672
|
-
thinking: BetaThinkingConfigParam |
|
|
2673
|
-
tool_choice: BetaToolChoiceParam |
|
|
2674
|
-
tools: Iterable[message_count_tokens_params.Tool] |
|
|
2675
|
-
betas: List[AnthropicBetaParam] |
|
|
2670
|
+
mcp_servers: Iterable[BetaRequestMCPServerURLDefinitionParam] | Omit = omit,
|
|
2671
|
+
system: Union[str, Iterable[BetaTextBlockParam]] | Omit = omit,
|
|
2672
|
+
thinking: BetaThinkingConfigParam | Omit = omit,
|
|
2673
|
+
tool_choice: BetaToolChoiceParam | Omit = omit,
|
|
2674
|
+
tools: Iterable[message_count_tokens_params.Tool] | Omit = omit,
|
|
2675
|
+
betas: List[AnthropicBetaParam] | Omit = omit,
|
|
2676
2676
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2677
2677
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2678
2678
|
extra_headers: Headers | None = None,
|
|
2679
2679
|
extra_query: Query | None = None,
|
|
2680
2680
|
extra_body: Body | None = None,
|
|
2681
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
2681
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
2682
2682
|
) -> BetaMessageTokensCount:
|
|
2683
2683
|
"""
|
|
2684
2684
|
Count the number of tokens in a Message.
|
|
@@ -2872,7 +2872,7 @@ class AsyncMessages(AsyncAPIResource):
|
|
|
2872
2872
|
{
|
|
2873
2873
|
"anthropic-beta": ",".join(chain((str(e) for e in betas), ["token-counting-2024-11-01"]))
|
|
2874
2874
|
if is_given(betas)
|
|
2875
|
-
else
|
|
2875
|
+
else not_given
|
|
2876
2876
|
}
|
|
2877
2877
|
),
|
|
2878
2878
|
**(extra_headers or {}),
|