anthropic 1.1.1 → 1.9.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 +170 -0
- data/README.md +32 -16
- data/lib/anthropic/client.rb +5 -2
- data/lib/anthropic/errors.rb +22 -0
- data/lib/anthropic/helpers/bedrock/client.rb +34 -4
- 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/events.rb +141 -0
- data/lib/anthropic/helpers/streaming/message_stream.rb +278 -0
- data/lib/anthropic/helpers/streaming.rb +37 -0
- data/lib/anthropic/helpers/vertex/client.rb +4 -1
- data/lib/anthropic/input_schema.rb +10 -0
- data/lib/anthropic/internal/stream.rb +6 -3
- data/lib/anthropic/internal/transport/base_client.rb +30 -5
- data/lib/anthropic/internal/transport/pooled_net_requester.rb +1 -9
- data/lib/anthropic/internal/type/array_of.rb +7 -1
- data/lib/anthropic/internal/type/base_model.rb +81 -32
- data/lib/anthropic/internal/type/base_stream.rb +3 -1
- data/lib/anthropic/internal/type/boolean.rb +7 -1
- data/lib/anthropic/internal/type/converter.rb +69 -34
- data/lib/anthropic/internal/type/enum.rb +16 -5
- data/lib/anthropic/internal/type/file_input.rb +6 -1
- data/lib/anthropic/internal/type/hash_of.rb +7 -1
- data/lib/anthropic/internal/type/union.rb +26 -16
- data/lib/anthropic/internal/type/unknown.rb +7 -1
- data/lib/anthropic/internal/util.rb +10 -11
- data/lib/anthropic/models/anthropic_beta.rb +3 -0
- data/lib/anthropic/models/beta/beta_base64_pdf_block.rb +1 -65
- 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_citation_char_location.rb +7 -1
- data/lib/anthropic/models/beta/beta_citation_config.rb +19 -0
- data/lib/anthropic/models/beta/beta_citation_content_block_location.rb +7 -1
- data/lib/anthropic/models/beta/beta_citation_page_location.rb +7 -1
- data/lib/anthropic/models/beta/beta_citation_search_result_location.rb +55 -0
- data/lib/anthropic/models/beta/beta_citation_search_result_location_param.rb +55 -0
- data/lib/anthropic/models/beta/beta_citations_delta.rb +5 -3
- data/lib/anthropic/models/beta/beta_code_execution_tool_20250825.rb +40 -0
- data/lib/anthropic/models/beta/beta_content_block.rb +12 -5
- data/lib/anthropic/models/beta/beta_content_block_param.rb +28 -17
- data/lib/anthropic/models/beta/beta_document_block.rb +56 -0
- data/lib/anthropic/models/beta/beta_message.rb +6 -2
- data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
- data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +14 -7
- data/lib/anthropic/models/beta/beta_request_document_block.rb +75 -0
- data/lib/anthropic/models/beta/beta_search_result_block_param.rb +55 -0
- data/lib/anthropic/models/beta/beta_server_tool_usage.rb +9 -1
- data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +3 -0
- data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +3 -0
- data/lib/anthropic/models/beta/beta_text_block.rb +2 -2
- data/lib/anthropic/models/beta/beta_text_block_param.rb +2 -2
- data/lib/anthropic/models/beta/beta_text_citation.rb +3 -1
- data/lib/anthropic/models/beta/beta_text_citation_param.rb +3 -1
- 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.rb +7 -1
- data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +8 -4
- data/lib/anthropic/models/beta/beta_tool_text_editor_20250728.rb +49 -0
- data/lib/anthropic/models/beta/beta_tool_union.rb +12 -6
- data/lib/anthropic/models/beta/beta_web_fetch_block.rb +42 -0
- data/lib/anthropic/models/beta/beta_web_fetch_block_param.rb +42 -0
- data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +82 -0
- data/lib/anthropic/models/beta/beta_web_fetch_tool_result_block.rb +43 -0
- data/lib/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rb +53 -0
- data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rb +25 -0
- data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rb +25 -0
- data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rb +25 -0
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +23 -36
- data/lib/anthropic/models/beta/message_create_params.rb +10 -27
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +13 -37
- 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/citation_char_location.rb +7 -1
- data/lib/anthropic/models/citation_content_block_location.rb +7 -1
- data/lib/anthropic/models/citation_page_location.rb +7 -1
- data/lib/anthropic/models/citation_search_result_location_param.rb +51 -0
- data/lib/anthropic/models/citations_delta.rb +5 -3
- data/lib/anthropic/models/citations_search_result_location.rb +51 -0
- data/lib/anthropic/models/content_block.rb +5 -5
- data/lib/anthropic/models/content_block_param.rb +14 -11
- data/lib/anthropic/models/document_block_param.rb +2 -2
- data/lib/anthropic/models/error_response.rb +7 -1
- data/lib/anthropic/models/message.rb +6 -2
- data/lib/anthropic/models/message_count_tokens_params.rb +10 -27
- data/lib/anthropic/models/message_count_tokens_tool.rb +5 -1
- data/lib/anthropic/models/message_create_params.rb +10 -27
- data/lib/anthropic/models/message_param.rb +3 -3
- data/lib/anthropic/models/messages/batch_create_params.rb +11 -31
- data/lib/anthropic/models/model.rb +16 -21
- data/lib/anthropic/models/raw_content_block_start_event.rb +7 -7
- data/lib/anthropic/models/search_result_block_param.rb +51 -0
- data/lib/anthropic/models/text_block.rb +2 -2
- data/lib/anthropic/models/text_block_param.rb +2 -2
- data/lib/anthropic/models/text_citation.rb +3 -1
- data/lib/anthropic/models/text_citation_param.rb +3 -1
- data/lib/anthropic/models/tool.rb +7 -1
- data/lib/anthropic/models/tool_result_block_param.rb +8 -4
- data/lib/anthropic/models/tool_text_editor_20250429.rb +36 -0
- data/lib/anthropic/models/tool_text_editor_20250728.rb +45 -0
- data/lib/anthropic/models/tool_union.rb +5 -1
- data/lib/anthropic/models/tool_use_block.rb +14 -0
- data/lib/anthropic/models/usage.rb +9 -1
- data/lib/anthropic/models.rb +16 -4
- data/lib/anthropic/resources/beta/messages.rb +73 -6
- data/lib/anthropic/resources/messages.rb +152 -7
- data/lib/anthropic/streaming.rb +5 -0
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +54 -0
- data/rbi/anthropic/errors.rbi +18 -2
- data/rbi/anthropic/helpers/bedrock/client.rbi +17 -6
- 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/streaming/events.rbi +95 -0
- data/rbi/anthropic/helpers/streaming/message_stream.rbi +73 -0
- data/rbi/anthropic/helpers/structured_output.rbi +16 -0
- data/rbi/anthropic/helpers/vertex/client.rbi +17 -6
- data/rbi/anthropic/input_schema.rbi +12 -0
- data/rbi/anthropic/internal/transport/base_client.rbi +1 -1
- data/rbi/anthropic/internal/type/base_stream.rbi +8 -1
- data/rbi/anthropic/internal/type/boolean.rbi +2 -0
- data/rbi/anthropic/internal/type/converter.rbi +69 -15
- data/rbi/anthropic/internal/type/union.rbi +14 -2
- data/rbi/anthropic/internal/type/unknown.rbi +2 -0
- data/rbi/anthropic/internal/util.rbi +2 -0
- data/rbi/anthropic/models/anthropic_beta.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_base64_pdf_block.rbi +1 -128
- 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_citation_char_location.rbi +6 -0
- data/rbi/anthropic/models/beta/beta_citation_config.rbi +30 -0
- data/rbi/anthropic/models/beta/beta_citation_content_block_location.rbi +6 -0
- data/rbi/anthropic/models/beta/beta_citation_page_location.rbi +6 -0
- data/rbi/anthropic/models/beta/beta_citation_search_result_location.rbi +78 -0
- data/rbi/anthropic/models/beta/beta_citation_search_result_location_param.rbi +79 -0
- data/rbi/anthropic/models/beta/beta_citations_delta.rbi +4 -2
- data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +72 -0
- data/rbi/anthropic/models/beta/beta_content_block.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_content_block_param.rbi +11 -7
- data/rbi/anthropic/models/beta/beta_document_block.rbi +95 -0
- data/rbi/anthropic/models/beta/beta_message.rbi +14 -3
- data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +12 -6
- data/rbi/anthropic/models/beta/beta_request_document_block.rbi +142 -0
- data/rbi/anthropic/models/beta/beta_search_result_block_param.rbi +91 -0
- data/rbi/anthropic/models/beta/beta_server_tool_usage.rbi +17 -2
- data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +15 -0
- data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +15 -0
- data/rbi/anthropic/models/beta/beta_text_block.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_text_block_param.rbi +6 -3
- data/rbi/anthropic/models/beta/beta_text_citation.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_text_citation_param.rbi +2 -1
- 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.rbi +14 -5
- data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +3 -1
- data/rbi/anthropic/models/beta/beta_tool_text_editor_20250728.rbi +82 -0
- data/rbi/anthropic/models/beta/beta_tool_union.rbi +7 -4
- data/rbi/anthropic/models/beta/beta_web_fetch_block.rbi +67 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_block_param.rbi +71 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +125 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_block.rbi +81 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rbi +109 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rbi +51 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rbi +50 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rbi +70 -0
- data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +51 -70
- data/rbi/anthropic/models/beta/message_create_params.rbi +44 -66
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +44 -66
- 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/citation_char_location.rbi +6 -0
- data/rbi/anthropic/models/citation_content_block_location.rbi +6 -0
- data/rbi/anthropic/models/citation_page_location.rbi +6 -0
- data/rbi/anthropic/models/citation_search_result_location_param.rbi +74 -0
- data/rbi/anthropic/models/citations_delta.rbi +4 -2
- data/rbi/anthropic/models/citations_search_result_location.rbi +74 -0
- data/rbi/anthropic/models/content_block.rbi +3 -3
- data/rbi/anthropic/models/content_block_param.rbi +6 -5
- data/rbi/anthropic/models/document_block_param.rbi +7 -3
- data/rbi/anthropic/models/error_response.rbi +10 -2
- data/rbi/anthropic/models/message.rbi +11 -3
- data/rbi/anthropic/models/message_count_tokens_params.rbi +24 -50
- data/rbi/anthropic/models/message_count_tokens_tool.rbi +2 -0
- data/rbi/anthropic/models/message_create_params.rbi +24 -50
- data/rbi/anthropic/models/messages/batch_create_params.rbi +24 -50
- data/rbi/anthropic/models/model.rbi +4 -8
- data/rbi/anthropic/models/raw_content_block_start_event.rbi +6 -6
- data/rbi/anthropic/models/search_result_block_param.rbi +77 -0
- data/rbi/anthropic/models/text_block.rbi +2 -1
- data/rbi/anthropic/models/text_block_param.rbi +6 -3
- data/rbi/anthropic/models/text_citation.rbi +2 -1
- data/rbi/anthropic/models/text_citation_param.rbi +2 -1
- data/rbi/anthropic/models/tool.rbi +16 -5
- data/rbi/anthropic/models/tool_result_block_param.rbi +6 -1
- data/rbi/anthropic/models/tool_text_editor_20250429.rbi +62 -0
- data/rbi/anthropic/models/tool_text_editor_20250728.rbi +72 -0
- data/rbi/anthropic/models/tool_union.rbi +2 -0
- data/rbi/anthropic/models/usage.rbi +13 -0
- data/rbi/anthropic/models.rbi +14 -0
- data/rbi/anthropic/resources/beta/messages.rbi +45 -87
- data/rbi/anthropic/resources/messages.rbi +315 -69
- data/rbi/anthropic/streaming.rbi +5 -0
- data/sig/anthropic/errors.rbs +9 -0
- data/sig/anthropic/helpers/streaming/events.rbs +117 -0
- data/sig/anthropic/helpers/streaming/message_stream.rbs +57 -0
- data/sig/anthropic/internal/transport/base_client.rbs +1 -1
- data/sig/anthropic/internal/type/base_stream.rbs +4 -0
- data/sig/anthropic/internal/type/converter.rbs +24 -1
- data/sig/anthropic/internal/type/union.rbs +2 -2
- data/sig/anthropic/models/anthropic_beta.rbs +2 -0
- data/sig/anthropic/models/beta/beta_base64_pdf_block.rbs +1 -58
- 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_citation_char_location.rbs +5 -0
- data/sig/anthropic/models/beta/beta_citation_config.rbs +17 -0
- data/sig/anthropic/models/beta/beta_citation_content_block_location.rbs +5 -0
- data/sig/anthropic/models/beta/beta_citation_page_location.rbs +5 -0
- data/sig/anthropic/models/beta/beta_citation_search_result_location.rbs +54 -0
- data/sig/anthropic/models/beta/beta_citation_search_result_location_param.rbs +54 -0
- data/sig/anthropic/models/beta/beta_citations_delta.rbs +1 -0
- data/sig/anthropic/models/beta/beta_code_execution_tool_20250825.rbs +34 -0
- data/sig/anthropic/models/beta/beta_content_block.rbs +5 -2
- data/sig/anthropic/models/beta/beta_content_block_param.rbs +12 -8
- data/sig/anthropic/models/beta/beta_document_block.rbs +49 -0
- data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +5 -2
- data/sig/anthropic/models/beta/beta_request_document_block.rbs +62 -0
- data/sig/anthropic/models/beta/beta_search_result_block_param.rbs +53 -0
- data/sig/anthropic/models/beta/beta_server_tool_usage.rbs +12 -3
- data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +9 -1
- data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +9 -1
- data/sig/anthropic/models/beta/beta_text_citation.rbs +1 -0
- data/sig/anthropic/models/beta/beta_text_citation_param.rbs +1 -0
- 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.rbs +14 -3
- data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +2 -0
- data/sig/anthropic/models/beta/beta_tool_text_editor_20250728.rbs +39 -0
- data/sig/anthropic/models/beta/beta_tool_union.rbs +7 -4
- data/sig/anthropic/models/beta/beta_web_fetch_block.rbs +39 -0
- data/sig/anthropic/models/beta/beta_web_fetch_block_param.rbs +39 -0
- data/sig/anthropic/models/beta/beta_web_fetch_tool_20250910.rbs +59 -0
- data/sig/anthropic/models/beta/beta_web_fetch_tool_result_block.rbs +44 -0
- data/sig/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rbs +49 -0
- data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rbs +29 -0
- data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rbs +29 -0
- data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rbs +32 -0
- data/sig/anthropic/models/beta/message_count_tokens_params.rbs +7 -4
- 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/citation_char_location.rbs +5 -0
- data/sig/anthropic/models/citation_content_block_location.rbs +5 -0
- data/sig/anthropic/models/citation_page_location.rbs +5 -0
- data/sig/anthropic/models/citation_search_result_location_param.rbs +50 -0
- data/sig/anthropic/models/citations_delta.rbs +1 -0
- data/sig/anthropic/models/citations_search_result_location.rbs +50 -0
- data/sig/anthropic/models/content_block.rbs +2 -2
- data/sig/anthropic/models/content_block_param.rbs +6 -5
- data/sig/anthropic/models/document_block_param.rbs +4 -8
- data/sig/anthropic/models/error_response.rbs +13 -2
- data/sig/anthropic/models/message_count_tokens_tool.rbs +2 -0
- data/sig/anthropic/models/model.rbs +4 -10
- data/sig/anthropic/models/raw_content_block_start_event.rbs +2 -2
- data/sig/anthropic/models/search_result_block_param.rbs +49 -0
- data/sig/anthropic/models/text_citation.rbs +1 -0
- data/sig/anthropic/models/text_citation_param.rbs +1 -0
- data/sig/anthropic/models/tool.rbs +14 -3
- data/sig/anthropic/models/tool_result_block_param.rbs +5 -1
- data/sig/anthropic/models/tool_text_editor_20250429.rbs +30 -0
- data/sig/anthropic/models/tool_text_editor_20250728.rbs +35 -0
- data/sig/anthropic/models/tool_union.rbs +2 -0
- data/sig/anthropic/models/usage.rbs +5 -0
- data/sig/anthropic/models.rbs +12 -0
- data/sig/anthropic/streaming.rbs +3 -0
- metadata +152 -3
@@ -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
|
@@ -20,6 +20,9 @@ module Anthropic
|
|
20
20
|
sig { returns(Integer) }
|
21
21
|
attr_accessor :end_char_index
|
22
22
|
|
23
|
+
sig { returns(T.nilable(String)) }
|
24
|
+
attr_accessor :file_id
|
25
|
+
|
23
26
|
sig { returns(Integer) }
|
24
27
|
attr_accessor :start_char_index
|
25
28
|
|
@@ -32,6 +35,7 @@ module Anthropic
|
|
32
35
|
document_index: Integer,
|
33
36
|
document_title: T.nilable(String),
|
34
37
|
end_char_index: Integer,
|
38
|
+
file_id: T.nilable(String),
|
35
39
|
start_char_index: Integer,
|
36
40
|
type: Symbol
|
37
41
|
).returns(T.attached_class)
|
@@ -41,6 +45,7 @@ module Anthropic
|
|
41
45
|
document_index:,
|
42
46
|
document_title:,
|
43
47
|
end_char_index:,
|
48
|
+
file_id:,
|
44
49
|
start_char_index:,
|
45
50
|
type: :char_location
|
46
51
|
)
|
@@ -53,6 +58,7 @@ module Anthropic
|
|
53
58
|
document_index: Integer,
|
54
59
|
document_title: T.nilable(String),
|
55
60
|
end_char_index: Integer,
|
61
|
+
file_id: T.nilable(String),
|
56
62
|
start_char_index: Integer,
|
57
63
|
type: Symbol
|
58
64
|
}
|
@@ -23,6 +23,9 @@ module Anthropic
|
|
23
23
|
sig { returns(Integer) }
|
24
24
|
attr_accessor :end_block_index
|
25
25
|
|
26
|
+
sig { returns(T.nilable(String)) }
|
27
|
+
attr_accessor :file_id
|
28
|
+
|
26
29
|
sig { returns(Integer) }
|
27
30
|
attr_accessor :start_block_index
|
28
31
|
|
@@ -35,6 +38,7 @@ module Anthropic
|
|
35
38
|
document_index: Integer,
|
36
39
|
document_title: T.nilable(String),
|
37
40
|
end_block_index: Integer,
|
41
|
+
file_id: T.nilable(String),
|
38
42
|
start_block_index: Integer,
|
39
43
|
type: Symbol
|
40
44
|
).returns(T.attached_class)
|
@@ -44,6 +48,7 @@ module Anthropic
|
|
44
48
|
document_index:,
|
45
49
|
document_title:,
|
46
50
|
end_block_index:,
|
51
|
+
file_id:,
|
47
52
|
start_block_index:,
|
48
53
|
type: :content_block_location
|
49
54
|
)
|
@@ -56,6 +61,7 @@ module Anthropic
|
|
56
61
|
document_index: Integer,
|
57
62
|
document_title: T.nilable(String),
|
58
63
|
end_block_index: Integer,
|
64
|
+
file_id: T.nilable(String),
|
59
65
|
start_block_index: Integer,
|
60
66
|
type: Symbol
|
61
67
|
}
|
@@ -20,6 +20,9 @@ module Anthropic
|
|
20
20
|
sig { returns(Integer) }
|
21
21
|
attr_accessor :end_page_number
|
22
22
|
|
23
|
+
sig { returns(T.nilable(String)) }
|
24
|
+
attr_accessor :file_id
|
25
|
+
|
23
26
|
sig { returns(Integer) }
|
24
27
|
attr_accessor :start_page_number
|
25
28
|
|
@@ -32,6 +35,7 @@ module Anthropic
|
|
32
35
|
document_index: Integer,
|
33
36
|
document_title: T.nilable(String),
|
34
37
|
end_page_number: Integer,
|
38
|
+
file_id: T.nilable(String),
|
35
39
|
start_page_number: Integer,
|
36
40
|
type: Symbol
|
37
41
|
).returns(T.attached_class)
|
@@ -41,6 +45,7 @@ module Anthropic
|
|
41
45
|
document_index:,
|
42
46
|
document_title:,
|
43
47
|
end_page_number:,
|
48
|
+
file_id:,
|
44
49
|
start_page_number:,
|
45
50
|
type: :page_location
|
46
51
|
)
|
@@ -53,6 +58,7 @@ module Anthropic
|
|
53
58
|
document_index: Integer,
|
54
59
|
document_title: T.nilable(String),
|
55
60
|
end_page_number: Integer,
|
61
|
+
file_id: T.nilable(String),
|
56
62
|
start_page_number: Integer,
|
57
63
|
type: Symbol
|
58
64
|
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
class CitationSearchResultLocationParam < Anthropic::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(
|
9
|
+
Anthropic::CitationSearchResultLocationParam,
|
10
|
+
Anthropic::Internal::AnyHash
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
sig { returns(String) }
|
15
|
+
attr_accessor :cited_text
|
16
|
+
|
17
|
+
sig { returns(Integer) }
|
18
|
+
attr_accessor :end_block_index
|
19
|
+
|
20
|
+
sig { returns(Integer) }
|
21
|
+
attr_accessor :search_result_index
|
22
|
+
|
23
|
+
sig { returns(String) }
|
24
|
+
attr_accessor :source
|
25
|
+
|
26
|
+
sig { returns(Integer) }
|
27
|
+
attr_accessor :start_block_index
|
28
|
+
|
29
|
+
sig { returns(T.nilable(String)) }
|
30
|
+
attr_accessor :title
|
31
|
+
|
32
|
+
sig { returns(Symbol) }
|
33
|
+
attr_accessor :type
|
34
|
+
|
35
|
+
sig do
|
36
|
+
params(
|
37
|
+
cited_text: String,
|
38
|
+
end_block_index: Integer,
|
39
|
+
search_result_index: Integer,
|
40
|
+
source: String,
|
41
|
+
start_block_index: Integer,
|
42
|
+
title: T.nilable(String),
|
43
|
+
type: Symbol
|
44
|
+
).returns(T.attached_class)
|
45
|
+
end
|
46
|
+
def self.new(
|
47
|
+
cited_text:,
|
48
|
+
end_block_index:,
|
49
|
+
search_result_index:,
|
50
|
+
source:,
|
51
|
+
start_block_index:,
|
52
|
+
title:,
|
53
|
+
type: :search_result_location
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
sig do
|
58
|
+
override.returns(
|
59
|
+
{
|
60
|
+
cited_text: String,
|
61
|
+
end_block_index: Integer,
|
62
|
+
search_result_index: Integer,
|
63
|
+
source: String,
|
64
|
+
start_block_index: Integer,
|
65
|
+
title: T.nilable(String),
|
66
|
+
type: Symbol
|
67
|
+
}
|
68
|
+
)
|
69
|
+
end
|
70
|
+
def to_hash
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -21,7 +21,8 @@ module Anthropic
|
|
21
21
|
Anthropic::CitationCharLocation::OrHash,
|
22
22
|
Anthropic::CitationPageLocation::OrHash,
|
23
23
|
Anthropic::CitationContentBlockLocation::OrHash,
|
24
|
-
Anthropic::CitationsWebSearchResultLocation::OrHash
|
24
|
+
Anthropic::CitationsWebSearchResultLocation::OrHash,
|
25
|
+
Anthropic::CitationsSearchResultLocation::OrHash
|
25
26
|
),
|
26
27
|
type: Symbol
|
27
28
|
).returns(T.attached_class)
|
@@ -49,7 +50,8 @@ module Anthropic
|
|
49
50
|
Anthropic::CitationCharLocation,
|
50
51
|
Anthropic::CitationPageLocation,
|
51
52
|
Anthropic::CitationContentBlockLocation,
|
52
|
-
Anthropic::CitationsWebSearchResultLocation
|
53
|
+
Anthropic::CitationsWebSearchResultLocation,
|
54
|
+
Anthropic::CitationsSearchResultLocation
|
53
55
|
)
|
54
56
|
end
|
55
57
|
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
class CitationsSearchResultLocation < Anthropic::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(
|
9
|
+
Anthropic::CitationsSearchResultLocation,
|
10
|
+
Anthropic::Internal::AnyHash
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
sig { returns(String) }
|
15
|
+
attr_accessor :cited_text
|
16
|
+
|
17
|
+
sig { returns(Integer) }
|
18
|
+
attr_accessor :end_block_index
|
19
|
+
|
20
|
+
sig { returns(Integer) }
|
21
|
+
attr_accessor :search_result_index
|
22
|
+
|
23
|
+
sig { returns(String) }
|
24
|
+
attr_accessor :source
|
25
|
+
|
26
|
+
sig { returns(Integer) }
|
27
|
+
attr_accessor :start_block_index
|
28
|
+
|
29
|
+
sig { returns(T.nilable(String)) }
|
30
|
+
attr_accessor :title
|
31
|
+
|
32
|
+
sig { returns(Symbol) }
|
33
|
+
attr_accessor :type
|
34
|
+
|
35
|
+
sig do
|
36
|
+
params(
|
37
|
+
cited_text: String,
|
38
|
+
end_block_index: Integer,
|
39
|
+
search_result_index: Integer,
|
40
|
+
source: String,
|
41
|
+
start_block_index: Integer,
|
42
|
+
title: T.nilable(String),
|
43
|
+
type: Symbol
|
44
|
+
).returns(T.attached_class)
|
45
|
+
end
|
46
|
+
def self.new(
|
47
|
+
cited_text:,
|
48
|
+
end_block_index:,
|
49
|
+
search_result_index:,
|
50
|
+
source:,
|
51
|
+
start_block_index:,
|
52
|
+
title:,
|
53
|
+
type: :search_result_location
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
sig do
|
58
|
+
override.returns(
|
59
|
+
{
|
60
|
+
cited_text: String,
|
61
|
+
end_block_index: Integer,
|
62
|
+
search_result_index: Integer,
|
63
|
+
source: String,
|
64
|
+
start_block_index: Integer,
|
65
|
+
title: T.nilable(String),
|
66
|
+
type: Symbol
|
67
|
+
}
|
68
|
+
)
|
69
|
+
end
|
70
|
+
def to_hash
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -9,11 +9,11 @@ module Anthropic
|
|
9
9
|
T.type_alias do
|
10
10
|
T.any(
|
11
11
|
Anthropic::TextBlock,
|
12
|
+
Anthropic::ThinkingBlock,
|
13
|
+
Anthropic::RedactedThinkingBlock,
|
12
14
|
Anthropic::ToolUseBlock,
|
13
15
|
Anthropic::ServerToolUseBlock,
|
14
|
-
Anthropic::WebSearchToolResultBlock
|
15
|
-
Anthropic::ThinkingBlock,
|
16
|
-
Anthropic::RedactedThinkingBlock
|
16
|
+
Anthropic::WebSearchToolResultBlock
|
17
17
|
)
|
18
18
|
end
|
19
19
|
|
@@ -9,15 +9,16 @@ module Anthropic
|
|
9
9
|
Variants =
|
10
10
|
T.type_alias do
|
11
11
|
T.any(
|
12
|
-
Anthropic::ServerToolUseBlockParam,
|
13
|
-
Anthropic::WebSearchToolResultBlockParam,
|
14
12
|
Anthropic::TextBlockParam,
|
15
13
|
Anthropic::ImageBlockParam,
|
16
|
-
Anthropic::ToolUseBlockParam,
|
17
|
-
Anthropic::ToolResultBlockParam,
|
18
14
|
Anthropic::DocumentBlockParam,
|
15
|
+
Anthropic::SearchResultBlockParam,
|
19
16
|
Anthropic::ThinkingBlockParam,
|
20
|
-
Anthropic::RedactedThinkingBlockParam
|
17
|
+
Anthropic::RedactedThinkingBlockParam,
|
18
|
+
Anthropic::ToolUseBlockParam,
|
19
|
+
Anthropic::ToolResultBlockParam,
|
20
|
+
Anthropic::ServerToolUseBlockParam,
|
21
|
+
Anthropic::WebSearchToolResultBlockParam
|
21
22
|
)
|
22
23
|
end
|
23
24
|
|
@@ -37,7 +37,11 @@ module Anthropic
|
|
37
37
|
sig { returns(T.nilable(Anthropic::CitationsConfigParam)) }
|
38
38
|
attr_reader :citations
|
39
39
|
|
40
|
-
sig
|
40
|
+
sig do
|
41
|
+
params(
|
42
|
+
citations: T.nilable(Anthropic::CitationsConfigParam::OrHash)
|
43
|
+
).void
|
44
|
+
end
|
41
45
|
attr_writer :citations
|
42
46
|
|
43
47
|
sig { returns(T.nilable(String)) }
|
@@ -56,7 +60,7 @@ module Anthropic
|
|
56
60
|
Anthropic::URLPDFSource::OrHash
|
57
61
|
),
|
58
62
|
cache_control: T.nilable(Anthropic::CacheControlEphemeral::OrHash),
|
59
|
-
citations: Anthropic::CitationsConfigParam::OrHash,
|
63
|
+
citations: T.nilable(Anthropic::CitationsConfigParam::OrHash),
|
60
64
|
context: T.nilable(String),
|
61
65
|
title: T.nilable(String),
|
62
66
|
type: Symbol
|
@@ -85,7 +89,7 @@ module Anthropic
|
|
85
89
|
),
|
86
90
|
type: Symbol,
|
87
91
|
cache_control: T.nilable(Anthropic::CacheControlEphemeral),
|
88
|
-
citations: Anthropic::CitationsConfigParam,
|
92
|
+
citations: T.nilable(Anthropic::CitationsConfigParam),
|
89
93
|
context: T.nilable(String),
|
90
94
|
title: T.nilable(String)
|
91
95
|
}
|
@@ -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
|
@@ -67,6 +67,10 @@ module Anthropic
|
|
67
67
|
# - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
|
68
68
|
# - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
|
69
69
|
# - `"tool_use"`: the model invoked one or more tools
|
70
|
+
# - `"pause_turn"`: we paused a long-running turn. You may provide the response
|
71
|
+
# back as-is in a subsequent request to let the model continue.
|
72
|
+
# - `"refusal"`: when streaming classifiers intervene to handle potential policy
|
73
|
+
# violations
|
70
74
|
#
|
71
75
|
# In non-streaming mode this value is always non-null. In streaming mode, it is
|
72
76
|
# null in the `message_start` event and non-null otherwise.
|
@@ -114,11 +118,11 @@ module Anthropic
|
|
114
118
|
T::Array[
|
115
119
|
T.any(
|
116
120
|
Anthropic::TextBlock::OrHash,
|
121
|
+
Anthropic::ThinkingBlock::OrHash,
|
122
|
+
Anthropic::RedactedThinkingBlock::OrHash,
|
117
123
|
Anthropic::ToolUseBlock::OrHash,
|
118
124
|
Anthropic::ServerToolUseBlock::OrHash,
|
119
|
-
Anthropic::WebSearchToolResultBlock::OrHash
|
120
|
-
Anthropic::ThinkingBlock::OrHash,
|
121
|
-
Anthropic::RedactedThinkingBlock::OrHash
|
125
|
+
Anthropic::WebSearchToolResultBlock::OrHash
|
122
126
|
)
|
123
127
|
],
|
124
128
|
model: T.any(Anthropic::Model::OrSymbol, String),
|
@@ -179,6 +183,10 @@ module Anthropic
|
|
179
183
|
# - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
|
180
184
|
# - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
|
181
185
|
# - `"tool_use"`: the model invoked one or more tools
|
186
|
+
# - `"pause_turn"`: we paused a long-running turn. You may provide the response
|
187
|
+
# back as-is in a subsequent request to let the model continue.
|
188
|
+
# - `"refusal"`: when streaming classifiers intervene to handle potential policy
|
189
|
+
# violations
|
182
190
|
#
|
183
191
|
# In non-streaming mode this value is always non-null. In streaming mode, it is
|
184
192
|
# null in the `message_start` event and non-null otherwise.
|
@@ -71,37 +71,14 @@ 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
|
101
78
|
# the top-level `system` parameter — there is no `"system"` role for input
|
102
79
|
# messages in the Messages API.
|
103
80
|
#
|
104
|
-
# There is a limit of
|
81
|
+
# There is a limit of 100,000 messages in a single request.
|
105
82
|
sig { returns(T::Array[Anthropic::MessageParam]) }
|
106
83
|
attr_accessor :messages
|
107
84
|
|
@@ -198,6 +175,12 @@ module Anthropic
|
|
198
175
|
# those tools using the tool input generated by the model and then optionally
|
199
176
|
# return results back to the model using `tool_result` content blocks.
|
200
177
|
#
|
178
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
179
|
+
# behavior described below applies to client tools. For
|
180
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
181
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
182
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
183
|
+
#
|
201
184
|
# Each tool definition includes:
|
202
185
|
#
|
203
186
|
# - `name`: Name of the tool.
|
@@ -268,6 +251,8 @@ module Anthropic
|
|
268
251
|
Anthropic::Tool,
|
269
252
|
Anthropic::ToolBash20250124,
|
270
253
|
Anthropic::ToolTextEditor20250124,
|
254
|
+
Anthropic::ToolTextEditor20250429,
|
255
|
+
Anthropic::ToolTextEditor20250728,
|
271
256
|
Anthropic::WebSearchTool20250305
|
272
257
|
)
|
273
258
|
]
|
@@ -284,6 +269,8 @@ module Anthropic
|
|
284
269
|
Anthropic::Tool::OrHash,
|
285
270
|
Anthropic::ToolBash20250124::OrHash,
|
286
271
|
Anthropic::ToolTextEditor20250124::OrHash,
|
272
|
+
Anthropic::ToolTextEditor20250429::OrHash,
|
273
|
+
Anthropic::ToolTextEditor20250728::OrHash,
|
287
274
|
Anthropic::WebSearchTool20250305::OrHash
|
288
275
|
)
|
289
276
|
]
|
@@ -314,6 +301,8 @@ module Anthropic
|
|
314
301
|
Anthropic::Tool::OrHash,
|
315
302
|
Anthropic::ToolBash20250124::OrHash,
|
316
303
|
Anthropic::ToolTextEditor20250124::OrHash,
|
304
|
+
Anthropic::ToolTextEditor20250429::OrHash,
|
305
|
+
Anthropic::ToolTextEditor20250728::OrHash,
|
317
306
|
Anthropic::WebSearchTool20250305::OrHash
|
318
307
|
)
|
319
308
|
],
|
@@ -378,37 +367,14 @@ module Anthropic
|
|
378
367
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
379
368
|
# ```
|
380
369
|
#
|
381
|
-
#
|
382
|
-
#
|
383
|
-
# ```json
|
384
|
-
# {
|
385
|
-
# "role": "user",
|
386
|
-
# "content": [
|
387
|
-
# {
|
388
|
-
# "type": "image",
|
389
|
-
# "source": {
|
390
|
-
# "type": "base64",
|
391
|
-
# "media_type": "image/jpeg",
|
392
|
-
# "data": "/9j/4AAQSkZJRg..."
|
393
|
-
# }
|
394
|
-
# },
|
395
|
-
# { "type": "text", "text": "What is in this image?" }
|
396
|
-
# ]
|
397
|
-
# }
|
398
|
-
# ```
|
399
|
-
#
|
400
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
401
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
402
|
-
#
|
403
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
404
|
-
# more input examples.
|
370
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
405
371
|
#
|
406
372
|
# Note that if you want to include a
|
407
373
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
408
374
|
# the top-level `system` parameter — there is no `"system"` role for input
|
409
375
|
# messages in the Messages API.
|
410
376
|
#
|
411
|
-
# There is a limit of
|
377
|
+
# There is a limit of 100,000 messages in a single request.
|
412
378
|
messages:,
|
413
379
|
# The model that will complete your prompt.\n\nSee
|
414
380
|
# [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
@@ -440,6 +406,12 @@ module Anthropic
|
|
440
406
|
# those tools using the tool input generated by the model and then optionally
|
441
407
|
# return results back to the model using `tool_result` content blocks.
|
442
408
|
#
|
409
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
410
|
+
# behavior described below applies to client tools. For
|
411
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
412
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
413
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
414
|
+
#
|
443
415
|
# Each tool definition includes:
|
444
416
|
#
|
445
417
|
# - `name`: Name of the tool.
|
@@ -531,6 +503,8 @@ module Anthropic
|
|
531
503
|
Anthropic::Tool,
|
532
504
|
Anthropic::ToolBash20250124,
|
533
505
|
Anthropic::ToolTextEditor20250124,
|
506
|
+
Anthropic::ToolTextEditor20250429,
|
507
|
+
Anthropic::ToolTextEditor20250728,
|
534
508
|
Anthropic::WebSearchTool20250305
|
535
509
|
)
|
536
510
|
],
|