anthropic 0.63.0__py3-none-any.whl → 0.65.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.
Files changed (56) hide show
  1. anthropic/_models.py +1 -1
  2. anthropic/_types.py +35 -1
  3. anthropic/_utils/__init__.py +1 -0
  4. anthropic/_utils/_transform.py +6 -0
  5. anthropic/_utils/_typing.py +5 -0
  6. anthropic/_version.py +1 -1
  7. anthropic/lib/streaming/_beta_messages.py +0 -1
  8. anthropic/resources/beta/messages/messages.py +19 -203
  9. anthropic/resources/completions.py +9 -9
  10. anthropic/resources/messages/messages.py +22 -204
  11. anthropic/types/__init__.py +1 -0
  12. anthropic/types/beta/__init__.py +53 -0
  13. anthropic/types/beta/beta_bash_code_execution_output_block.py +13 -0
  14. anthropic/types/beta/beta_bash_code_execution_output_block_param.py +13 -0
  15. anthropic/types/beta/beta_bash_code_execution_result_block.py +21 -0
  16. anthropic/types/beta/beta_bash_code_execution_result_block_param.py +22 -0
  17. anthropic/types/beta/beta_bash_code_execution_tool_result_block.py +20 -0
  18. anthropic/types/beta/beta_bash_code_execution_tool_result_block_param.py +25 -0
  19. anthropic/types/beta/beta_bash_code_execution_tool_result_error.py +15 -0
  20. anthropic/types/beta/beta_bash_code_execution_tool_result_error_param.py +17 -0
  21. anthropic/types/beta/beta_code_execution_tool_20250825_param.py +23 -0
  22. anthropic/types/beta/beta_content_block.py +4 -0
  23. anthropic/types/beta/beta_content_block_param.py +4 -0
  24. anthropic/types/beta/beta_raw_content_block_start_event.py +4 -0
  25. anthropic/types/beta/beta_request_mcp_server_tool_configuration_param.py +4 -2
  26. anthropic/types/beta/beta_server_tool_use_block.py +1 -1
  27. anthropic/types/beta/beta_server_tool_use_block_param.py +1 -1
  28. anthropic/types/beta/beta_text_editor_code_execution_create_result_block.py +13 -0
  29. anthropic/types/beta/beta_text_editor_code_execution_create_result_block_param.py +13 -0
  30. anthropic/types/beta/beta_text_editor_code_execution_str_replace_result_block.py +22 -0
  31. anthropic/types/beta/beta_text_editor_code_execution_str_replace_result_block_param.py +24 -0
  32. anthropic/types/beta/beta_text_editor_code_execution_tool_result_block.py +27 -0
  33. anthropic/types/beta/beta_text_editor_code_execution_tool_result_block_param.py +34 -0
  34. anthropic/types/beta/beta_text_editor_code_execution_tool_result_error.py +18 -0
  35. anthropic/types/beta/beta_text_editor_code_execution_tool_result_error_param.py +18 -0
  36. anthropic/types/beta/beta_text_editor_code_execution_view_result_block.py +22 -0
  37. anthropic/types/beta/beta_text_editor_code_execution_view_result_block_param.py +22 -0
  38. anthropic/types/beta/beta_tool_param.py +3 -2
  39. anthropic/types/beta/beta_tool_union_param.py +2 -0
  40. anthropic/types/beta/beta_web_search_tool_20250305_param.py +4 -3
  41. anthropic/types/beta/message_count_tokens_params.py +3 -24
  42. anthropic/types/beta/message_create_params.py +3 -25
  43. anthropic/types/beta_error_response.py +3 -0
  44. anthropic/types/cache_control_ephemeral_param.py +11 -0
  45. anthropic/types/cache_creation.py +13 -0
  46. anthropic/types/completion_create_params.py +2 -1
  47. anthropic/types/message_count_tokens_params.py +1 -24
  48. anthropic/types/message_create_params.py +4 -26
  49. anthropic/types/shared/error_response.py +3 -0
  50. anthropic/types/tool_param.py +3 -2
  51. anthropic/types/usage.py +4 -0
  52. anthropic/types/web_search_tool_20250305_param.py +4 -3
  53. {anthropic-0.63.0.dist-info → anthropic-0.65.0.dist-info}/METADATA +1 -1
  54. {anthropic-0.63.0.dist-info → anthropic-0.65.0.dist-info}/RECORD +56 -36
  55. {anthropic-0.63.0.dist-info → anthropic-0.65.0.dist-info}/WHEEL +0 -0
  56. {anthropic-0.63.0.dist-info → anthropic-0.65.0.dist-info}/licenses/LICENSE +0 -0
