anthropic 1.6.0 → 1.8.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +33 -0
- data/README.md +1 -1
- data/lib/anthropic/helpers/input_schema/array_of.rb +41 -0
- data/lib/anthropic/helpers/input_schema/base_model.rb +86 -0
- data/lib/anthropic/helpers/input_schema/boolean.rb +29 -0
- data/lib/anthropic/helpers/input_schema/enum_of.rb +63 -0
- data/lib/anthropic/helpers/input_schema/json_schema_converter.rb +199 -0
- data/lib/anthropic/helpers/input_schema/parsed_json.rb +39 -0
- data/lib/anthropic/helpers/input_schema/property_mapping.rb +47 -0
- data/lib/anthropic/helpers/input_schema/union_of.rb +56 -0
- data/lib/anthropic/helpers/input_schema.rb +16 -0
- data/lib/anthropic/helpers/streaming/message_stream.rb +41 -1
- data/lib/anthropic/input_schema.rb +10 -0
- data/lib/anthropic/internal/stream.rb +2 -1
- data/lib/anthropic/internal/transport/base_client.rb +1 -2
- data/lib/anthropic/internal/transport/pooled_net_requester.rb +1 -9
- data/lib/anthropic/internal/type/base_model.rb +2 -9
- data/lib/anthropic/internal/util.rb +1 -1
- data/lib/anthropic/models/beta/beta_bash_code_execution_output_block.rb +25 -0
- data/lib/anthropic/models/beta/beta_bash_code_execution_output_block_param.rb +25 -0
- data/lib/anthropic/models/beta/beta_bash_code_execution_result_block.rb +44 -0
- data/lib/anthropic/models/beta/beta_bash_code_execution_result_block_param.rb +44 -0
- data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rb +43 -0
- data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rb +53 -0
- data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rb +39 -0
- data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rb +39 -0
- data/lib/anthropic/models/beta/beta_code_execution_tool_20250825.rb +40 -0
- data/lib/anthropic/models/beta/beta_content_block.rb +6 -1
- data/lib/anthropic/models/beta/beta_content_block_param.rb +7 -1
- data/lib/anthropic/models/beta/beta_message.rb +2 -2
- data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
- data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +8 -3
- data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +2 -0
- data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +2 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rb +25 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rb +26 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rb +49 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rb +50 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rb +47 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rb +57 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rb +45 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rb +46 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rb +61 -0
- data/lib/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rb +62 -0
- data/lib/anthropic/models/beta/beta_tool_union.rb +3 -1
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +7 -30
- data/lib/anthropic/models/beta/message_create_params.rb +3 -26
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +6 -36
- data/lib/anthropic/models/beta/messages/beta_message_batch.rb +1 -4
- data/lib/anthropic/models/beta_error_response.rb +7 -1
- data/lib/anthropic/models/cache_control_ephemeral.rb +39 -1
- data/lib/anthropic/models/cache_creation.rb +24 -0
- data/lib/anthropic/models/error_response.rb +7 -1
- data/lib/anthropic/models/message_count_tokens_params.rb +1 -24
- data/lib/anthropic/models/message_create_params.rb +1 -24
- data/lib/anthropic/models/messages/batch_create_params.rb +2 -28
- data/lib/anthropic/models/model.rb +6 -0
- data/lib/anthropic/models/tool_use_block.rb +8 -0
- data/lib/anthropic/models/usage.rb +9 -1
- data/lib/anthropic/models.rb +2 -0
- data/lib/anthropic/resources/beta/messages.rb +3 -3
- data/lib/anthropic/resources/messages.rb +85 -1
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +30 -0
- data/rbi/anthropic/errors.rbi +2 -2
- data/rbi/anthropic/helpers/input_schema/array_of.rbi +16 -0
- data/rbi/anthropic/helpers/input_schema/base_model.rbi +21 -0
- data/rbi/anthropic/helpers/input_schema/boolean.rbi +11 -0
- data/rbi/anthropic/helpers/input_schema/enum_of.rbi +30 -0
- data/rbi/anthropic/helpers/input_schema/json_schema_converter.rbi +89 -0
- data/rbi/anthropic/helpers/input_schema/union_of.rbi +23 -0
- data/rbi/anthropic/helpers/structured_output.rbi +16 -0
- data/rbi/anthropic/input_schema.rbi +12 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_output_block.rbi +33 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_output_block_param.rbi +34 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_result_block.rbi +72 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_result_block_param.rbi +77 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rbi +86 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rbi +110 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rbi +101 -0
- data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rbi +101 -0
- data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +72 -0
- data/rbi/anthropic/models/beta/beta_content_block.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_content_block_param.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_message.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +4 -0
- data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +10 -0
- data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +10 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rbi +41 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rbi +41 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rbi +73 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rbi +73 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rbi +90 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rbi +118 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rbi +110 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rbi +110 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rbi +118 -0
- data/rbi/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rbi +118 -0
- data/rbi/anthropic/models/beta/beta_tool_union.rbi +1 -0
- data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +7 -48
- data/rbi/anthropic/models/beta/message_create_params.rbi +6 -48
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +6 -48
- data/rbi/anthropic/models/beta_error_response.rbi +10 -2
- data/rbi/anthropic/models/cache_control_ephemeral.rbi +68 -3
- data/rbi/anthropic/models/cache_creation.rbi +45 -0
- data/rbi/anthropic/models/error_response.rbi +10 -2
- data/rbi/anthropic/models/message_count_tokens_params.rbi +2 -48
- data/rbi/anthropic/models/message_create_params.rbi +2 -48
- data/rbi/anthropic/models/messages/batch_create_params.rbi +2 -48
- data/rbi/anthropic/models/usage.rbi +13 -0
- data/rbi/anthropic/models.rbi +2 -0
- data/rbi/anthropic/resources/beta/messages.rbi +6 -72
- data/rbi/anthropic/resources/messages.rbi +3 -72
- data/sig/anthropic/models/beta/beta_bash_code_execution_output_block.rbs +23 -0
- data/sig/anthropic/models/beta/beta_bash_code_execution_output_block_param.rbs +23 -0
- data/sig/anthropic/models/beta/beta_bash_code_execution_result_block.rbs +44 -0
- data/sig/anthropic/models/beta/beta_bash_code_execution_result_block_param.rbs +44 -0
- data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rbs +44 -0
- data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rbs +49 -0
- data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rbs +48 -0
- data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rbs +48 -0
- data/sig/anthropic/models/beta/beta_code_execution_tool_20250825.rbs +34 -0
- data/sig/anthropic/models/beta/beta_content_block.rbs +2 -0
- data/sig/anthropic/models/beta/beta_content_block_param.rbs +2 -0
- data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +2 -0
- data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +7 -1
- data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +7 -1
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rbs +29 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rbs +29 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rbs +49 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rbs +49 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rbs +46 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rbs +51 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rbs +53 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rbs +53 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rbs +61 -0
- data/sig/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rbs +61 -0
- data/sig/anthropic/models/beta/beta_tool_union.rbs +1 -0
- data/sig/anthropic/models/beta/message_count_tokens_params.rbs +1 -0
- data/sig/anthropic/models/beta_error_response.rbs +13 -2
- data/sig/anthropic/models/cache_control_ephemeral.rbs +27 -3
- data/sig/anthropic/models/cache_creation.rbs +25 -0
- data/sig/anthropic/models/error_response.rbs +13 -2
- data/sig/anthropic/models/usage.rbs +5 -0
- data/sig/anthropic/models.rbs +2 -0
- metadata +80 -2
@@ -72,30 +72,7 @@ module Anthropic
|
|
72
72
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
73
73
|
# ```
|
74
74
|
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
# ```json
|
78
|
-
# {
|
79
|
-
# "role": "user",
|
80
|
-
# "content": [
|
81
|
-
# {
|
82
|
-
# "type": "image",
|
83
|
-
# "source": {
|
84
|
-
# "type": "base64",
|
85
|
-
# "media_type": "image/jpeg",
|
86
|
-
# "data": "/9j/4AAQSkZJRg..."
|
87
|
-
# }
|
88
|
-
# },
|
89
|
-
# { "type": "text", "text": "What is in this image?" }
|
90
|
-
# ]
|
91
|
-
# }
|
92
|
-
# ```
|
93
|
-
#
|
94
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
95
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
96
|
-
#
|
97
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
98
|
-
# more input examples.
|
75
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
99
76
|
#
|
100
77
|
# Note that if you want to include a
|
101
78
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
@@ -298,6 +275,7 @@ module Anthropic
|
|
298
275
|
Anthropic::Beta::BetaToolBash20241022,
|
299
276
|
Anthropic::Beta::BetaToolBash20250124,
|
300
277
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
278
|
+
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
301
279
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
302
280
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
303
281
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
@@ -321,6 +299,7 @@ module Anthropic
|
|
321
299
|
Anthropic::Beta::BetaToolBash20241022::OrHash,
|
322
300
|
Anthropic::Beta::BetaToolBash20250124::OrHash,
|
323
301
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
302
|
+
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
324
303
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
325
304
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
326
305
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
@@ -380,6 +359,7 @@ module Anthropic
|
|
380
359
|
Anthropic::Beta::BetaToolBash20241022::OrHash,
|
381
360
|
Anthropic::Beta::BetaToolBash20250124::OrHash,
|
382
361
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
362
|
+
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
383
363
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
384
364
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
385
365
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
@@ -451,30 +431,7 @@ module Anthropic
|
|
451
431
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
452
432
|
# ```
|
453
433
|
#
|
454
|
-
#
|
455
|
-
#
|
456
|
-
# ```json
|
457
|
-
# {
|
458
|
-
# "role": "user",
|
459
|
-
# "content": [
|
460
|
-
# {
|
461
|
-
# "type": "image",
|
462
|
-
# "source": {
|
463
|
-
# "type": "base64",
|
464
|
-
# "media_type": "image/jpeg",
|
465
|
-
# "data": "/9j/4AAQSkZJRg..."
|
466
|
-
# }
|
467
|
-
# },
|
468
|
-
# { "type": "text", "text": "What is in this image?" }
|
469
|
-
# ]
|
470
|
-
# }
|
471
|
-
# ```
|
472
|
-
#
|
473
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
474
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
475
|
-
#
|
476
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
477
|
-
# more input examples.
|
434
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
478
435
|
#
|
479
436
|
# Note that if you want to include a
|
480
437
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
@@ -618,6 +575,7 @@ module Anthropic
|
|
618
575
|
Anthropic::Beta::BetaToolBash20241022,
|
619
576
|
Anthropic::Beta::BetaToolBash20250124,
|
620
577
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
578
|
+
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
621
579
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
622
580
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
623
581
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
@@ -678,6 +636,7 @@ module Anthropic
|
|
678
636
|
Anthropic::Beta::BetaToolBash20241022,
|
679
637
|
Anthropic::Beta::BetaToolBash20250124,
|
680
638
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
639
|
+
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
681
640
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
682
641
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
683
642
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
@@ -82,30 +82,7 @@ module Anthropic
|
|
82
82
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
83
83
|
# ```
|
84
84
|
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
# ```json
|
88
|
-
# {
|
89
|
-
# "role": "user",
|
90
|
-
# "content": [
|
91
|
-
# {
|
92
|
-
# "type": "image",
|
93
|
-
# "source": {
|
94
|
-
# "type": "base64",
|
95
|
-
# "media_type": "image/jpeg",
|
96
|
-
# "data": "/9j/4AAQSkZJRg..."
|
97
|
-
# }
|
98
|
-
# },
|
99
|
-
# { "type": "text", "text": "What is in this image?" }
|
100
|
-
# ]
|
101
|
-
# }
|
102
|
-
# ```
|
103
|
-
#
|
104
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
105
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
106
|
-
#
|
107
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
108
|
-
# more input examples.
|
85
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
109
86
|
#
|
110
87
|
# Note that if you want to include a
|
111
88
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
@@ -368,6 +345,7 @@ module Anthropic
|
|
368
345
|
Anthropic::Beta::BetaToolBash20241022,
|
369
346
|
Anthropic::Beta::BetaToolBash20250124,
|
370
347
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
348
|
+
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
371
349
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
372
350
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
373
351
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
@@ -391,6 +369,7 @@ module Anthropic
|
|
391
369
|
Anthropic::Beta::BetaToolBash20241022::OrHash,
|
392
370
|
Anthropic::Beta::BetaToolBash20250124::OrHash,
|
393
371
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
372
|
+
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
394
373
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
395
374
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
396
375
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
@@ -484,6 +463,7 @@ module Anthropic
|
|
484
463
|
Anthropic::Beta::BetaToolBash20241022::OrHash,
|
485
464
|
Anthropic::Beta::BetaToolBash20250124::OrHash,
|
486
465
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
466
|
+
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
487
467
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
488
468
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
489
469
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
@@ -565,30 +545,7 @@ module Anthropic
|
|
565
545
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
566
546
|
# ```
|
567
547
|
#
|
568
|
-
#
|
569
|
-
#
|
570
|
-
# ```json
|
571
|
-
# {
|
572
|
-
# "role": "user",
|
573
|
-
# "content": [
|
574
|
-
# {
|
575
|
-
# "type": "image",
|
576
|
-
# "source": {
|
577
|
-
# "type": "base64",
|
578
|
-
# "media_type": "image/jpeg",
|
579
|
-
# "data": "/9j/4AAQSkZJRg..."
|
580
|
-
# }
|
581
|
-
# },
|
582
|
-
# { "type": "text", "text": "What is in this image?" }
|
583
|
-
# ]
|
584
|
-
# }
|
585
|
-
# ```
|
586
|
-
#
|
587
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
588
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
589
|
-
#
|
590
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
591
|
-
# more input examples.
|
548
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
592
549
|
#
|
593
550
|
# Note that if you want to include a
|
594
551
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
@@ -785,6 +742,7 @@ module Anthropic
|
|
785
742
|
Anthropic::Beta::BetaToolBash20241022,
|
786
743
|
Anthropic::Beta::BetaToolBash20250124,
|
787
744
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
745
|
+
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
788
746
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
789
747
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
790
748
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
@@ -223,30 +223,7 @@ module Anthropic
|
|
223
223
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
224
224
|
# ```
|
225
225
|
#
|
226
|
-
#
|
227
|
-
#
|
228
|
-
# ```json
|
229
|
-
# {
|
230
|
-
# "role": "user",
|
231
|
-
# "content": [
|
232
|
-
# {
|
233
|
-
# "type": "image",
|
234
|
-
# "source": {
|
235
|
-
# "type": "base64",
|
236
|
-
# "media_type": "image/jpeg",
|
237
|
-
# "data": "/9j/4AAQSkZJRg..."
|
238
|
-
# }
|
239
|
-
# },
|
240
|
-
# { "type": "text", "text": "What is in this image?" }
|
241
|
-
# ]
|
242
|
-
# }
|
243
|
-
# ```
|
244
|
-
#
|
245
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
246
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
247
|
-
#
|
248
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
249
|
-
# more input examples.
|
226
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
250
227
|
#
|
251
228
|
# Note that if you want to include a
|
252
229
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
@@ -524,6 +501,7 @@ module Anthropic
|
|
524
501
|
Anthropic::Beta::BetaToolBash20241022,
|
525
502
|
Anthropic::Beta::BetaToolBash20250124,
|
526
503
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
504
|
+
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
527
505
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
528
506
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
529
507
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
@@ -547,6 +525,7 @@ module Anthropic
|
|
547
525
|
Anthropic::Beta::BetaToolBash20241022::OrHash,
|
548
526
|
Anthropic::Beta::BetaToolBash20250124::OrHash,
|
549
527
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
528
|
+
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
550
529
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
551
530
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
552
531
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
@@ -629,6 +608,7 @@ module Anthropic
|
|
629
608
|
Anthropic::Beta::BetaToolBash20241022::OrHash,
|
630
609
|
Anthropic::Beta::BetaToolBash20250124::OrHash,
|
631
610
|
Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
|
611
|
+
Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
|
632
612
|
Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
|
633
613
|
Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
|
634
614
|
Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
|
@@ -708,30 +688,7 @@ module Anthropic
|
|
708
688
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
709
689
|
# ```
|
710
690
|
#
|
711
|
-
#
|
712
|
-
#
|
713
|
-
# ```json
|
714
|
-
# {
|
715
|
-
# "role": "user",
|
716
|
-
# "content": [
|
717
|
-
# {
|
718
|
-
# "type": "image",
|
719
|
-
# "source": {
|
720
|
-
# "type": "base64",
|
721
|
-
# "media_type": "image/jpeg",
|
722
|
-
# "data": "/9j/4AAQSkZJRg..."
|
723
|
-
# }
|
724
|
-
# },
|
725
|
-
# { "type": "text", "text": "What is in this image?" }
|
726
|
-
# ]
|
727
|
-
# }
|
728
|
-
# ```
|
729
|
-
#
|
730
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
731
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
732
|
-
#
|
733
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
734
|
-
# more input examples.
|
691
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
735
692
|
#
|
736
693
|
# Note that if you want to include a
|
737
694
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
@@ -934,6 +891,7 @@ module Anthropic
|
|
934
891
|
Anthropic::Beta::BetaToolBash20241022,
|
935
892
|
Anthropic::Beta::BetaToolBash20250124,
|
936
893
|
Anthropic::Beta::BetaCodeExecutionTool20250522,
|
894
|
+
Anthropic::Beta::BetaCodeExecutionTool20250825,
|
937
895
|
Anthropic::Beta::BetaToolComputerUse20241022,
|
938
896
|
Anthropic::Beta::BetaToolComputerUse20250124,
|
939
897
|
Anthropic::Beta::BetaToolTextEditor20241022,
|
@@ -11,6 +11,9 @@ module Anthropic
|
|
11
11
|
sig { returns(Anthropic::BetaError::Variants) }
|
12
12
|
attr_accessor :error
|
13
13
|
|
14
|
+
sig { returns(T.nilable(String)) }
|
15
|
+
attr_accessor :request_id
|
16
|
+
|
14
17
|
sig { returns(Symbol) }
|
15
18
|
attr_accessor :type
|
16
19
|
|
@@ -28,15 +31,20 @@ module Anthropic
|
|
28
31
|
Anthropic::BetaAPIError::OrHash,
|
29
32
|
Anthropic::BetaOverloadedError::OrHash
|
30
33
|
),
|
34
|
+
request_id: T.nilable(String),
|
31
35
|
type: Symbol
|
32
36
|
).returns(T.attached_class)
|
33
37
|
end
|
34
|
-
def self.new(error:, type: :error)
|
38
|
+
def self.new(error:, request_id:, type: :error)
|
35
39
|
end
|
36
40
|
|
37
41
|
sig do
|
38
42
|
override.returns(
|
39
|
-
{
|
43
|
+
{
|
44
|
+
error: Anthropic::BetaError::Variants,
|
45
|
+
request_id: T.nilable(String),
|
46
|
+
type: Symbol
|
47
|
+
}
|
40
48
|
)
|
41
49
|
end
|
42
50
|
def to_hash
|
@@ -11,13 +11,78 @@ module Anthropic
|
|
11
11
|
sig { returns(Symbol) }
|
12
12
|
attr_accessor :type
|
13
13
|
|
14
|
-
|
15
|
-
|
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
|
+
sig do
|
23
|
+
returns(T.nilable(Anthropic::CacheControlEphemeral::TTL::OrSymbol))
|
16
24
|
end
|
25
|
+
attr_reader :ttl
|
17
26
|
|
18
|
-
sig {
|
27
|
+
sig { params(ttl: Anthropic::CacheControlEphemeral::TTL::OrSymbol).void }
|
28
|
+
attr_writer :ttl
|
29
|
+
|
30
|
+
sig do
|
31
|
+
params(
|
32
|
+
ttl: Anthropic::CacheControlEphemeral::TTL::OrSymbol,
|
33
|
+
type: Symbol
|
34
|
+
).returns(T.attached_class)
|
35
|
+
end
|
36
|
+
def self.new(
|
37
|
+
# The time-to-live for the cache control breakpoint.
|
38
|
+
#
|
39
|
+
# This may be one the following values:
|
40
|
+
#
|
41
|
+
# - `5m`: 5 minutes
|
42
|
+
# - `1h`: 1 hour
|
43
|
+
#
|
44
|
+
# Defaults to `5m`.
|
45
|
+
ttl: nil,
|
46
|
+
type: :ephemeral
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
sig do
|
51
|
+
override.returns(
|
52
|
+
{ type: Symbol, ttl: Anthropic::CacheControlEphemeral::TTL::OrSymbol }
|
53
|
+
)
|
54
|
+
end
|
19
55
|
def to_hash
|
20
56
|
end
|
57
|
+
|
58
|
+
# The time-to-live for the cache control breakpoint.
|
59
|
+
#
|
60
|
+
# This may be one the following values:
|
61
|
+
#
|
62
|
+
# - `5m`: 5 minutes
|
63
|
+
# - `1h`: 1 hour
|
64
|
+
#
|
65
|
+
# Defaults to `5m`.
|
66
|
+
module TTL
|
67
|
+
extend Anthropic::Internal::Type::Enum
|
68
|
+
|
69
|
+
TaggedSymbol =
|
70
|
+
T.type_alias { T.all(Symbol, Anthropic::CacheControlEphemeral::TTL) }
|
71
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
72
|
+
|
73
|
+
TTL_5M =
|
74
|
+
T.let(:"5m", Anthropic::CacheControlEphemeral::TTL::TaggedSymbol)
|
75
|
+
TTL_1H =
|
76
|
+
T.let(:"1h", Anthropic::CacheControlEphemeral::TTL::TaggedSymbol)
|
77
|
+
|
78
|
+
sig do
|
79
|
+
override.returns(
|
80
|
+
T::Array[Anthropic::CacheControlEphemeral::TTL::TaggedSymbol]
|
81
|
+
)
|
82
|
+
end
|
83
|
+
def self.values
|
84
|
+
end
|
85
|
+
end
|
21
86
|
end
|
22
87
|
end
|
23
88
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
class CacheCreation < Anthropic::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(Anthropic::CacheCreation, Anthropic::Internal::AnyHash)
|
9
|
+
end
|
10
|
+
|
11
|
+
# The number of input tokens used to create the 1 hour cache entry.
|
12
|
+
sig { returns(Integer) }
|
13
|
+
attr_accessor :ephemeral_1h_input_tokens
|
14
|
+
|
15
|
+
# The number of input tokens used to create the 5 minute cache entry.
|
16
|
+
sig { returns(Integer) }
|
17
|
+
attr_accessor :ephemeral_5m_input_tokens
|
18
|
+
|
19
|
+
sig do
|
20
|
+
params(
|
21
|
+
ephemeral_1h_input_tokens: Integer,
|
22
|
+
ephemeral_5m_input_tokens: Integer
|
23
|
+
).returns(T.attached_class)
|
24
|
+
end
|
25
|
+
def self.new(
|
26
|
+
# The number of input tokens used to create the 1 hour cache entry.
|
27
|
+
ephemeral_1h_input_tokens:,
|
28
|
+
# The number of input tokens used to create the 5 minute cache entry.
|
29
|
+
ephemeral_5m_input_tokens:
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
sig do
|
34
|
+
override.returns(
|
35
|
+
{
|
36
|
+
ephemeral_1h_input_tokens: Integer,
|
37
|
+
ephemeral_5m_input_tokens: Integer
|
38
|
+
}
|
39
|
+
)
|
40
|
+
end
|
41
|
+
def to_hash
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -11,6 +11,9 @@ module Anthropic
|
|
11
11
|
sig { returns(Anthropic::ErrorObject::Variants) }
|
12
12
|
attr_accessor :error
|
13
13
|
|
14
|
+
sig { returns(T.nilable(String)) }
|
15
|
+
attr_accessor :request_id
|
16
|
+
|
14
17
|
sig { returns(Symbol) }
|
15
18
|
attr_accessor :type
|
16
19
|
|
@@ -28,15 +31,20 @@ module Anthropic
|
|
28
31
|
Anthropic::APIErrorObject::OrHash,
|
29
32
|
Anthropic::OverloadedError::OrHash
|
30
33
|
),
|
34
|
+
request_id: T.nilable(String),
|
31
35
|
type: Symbol
|
32
36
|
).returns(T.attached_class)
|
33
37
|
end
|
34
|
-
def self.new(error:, type: :error)
|
38
|
+
def self.new(error:, request_id:, type: :error)
|
35
39
|
end
|
36
40
|
|
37
41
|
sig do
|
38
42
|
override.returns(
|
39
|
-
{
|
43
|
+
{
|
44
|
+
error: Anthropic::ErrorObject::Variants,
|
45
|
+
request_id: T.nilable(String),
|
46
|
+
type: Symbol
|
47
|
+
}
|
40
48
|
)
|
41
49
|
end
|
42
50
|
def to_hash
|
@@ -71,30 +71,7 @@ module Anthropic
|
|
71
71
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
72
72
|
# ```
|
73
73
|
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
# ```json
|
77
|
-
# {
|
78
|
-
# "role": "user",
|
79
|
-
# "content": [
|
80
|
-
# {
|
81
|
-
# "type": "image",
|
82
|
-
# "source": {
|
83
|
-
# "type": "base64",
|
84
|
-
# "media_type": "image/jpeg",
|
85
|
-
# "data": "/9j/4AAQSkZJRg..."
|
86
|
-
# }
|
87
|
-
# },
|
88
|
-
# { "type": "text", "text": "What is in this image?" }
|
89
|
-
# ]
|
90
|
-
# }
|
91
|
-
# ```
|
92
|
-
#
|
93
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
94
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
95
|
-
#
|
96
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
97
|
-
# more input examples.
|
74
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
98
75
|
#
|
99
76
|
# Note that if you want to include a
|
100
77
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
@@ -390,30 +367,7 @@ module Anthropic
|
|
390
367
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
391
368
|
# ```
|
392
369
|
#
|
393
|
-
#
|
394
|
-
#
|
395
|
-
# ```json
|
396
|
-
# {
|
397
|
-
# "role": "user",
|
398
|
-
# "content": [
|
399
|
-
# {
|
400
|
-
# "type": "image",
|
401
|
-
# "source": {
|
402
|
-
# "type": "base64",
|
403
|
-
# "media_type": "image/jpeg",
|
404
|
-
# "data": "/9j/4AAQSkZJRg..."
|
405
|
-
# }
|
406
|
-
# },
|
407
|
-
# { "type": "text", "text": "What is in this image?" }
|
408
|
-
# ]
|
409
|
-
# }
|
410
|
-
# ```
|
411
|
-
#
|
412
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
413
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
414
|
-
#
|
415
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
416
|
-
# more input examples.
|
370
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
417
371
|
#
|
418
372
|
# Note that if you want to include a
|
419
373
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
@@ -78,30 +78,7 @@ module Anthropic
|
|
78
78
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
79
79
|
# ```
|
80
80
|
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
# ```json
|
84
|
-
# {
|
85
|
-
# "role": "user",
|
86
|
-
# "content": [
|
87
|
-
# {
|
88
|
-
# "type": "image",
|
89
|
-
# "source": {
|
90
|
-
# "type": "base64",
|
91
|
-
# "media_type": "image/jpeg",
|
92
|
-
# "data": "/9j/4AAQSkZJRg..."
|
93
|
-
# }
|
94
|
-
# },
|
95
|
-
# { "type": "text", "text": "What is in this image?" }
|
96
|
-
# ]
|
97
|
-
# }
|
98
|
-
# ```
|
99
|
-
#
|
100
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
101
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
102
|
-
#
|
103
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
104
|
-
# more input examples.
|
81
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
105
82
|
#
|
106
83
|
# Note that if you want to include a
|
107
84
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
@@ -491,30 +468,7 @@ module Anthropic
|
|
491
468
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
492
469
|
# ```
|
493
470
|
#
|
494
|
-
#
|
495
|
-
#
|
496
|
-
# ```json
|
497
|
-
# {
|
498
|
-
# "role": "user",
|
499
|
-
# "content": [
|
500
|
-
# {
|
501
|
-
# "type": "image",
|
502
|
-
# "source": {
|
503
|
-
# "type": "base64",
|
504
|
-
# "media_type": "image/jpeg",
|
505
|
-
# "data": "/9j/4AAQSkZJRg..."
|
506
|
-
# }
|
507
|
-
# },
|
508
|
-
# { "type": "text", "text": "What is in this image?" }
|
509
|
-
# ]
|
510
|
-
# }
|
511
|
-
# ```
|
512
|
-
#
|
513
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
514
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
515
|
-
#
|
516
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
517
|
-
# more input examples.
|
471
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
518
472
|
#
|
519
473
|
# Note that if you want to include a
|
520
474
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
@@ -190,30 +190,7 @@ module Anthropic
|
|
190
190
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
191
191
|
# ```
|
192
192
|
#
|
193
|
-
#
|
194
|
-
#
|
195
|
-
# ```json
|
196
|
-
# {
|
197
|
-
# "role": "user",
|
198
|
-
# "content": [
|
199
|
-
# {
|
200
|
-
# "type": "image",
|
201
|
-
# "source": {
|
202
|
-
# "type": "base64",
|
203
|
-
# "media_type": "image/jpeg",
|
204
|
-
# "data": "/9j/4AAQSkZJRg..."
|
205
|
-
# }
|
206
|
-
# },
|
207
|
-
# { "type": "text", "text": "What is in this image?" }
|
208
|
-
# ]
|
209
|
-
# }
|
210
|
-
# ```
|
211
|
-
#
|
212
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
213
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
214
|
-
#
|
215
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
216
|
-
# more input examples.
|
193
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
217
194
|
#
|
218
195
|
# Note that if you want to include a
|
219
196
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
@@ -629,30 +606,7 @@ module Anthropic
|
|
629
606
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
630
607
|
# ```
|
631
608
|
#
|
632
|
-
#
|
633
|
-
#
|
634
|
-
# ```json
|
635
|
-
# {
|
636
|
-
# "role": "user",
|
637
|
-
# "content": [
|
638
|
-
# {
|
639
|
-
# "type": "image",
|
640
|
-
# "source": {
|
641
|
-
# "type": "base64",
|
642
|
-
# "media_type": "image/jpeg",
|
643
|
-
# "data": "/9j/4AAQSkZJRg..."
|
644
|
-
# }
|
645
|
-
# },
|
646
|
-
# { "type": "text", "text": "What is in this image?" }
|
647
|
-
# ]
|
648
|
-
# }
|
649
|
-
# ```
|
650
|
-
#
|
651
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
652
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
653
|
-
#
|
654
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
655
|
-
# more input examples.
|
609
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
656
610
|
#
|
657
611
|
# Note that if you want to include a
|
658
612
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|