@@ -19,6 +19,8 @@ from .beta_redacted_thinking_block_param import BetaRedactedThinkingBlockParam
19
19
  from .beta_web_search_tool_result_block_param import BetaWebSearchToolResultBlockParam
20
20
  from .beta_request_mcp_tool_result_block_param import BetaRequestMCPToolResultBlockParam
21
21
  from .beta_code_execution_tool_result_block_param import BetaCodeExecutionToolResultBlockParam
22
+ from .beta_bash_code_execution_tool_result_block_param import BetaBashCodeExecutionToolResultBlockParam
23
+ from .beta_text_editor_code_execution_tool_result_block_param import BetaTextEditorCodeExecutionToolResultBlockParam
22
24
 
23
25
  __all__ = ["BetaContentBlockParam"]
24
26
 
@@ -34,6 +36,8 @@ BetaContentBlockParam: TypeAlias = Union[
34
36
  BetaServerToolUseBlockParam,
35
37
  BetaWebSearchToolResultBlockParam,
36
38
  BetaCodeExecutionToolResultBlockParam,
39
+ BetaBashCodeExecutionToolResultBlockParam,
40
+ BetaTextEditorCodeExecutionToolResultBlockParam,
37
41
  BetaMCPToolUseBlockParam,
38
42
  BetaRequestMCPToolResultBlockParam,
39
43
  BetaContainerUploadBlockParam,
@@ -15,6 +15,8 @@ from .beta_container_upload_block import BetaContainerUploadBlock
15
15
  from .beta_redacted_thinking_block import BetaRedactedThinkingBlock
16
16
  from .beta_web_search_tool_result_block import BetaWebSearchToolResultBlock
17
17
  from .beta_code_execution_tool_result_block import BetaCodeExecutionToolResultBlock
18
+ from .beta_bash_code_execution_tool_result_block import BetaBashCodeExecutionToolResultBlock
19
+ from .beta_text_editor_code_execution_tool_result_block import BetaTextEditorCodeExecutionToolResultBlock
18
20
 
19
21
  __all__ = ["BetaRawContentBlockStartEvent", "ContentBlock"]
20
22
 
@@ -27,6 +29,8 @@ ContentBlock: TypeAlias = Annotated[
27
29
  BetaServerToolUseBlock,
28
30
  BetaWebSearchToolResultBlock,
29
31
  BetaCodeExecutionToolResultBlock,
32
+ BetaBashCodeExecutionToolResultBlock,
33
+ BetaTextEditorCodeExecutionToolResultBlock,
30
34
  BetaMCPToolUseBlock,
31
35
  BetaMCPToolResultBlock,
32
36
  BetaContainerUploadBlock,
@@ -2,13 +2,15 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import List, Optional
5
+ from typing import Optional
6
6
  from typing_extensions import TypedDict
7
7
 
8
+ from ..._types import SequenceNotStr
9
+
8
10
  __all__ = ["BetaRequestMCPServerToolConfigurationParam"]
9
11
 
10
12
 
11
13
  class BetaRequestMCPServerToolConfigurationParam(TypedDict, total=False):
12
- allowed_tools: Optional[List[str]]
14
+ allowed_tools: Optional[SequenceNotStr[str]]
13
15
 
14
16
  enabled: Optional[bool]
@@ -12,6 +12,6 @@ class BetaServerToolUseBlock(BaseModel):
12
12
 
13
13
  input: object
14
14
 
15
- name: Literal["web_search", "code_execution"]
15
+ name: Literal["web_search", "code_execution", "bash_code_execution", "text_editor_code_execution"]
16
16
 
17
17
  type: Literal["server_tool_use"]
@@ -15,7 +15,7 @@ class BetaServerToolUseBlockParam(TypedDict, total=False):
15
15
 
16
16
  input: Required[object]
17
17
 
18
- name: Required[Literal["web_search", "code_execution"]]
18
+ name: Required[Literal["web_search", "code_execution", "bash_code_execution", "text_editor_code_execution"]]
19
19
 
20
20
  type: Required[Literal["server_tool_use"]]
21
21
 
@@ -0,0 +1,13 @@
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__ = ["BetaTextEditorCodeExecutionCreateResultBlock"]
8
+
9
+
10
+ class BetaTextEditorCodeExecutionCreateResultBlock(BaseModel):
11
+ is_file_update: bool
12
+
13
+ type: Literal["text_editor_code_execution_create_result"]
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Literal, Required, TypedDict
6
+
7
+ __all__ = ["BetaTextEditorCodeExecutionCreateResultBlockParam"]
8
+
9
+
10
+ class BetaTextEditorCodeExecutionCreateResultBlockParam(TypedDict, total=False):
11
+ is_file_update: Required[bool]
12
+
13
+ type: Required[Literal["text_editor_code_execution_create_result"]]
@@ -0,0 +1,22 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Optional
4
+ from typing_extensions import Literal
5
+
6
+ from ..._models import BaseModel
7
+
8
+ __all__ = ["BetaTextEditorCodeExecutionStrReplaceResultBlock"]
9
+
10
+
11
+ class BetaTextEditorCodeExecutionStrReplaceResultBlock(BaseModel):
12
+ lines: Optional[List[str]] = None
13
+
14
+ new_lines: Optional[int] = None
15
+
16
+ new_start: Optional[int] = None
17
+
18
+ old_lines: Optional[int] = None
19
+
20
+ old_start: Optional[int] = None
21
+
22
+ type: Literal["text_editor_code_execution_str_replace_result"]
@@ -0,0 +1,24 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Literal, Required, TypedDict
7
+
8
+ from ..._types import SequenceNotStr
9
+
10
+ __all__ = ["BetaTextEditorCodeExecutionStrReplaceResultBlockParam"]
11
+
12
+
13
+ class BetaTextEditorCodeExecutionStrReplaceResultBlockParam(TypedDict, total=False):
14
+ type: Required[Literal["text_editor_code_execution_str_replace_result"]]
15
+
16
+ lines: Optional[SequenceNotStr[str]]
17
+
18
+ new_lines: Optional[int]
19
+
20
+ new_start: Optional[int]
21
+
22
+ old_lines: Optional[int]
23
+
24
+ old_start: Optional[int]
@@ -0,0 +1,27 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Union
4
+ from typing_extensions import Literal, TypeAlias
5
+
6
+ from ..._models import BaseModel
7
+ from .beta_text_editor_code_execution_tool_result_error import BetaTextEditorCodeExecutionToolResultError
8
+ from .beta_text_editor_code_execution_view_result_block import BetaTextEditorCodeExecutionViewResultBlock
9
+ from .beta_text_editor_code_execution_create_result_block import BetaTextEditorCodeExecutionCreateResultBlock
10
+ from .beta_text_editor_code_execution_str_replace_result_block import BetaTextEditorCodeExecutionStrReplaceResultBlock
11
+
12
+ __all__ = ["BetaTextEditorCodeExecutionToolResultBlock", "Content"]
13
+
14
+ Content: TypeAlias = Union[
15
+ BetaTextEditorCodeExecutionToolResultError,
16
+ BetaTextEditorCodeExecutionViewResultBlock,
17
+ BetaTextEditorCodeExecutionCreateResultBlock,
18
+ BetaTextEditorCodeExecutionStrReplaceResultBlock,
19
+ ]
20
+
21
+
22
+ class BetaTextEditorCodeExecutionToolResultBlock(BaseModel):
23
+ content: Content
24
+
25
+ tool_use_id: str
26
+
27
+ type: Literal["text_editor_code_execution_tool_result"]
@@ -0,0 +1,34 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Union, Optional
6
+ from typing_extensions import Literal, Required, TypeAlias, TypedDict
7
+
8
+ from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
9
+ from .beta_text_editor_code_execution_tool_result_error_param import BetaTextEditorCodeExecutionToolResultErrorParam
10
+ from .beta_text_editor_code_execution_view_result_block_param import BetaTextEditorCodeExecutionViewResultBlockParam
11
+ from .beta_text_editor_code_execution_create_result_block_param import BetaTextEditorCodeExecutionCreateResultBlockParam
12
+ from .beta_text_editor_code_execution_str_replace_result_block_param import (
13
+ BetaTextEditorCodeExecutionStrReplaceResultBlockParam,
14
+ )
15
+
16
+ __all__ = ["BetaTextEditorCodeExecutionToolResultBlockParam", "Content"]
17
+
18
+ Content: TypeAlias = Union[
19
+ BetaTextEditorCodeExecutionToolResultErrorParam,
20
+ BetaTextEditorCodeExecutionViewResultBlockParam,
21
+ BetaTextEditorCodeExecutionCreateResultBlockParam,
22
+ BetaTextEditorCodeExecutionStrReplaceResultBlockParam,
23
+ ]
24
+
25
+
26
+ class BetaTextEditorCodeExecutionToolResultBlockParam(TypedDict, total=False):
27
+ content: Required[Content]
28
+
29
+ tool_use_id: Required[str]
30
+
31
+ type: Required[Literal["text_editor_code_execution_tool_result"]]
32
+
33
+ cache_control: Optional[BetaCacheControlEphemeralParam]
34
+ """Create a cache control breakpoint at this content block."""
@@ -0,0 +1,18 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from typing_extensions import Literal
5
+
6
+ from ..._models import BaseModel
7
+
8
+ __all__ = ["BetaTextEditorCodeExecutionToolResultError"]
9
+
10
+
11
+ class BetaTextEditorCodeExecutionToolResultError(BaseModel):
12
+ error_code: Literal[
13
+ "invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded", "file_not_found"
14
+ ]
15
+
16
+ error_message: Optional[str] = None
17
+
18
+ type: Literal["text_editor_code_execution_tool_result_error"]
@@ -0,0 +1,18 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Literal, Required, TypedDict
7
+
8
+ __all__ = ["BetaTextEditorCodeExecutionToolResultErrorParam"]
9
+
10
+
11
+ class BetaTextEditorCodeExecutionToolResultErrorParam(TypedDict, total=False):
12
+ error_code: Required[
13
+ Literal["invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded", "file_not_found"]
14
+ ]
15
+
16
+ type: Required[Literal["text_editor_code_execution_tool_result_error"]]
17
+
18
+ error_message: Optional[str]
@@ -0,0 +1,22 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from typing_extensions import Literal
5
+
6
+ from ..._models import BaseModel
7
+
8
+ __all__ = ["BetaTextEditorCodeExecutionViewResultBlock"]
9
+
10
+
11
+ class BetaTextEditorCodeExecutionViewResultBlock(BaseModel):
12
+ content: str
13
+
14
+ file_type: Literal["text", "image", "pdf"]
15
+
16
+ num_lines: Optional[int] = None
17
+
18
+ start_line: Optional[int] = None
19
+
20
+ total_lines: Optional[int] = None
21
+
22
+ type: Literal["text_editor_code_execution_view_result"]
@@ -0,0 +1,22 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Literal, Required, TypedDict
7
+
8
+ __all__ = ["BetaTextEditorCodeExecutionViewResultBlockParam"]
9
+
10
+
11
+ class BetaTextEditorCodeExecutionViewResultBlockParam(TypedDict, total=False):
12
+ content: Required[str]
13
+
14
+ file_type: Required[Literal["text", "image", "pdf"]]
15
+
16
+ type: Required[Literal["text_editor_code_execution_view_result"]]
17
+
18
+ num_lines: Optional[int]
19
+
20
+ start_line: Optional[int]
21
+
22
+ total_lines: Optional[int]
@@ -2,9 +2,10 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, List, Union, Optional
5
+ from typing import Dict, Union, Optional
6
6
  from typing_extensions import Literal, Required, TypeAlias, TypedDict
7
7
 
8
+ from ..._types import SequenceNotStr
8
9
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
9
10
 
10
11
  __all__ = ["BetaToolParam", "InputSchema"]
@@ -15,7 +16,7 @@ class InputSchemaTyped(TypedDict, total=False):
15
16
 
16
17
  properties: Optional[object]
17
18
 
18
- required: Optional[List[str]]
19
+ required: Optional[SequenceNotStr[str]]
19
20
 
20
21
 
21
22
  InputSchema: TypeAlias = Union[InputSchemaTyped, Dict[str, object]]
@@ -16,6 +16,7 @@ from .beta_tool_text_editor_20250728_param import BetaToolTextEditor20250728Para
16
16
  from .beta_tool_computer_use_20241022_param import BetaToolComputerUse20241022Param
17
17
  from .beta_tool_computer_use_20250124_param import BetaToolComputerUse20250124Param
18
18
  from .beta_code_execution_tool_20250522_param import BetaCodeExecutionTool20250522Param
19
+ from .beta_code_execution_tool_20250825_param import BetaCodeExecutionTool20250825Param
19
20
 
20
21
  __all__ = ["BetaToolUnionParam"]
21
22
 
@@ -24,6 +25,7 @@ BetaToolUnionParam: TypeAlias = Union[
24
25
  BetaToolBash20241022Param,
25
26
  BetaToolBash20250124Param,
26
27
  BetaCodeExecutionTool20250522Param,
28
+ BetaCodeExecutionTool20250825Param,
27
29
  BetaToolComputerUse20241022Param,
28
30
  BetaToolComputerUse20250124Param,
29
31
  BetaToolTextEditor20241022Param,
@@ -2,9 +2,10 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import List, Optional
5
+ from typing import Optional
6
6
  from typing_extensions import Literal, Required, TypedDict
7
7
 
8
+ from ..._types import SequenceNotStr
8
9
  from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam
9
10
 
10
11
  __all__ = ["BetaWebSearchTool20250305Param", "UserLocation"]
@@ -39,13 +40,13 @@ class BetaWebSearchTool20250305Param(TypedDict, total=False):
39
40
 
40
41
  type: Required[Literal["web_search_20250305"]]
41
42
 
42
- allowed_domains: Optional[List[str]]
43
+ allowed_domains: Optional[SequenceNotStr[str]]
43
44
  """If provided, only these domains will be included in results.
44
45
 
45
46
  Cannot be used alongside `blocked_domains`.
46
47
  """
47
48
 
48
- blocked_domains: Optional[List[str]]
49
+ blocked_domains: Optional[SequenceNotStr[str]]
49
50
  """If provided, these domains will never appear in results.
50
51
 
51
52
  Cannot be used alongside `allowed_domains`.
@@ -23,6 +23,7 @@ from .beta_tool_text_editor_20250728_param import BetaToolTextEditor20250728Para
23
23
  from .beta_tool_computer_use_20241022_param import BetaToolComputerUse20241022Param
24
24
  from .beta_tool_computer_use_20250124_param import BetaToolComputerUse20250124Param
25
25
  from .beta_code_execution_tool_20250522_param import BetaCodeExecutionTool20250522Param
26
+ from .beta_code_execution_tool_20250825_param import BetaCodeExecutionTool20250825Param
26
27
  from .beta_request_mcp_server_url_definition_param import BetaRequestMCPServerURLDefinitionParam
27
28
 
28
29
  __all__ = ["MessageCountTokensParams", "Tool"]
@@ -87,30 +88,7 @@ class MessageCountTokensParams(TypedDict, total=False):
87
88
  { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
88
89
  ```
89
90
 
90
- Starting with Claude 3 models, you can also send image content blocks:
91
-
92
- ```json
93
- {
94
- "role": "user",
95
- "content": [
96
- {
97
- "type": "image",
98
- "source": {
99
- "type": "base64",
100
- "media_type": "image/jpeg",
101
- "data": "/9j/4AAQSkZJRg..."
102
- }
103
- },
104
- { "type": "text", "text": "What is in this image?" }
105
- ]
106
- }
107
- ```
108
-
109
- We currently support the `base64` source type for images, and the `image/jpeg`,
110
- `image/png`, `image/gif`, and `image/webp` media types.
111
-
112
- See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
113
- more input examples.
91
+ See [input examples](https://docs.anthropic.com/en/api/messages-examples).
114
92
 
115
93
  Note that if you want to include a
116
94
  [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -244,6 +222,7 @@ Tool: TypeAlias = Union[
244
222
  BetaToolBash20241022Param,
245
223
  BetaToolBash20250124Param,
246
224
  BetaCodeExecutionTool20250522Param,
225
+ BetaCodeExecutionTool20250825Param,
247
226
  BetaToolComputerUse20241022Param,
248
227
  BetaToolComputerUse20250124Param,
249
228
  BetaToolTextEditor20241022Param,
@@ -5,6 +5,7 @@ from __future__ import annotations
5
5
  from typing import List, Union, Iterable, Optional
6
6
  from typing_extensions import Literal, Required, Annotated, TypedDict
7
7
 
8
+ from ..._types import SequenceNotStr
8
9
  from ..._utils import PropertyInfo
9
10
  from ..model_param import ModelParam
10
11
  from .beta_message_param import BetaMessageParam
@@ -88,30 +89,7 @@ class MessageCreateParamsBase(TypedDict, total=False):
88
89
  { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
89
90
  ```
90
91
 
91
- Starting with Claude 3 models, you can also send image content blocks:
92
-
93
- ```json
94
- {
95
- "role": "user",
96
- "content": [
97
- {
98
- "type": "image",
99
- "source": {
100
- "type": "base64",
101
- "media_type": "image/jpeg",
102
- "data": "/9j/4AAQSkZJRg..."
103
- }
104
- },
105
- { "type": "text", "text": "What is in this image?" }
106
- ]
107
- }
108
- ```
109
-
110
- We currently support the `base64` source type for images, and the `image/jpeg`,
111
- `image/png`, `image/gif`, and `image/webp` media types.
112
-
113
- See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
114
- more input examples.
92
+ See [input examples](https://docs.anthropic.com/en/api/messages-examples).
115
93
 
116
94
  Note that if you want to include a
117
95
  [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -146,7 +124,7 @@ class MessageCreateParamsBase(TypedDict, total=False):
146
124
  [service-tiers](https://docs.anthropic.com/en/api/service-tiers) for details.
147
125
  """
148
126
 
149
- stop_sequences: List[str]
127
+ stop_sequences: SequenceNotStr[str]
150
128
  """Custom text sequences that will cause the model to stop generating.
151
129
 
152
130
  Our models will normally stop when they have naturally completed their turn,
@@ -1,5 +1,6 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ from typing import Optional
3
4
  from typing_extensions import Literal
4
5
 
5
6
  from .._models import BaseModel
@@ -11,4 +12,6 @@ __all__ = ["BetaErrorResponse"]
11
12
  class BetaErrorResponse(BaseModel):
12
13
  error: BetaError
13
14
 
15
+ request_id: Optional[str] = None
16
+
14
17
  type: Literal["error"]
@@ -9,3 +9,14 @@ __all__ = ["CacheControlEphemeralParam"]
9
9
 
10
10
  class CacheControlEphemeralParam(TypedDict, total=False):
11
11
  type: Required[Literal["ephemeral"]]
12
+
13
+ ttl: Literal["5m", "1h"]
14
+ """The time-to-live for the cache control breakpoint.
15
+
16
+ This may be one the following values:
17
+
18
+ - `5m`: 5 minutes
19
+ - `1h`: 1 hour
20
+
21
+ Defaults to `5m`.
22
+ """
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .._models import BaseModel
4
+
5
+ __all__ = ["CacheCreation"]
6
+
7
+
8
+ class CacheCreation(BaseModel):
9
+ ephemeral_1h_input_tokens: int
10
+ """The number of input tokens used to create the 1 hour cache entry."""
11
+
12
+ ephemeral_5m_input_tokens: int
13
+ """The number of input tokens used to create the 5 minute cache entry."""
@@ -5,6 +5,7 @@ from __future__ import annotations
5
5
  from typing import List, Union
6
6
  from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
7
7
 
8
+ from .._types import SequenceNotStr
8
9
  from .._utils import PropertyInfo
9
10
  from .model_param import ModelParam
10
11
  from .metadata_param import MetadataParam
@@ -56,7 +57,7 @@ class CompletionCreateParamsBase(TypedDict, total=False):
56
57
  metadata: MetadataParam
57
58
  """An object describing metadata about the request."""
58
59
 
59
- stop_sequences: List[str]
60
+ stop_sequences: SequenceNotStr[str]
60
61
  """Sequences that will cause the model to stop generating.
61
62
 
62
63
  Our models stop on `"\n\nHuman:"`, and may include additional built-in stop
@@ -74,30 +74,7 @@ class MessageCountTokensParams(TypedDict, total=False):
74
74
  { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
75
75
  ```
76
76
 
77
- Starting with Claude 3 models, you can also send image content blocks:
78
-
79
- ```json
80
- {
81
- "role": "user",
82
- "content": [
83
- {
84
- "type": "image",
85
- "source": {
86
- "type": "base64",
87
- "media_type": "image/jpeg",
88
- "data": "/9j/4AAQSkZJRg..."
89
- }
90
- },
91
- { "type": "text", "text": "What is in this image?" }
92
- ]
93
- }
94
- ```
95
-
96
- We currently support the `base64` source type for images, and the `image/jpeg`,
97
- `image/png`, `image/gif`, and `image/webp` media types.
98
-
99
- See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
100
- more input examples.
77
+ See [input examples](https://docs.anthropic.com/en/api/messages-examples).
101
78
 
102
79
  Note that if you want to include a
103
80
  [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -2,9 +2,10 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import List, Union, Iterable
5
+ from typing import Union, Iterable
6
6
  from typing_extensions import Literal, Required, TypeAlias, TypedDict
7
7
 
8
+ from .._types import SequenceNotStr
8
9
  from .model_param import ModelParam
9
10
  from .message_param import MessageParam
10
11
  from .metadata_param import MetadataParam
@@ -97,30 +98,7 @@ class MessageCreateParamsBase(TypedDict, total=False):
97
98
  { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
98
99
  ```
99
100
 
100
- Starting with Claude 3 models, you can also send image content blocks:
101
-
102
- ```json
103
- {
104
- "role": "user",
105
- "content": [
106
- {
107
- "type": "image",
108
- "source": {
109
- "type": "base64",
110
- "media_type": "image/jpeg",
111
- "data": "/9j/4AAQSkZJRg..."
112
- }
113
- },
114
- { "type": "text", "text": "What is in this image?" }
115
- ]
116
- }
117
- ```
118
-
119
- We currently support the `base64` source type for images, and the `image/jpeg`,
120
- `image/png`, `image/gif`, and `image/webp` media types.
121
-
122
- See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
123
- more input examples.
101
+ See [input examples](https://docs.anthropic.com/en/api/messages-examples).
124
102
 
125
103
  Note that if you want to include a
126
104
  [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -149,7 +127,7 @@ class MessageCreateParamsBase(TypedDict, total=False):
149
127
  [service-tiers](https://docs.anthropic.com/en/api/service-tiers) for details.
150
128
  """
151
129
 
152
- stop_sequences: List[str]
130
+ stop_sequences: SequenceNotStr[str]
153
131
  """Custom text sequences that will cause the model to stop generating.
154
132
 
155
133
  Our models will normally stop when they have naturally completed their turn,
@@ -1,5 +1,6 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ from typing import Optional
3
4
  from typing_extensions import Literal
4
5
 
5
6
  from ..._models import BaseModel
@@ -11,4 +12,6 @@ __all__ = ["ErrorResponse"]
11
12
  class ErrorResponse(BaseModel):
12
13
  error: ErrorObject
13
14
 
15
+ request_id: Optional[str] = None
16
+
14
17
  type: Literal["error"]
@@ -2,9 +2,10 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, List, Union, Optional
5
+ from typing import Dict, Union, Optional
6
6
  from typing_extensions import Literal, Required, TypeAlias, TypedDict
7
7
 
8
+ from .._types import SequenceNotStr
8
9
  from .._models import set_pydantic_config
9
10
  from .cache_control_ephemeral_param import CacheControlEphemeralParam
10
11
 
@@ -16,7 +17,7 @@ class InputSchemaTyped(TypedDict, total=False):
16
17
 
17
18
  properties: Optional[object]
18
19
 
19
- required: Optional[List[str]]
20
+ required: Optional[SequenceNotStr[str]]
20
21
 
21
22
 
22
23
  set_pydantic_config(InputSchemaTyped, {"extra": "allow"})