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
@@ -23,6 +23,11 @@ module Anthropic
|
|
23
23
|
# @return [Integer]
|
24
24
|
required :end_char_index, Integer
|
25
25
|
|
26
|
+
# @!attribute file_id
|
27
|
+
#
|
28
|
+
# @return [String, nil]
|
29
|
+
required :file_id, String, nil?: true
|
30
|
+
|
26
31
|
# @!attribute start_char_index
|
27
32
|
#
|
28
33
|
# @return [Integer]
|
@@ -33,11 +38,12 @@ module Anthropic
|
|
33
38
|
# @return [Symbol, :char_location]
|
34
39
|
required :type, const: :char_location
|
35
40
|
|
36
|
-
# @!method initialize(cited_text:, document_index:, document_title:, end_char_index:, start_char_index:, type: :char_location)
|
41
|
+
# @!method initialize(cited_text:, document_index:, document_title:, end_char_index:, file_id:, start_char_index:, type: :char_location)
|
37
42
|
# @param cited_text [String]
|
38
43
|
# @param document_index [Integer]
|
39
44
|
# @param document_title [String, nil]
|
40
45
|
# @param end_char_index [Integer]
|
46
|
+
# @param file_id [String, nil]
|
41
47
|
# @param start_char_index [Integer]
|
42
48
|
# @param type [Symbol, :char_location]
|
43
49
|
end
|
@@ -23,6 +23,11 @@ module Anthropic
|
|
23
23
|
# @return [Integer]
|
24
24
|
required :end_block_index, Integer
|
25
25
|
|
26
|
+
# @!attribute file_id
|
27
|
+
#
|
28
|
+
# @return [String, nil]
|
29
|
+
required :file_id, String, nil?: true
|
30
|
+
|
26
31
|
# @!attribute start_block_index
|
27
32
|
#
|
28
33
|
# @return [Integer]
|
@@ -33,11 +38,12 @@ module Anthropic
|
|
33
38
|
# @return [Symbol, :content_block_location]
|
34
39
|
required :type, const: :content_block_location
|
35
40
|
|
36
|
-
# @!method initialize(cited_text:, document_index:, document_title:, end_block_index:, start_block_index:, type: :content_block_location)
|
41
|
+
# @!method initialize(cited_text:, document_index:, document_title:, end_block_index:, file_id:, start_block_index:, type: :content_block_location)
|
37
42
|
# @param cited_text [String]
|
38
43
|
# @param document_index [Integer]
|
39
44
|
# @param document_title [String, nil]
|
40
45
|
# @param end_block_index [Integer]
|
46
|
+
# @param file_id [String, nil]
|
41
47
|
# @param start_block_index [Integer]
|
42
48
|
# @param type [Symbol, :content_block_location]
|
43
49
|
end
|
@@ -23,6 +23,11 @@ module Anthropic
|
|
23
23
|
# @return [Integer]
|
24
24
|
required :end_page_number, Integer
|
25
25
|
|
26
|
+
# @!attribute file_id
|
27
|
+
#
|
28
|
+
# @return [String, nil]
|
29
|
+
required :file_id, String, nil?: true
|
30
|
+
|
26
31
|
# @!attribute start_page_number
|
27
32
|
#
|
28
33
|
# @return [Integer]
|
@@ -33,11 +38,12 @@ module Anthropic
|
|
33
38
|
# @return [Symbol, :page_location]
|
34
39
|
required :type, const: :page_location
|
35
40
|
|
36
|
-
# @!method initialize(cited_text:, document_index:, document_title:, end_page_number:, start_page_number:, type: :page_location)
|
41
|
+
# @!method initialize(cited_text:, document_index:, document_title:, end_page_number:, file_id:, start_page_number:, type: :page_location)
|
37
42
|
# @param cited_text [String]
|
38
43
|
# @param document_index [Integer]
|
39
44
|
# @param document_title [String, nil]
|
40
45
|
# @param end_page_number [Integer]
|
46
|
+
# @param file_id [String, nil]
|
41
47
|
# @param start_page_number [Integer]
|
42
48
|
# @param type [Symbol, :page_location]
|
43
49
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
class CitationSearchResultLocationParam < Anthropic::Internal::Type::BaseModel
|
6
|
+
# @!attribute cited_text
|
7
|
+
#
|
8
|
+
# @return [String]
|
9
|
+
required :cited_text, String
|
10
|
+
|
11
|
+
# @!attribute end_block_index
|
12
|
+
#
|
13
|
+
# @return [Integer]
|
14
|
+
required :end_block_index, Integer
|
15
|
+
|
16
|
+
# @!attribute search_result_index
|
17
|
+
#
|
18
|
+
# @return [Integer]
|
19
|
+
required :search_result_index, Integer
|
20
|
+
|
21
|
+
# @!attribute source
|
22
|
+
#
|
23
|
+
# @return [String]
|
24
|
+
required :source, String
|
25
|
+
|
26
|
+
# @!attribute start_block_index
|
27
|
+
#
|
28
|
+
# @return [Integer]
|
29
|
+
required :start_block_index, Integer
|
30
|
+
|
31
|
+
# @!attribute title
|
32
|
+
#
|
33
|
+
# @return [String, nil]
|
34
|
+
required :title, String, nil?: true
|
35
|
+
|
36
|
+
# @!attribute type
|
37
|
+
#
|
38
|
+
# @return [Symbol, :search_result_location]
|
39
|
+
required :type, const: :search_result_location
|
40
|
+
|
41
|
+
# @!method initialize(cited_text:, end_block_index:, search_result_index:, source:, start_block_index:, title:, type: :search_result_location)
|
42
|
+
# @param cited_text [String]
|
43
|
+
# @param end_block_index [Integer]
|
44
|
+
# @param search_result_index [Integer]
|
45
|
+
# @param source [String]
|
46
|
+
# @param start_block_index [Integer]
|
47
|
+
# @param title [String, nil]
|
48
|
+
# @param type [Symbol, :search_result_location]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -5,7 +5,7 @@ module Anthropic
|
|
5
5
|
class CitationsDelta < Anthropic::Internal::Type::BaseModel
|
6
6
|
# @!attribute citation
|
7
7
|
#
|
8
|
-
# @return [Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation]
|
8
|
+
# @return [Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation]
|
9
9
|
required :citation, union: -> { Anthropic::CitationsDelta::Citation }
|
10
10
|
|
11
11
|
# @!attribute type
|
@@ -14,7 +14,7 @@ module Anthropic
|
|
14
14
|
required :type, const: :citations_delta
|
15
15
|
|
16
16
|
# @!method initialize(citation:, type: :citations_delta)
|
17
|
-
# @param citation [Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation]
|
17
|
+
# @param citation [Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation]
|
18
18
|
# @param type [Symbol, :citations_delta]
|
19
19
|
|
20
20
|
# @see Anthropic::Models::CitationsDelta#citation
|
@@ -31,8 +31,10 @@ module Anthropic
|
|
31
31
|
|
32
32
|
variant :web_search_result_location, -> { Anthropic::CitationsWebSearchResultLocation }
|
33
33
|
|
34
|
+
variant :search_result_location, -> { Anthropic::CitationsSearchResultLocation }
|
35
|
+
|
34
36
|
# @!method self.variants
|
35
|
-
# @return [Array(Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation)]
|
37
|
+
# @return [Array(Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation)]
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
class CitationsSearchResultLocation < Anthropic::Internal::Type::BaseModel
|
6
|
+
# @!attribute cited_text
|
7
|
+
#
|
8
|
+
# @return [String]
|
9
|
+
required :cited_text, String
|
10
|
+
|
11
|
+
# @!attribute end_block_index
|
12
|
+
#
|
13
|
+
# @return [Integer]
|
14
|
+
required :end_block_index, Integer
|
15
|
+
|
16
|
+
# @!attribute search_result_index
|
17
|
+
#
|
18
|
+
# @return [Integer]
|
19
|
+
required :search_result_index, Integer
|
20
|
+
|
21
|
+
# @!attribute source
|
22
|
+
#
|
23
|
+
# @return [String]
|
24
|
+
required :source, String
|
25
|
+
|
26
|
+
# @!attribute start_block_index
|
27
|
+
#
|
28
|
+
# @return [Integer]
|
29
|
+
required :start_block_index, Integer
|
30
|
+
|
31
|
+
# @!attribute title
|
32
|
+
#
|
33
|
+
# @return [String, nil]
|
34
|
+
required :title, String, nil?: true
|
35
|
+
|
36
|
+
# @!attribute type
|
37
|
+
#
|
38
|
+
# @return [Symbol, :search_result_location]
|
39
|
+
required :type, const: :search_result_location
|
40
|
+
|
41
|
+
# @!method initialize(cited_text:, end_block_index:, search_result_index:, source:, start_block_index:, title:, type: :search_result_location)
|
42
|
+
# @param cited_text [String]
|
43
|
+
# @param end_block_index [Integer]
|
44
|
+
# @param search_result_index [Integer]
|
45
|
+
# @param source [String]
|
46
|
+
# @param start_block_index [Integer]
|
47
|
+
# @param title [String, nil]
|
48
|
+
# @param type [Symbol, :search_result_location]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -9,18 +9,18 @@ module Anthropic
|
|
9
9
|
|
10
10
|
variant :text, -> { Anthropic::TextBlock }
|
11
11
|
|
12
|
+
variant :thinking, -> { Anthropic::ThinkingBlock }
|
13
|
+
|
14
|
+
variant :redacted_thinking, -> { Anthropic::RedactedThinkingBlock }
|
15
|
+
|
12
16
|
variant :tool_use, -> { Anthropic::ToolUseBlock }
|
13
17
|
|
14
18
|
variant :server_tool_use, -> { Anthropic::ServerToolUseBlock }
|
15
19
|
|
16
20
|
variant :web_search_tool_result, -> { Anthropic::WebSearchToolResultBlock }
|
17
21
|
|
18
|
-
variant :thinking, -> { Anthropic::ThinkingBlock }
|
19
|
-
|
20
|
-
variant :redacted_thinking, -> { Anthropic::RedactedThinkingBlock }
|
21
|
-
|
22
22
|
# @!method self.variants
|
23
|
-
# @return [Array(Anthropic::Models::TextBlock, Anthropic::Models::
|
23
|
+
# @return [Array(Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock)]
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -8,33 +8,36 @@ module Anthropic
|
|
8
8
|
|
9
9
|
discriminator :type
|
10
10
|
|
11
|
-
variant :server_tool_use, -> { Anthropic::ServerToolUseBlockParam }
|
12
|
-
|
13
|
-
variant :web_search_tool_result, -> { Anthropic::WebSearchToolResultBlockParam }
|
14
|
-
|
15
11
|
# Regular text content.
|
16
12
|
variant :text, -> { Anthropic::TextBlockParam }
|
17
13
|
|
18
14
|
# Image content specified directly as base64 data or as a reference via a URL.
|
19
15
|
variant :image, -> { Anthropic::ImageBlockParam }
|
20
16
|
|
21
|
-
# A block indicating a tool use by the model.
|
22
|
-
variant :tool_use, -> { Anthropic::ToolUseBlockParam }
|
23
|
-
|
24
|
-
# A block specifying the results of a tool use by the model.
|
25
|
-
variant :tool_result, -> { Anthropic::ToolResultBlockParam }
|
26
|
-
|
27
17
|
# Document content, either specified directly as base64 data, as text, or as a reference via a URL.
|
28
18
|
variant :document, -> { Anthropic::DocumentBlockParam }
|
29
19
|
|
20
|
+
# A search result block containing source, title, and content from search operations.
|
21
|
+
variant :search_result, -> { Anthropic::SearchResultBlockParam }
|
22
|
+
|
30
23
|
# A block specifying internal thinking by the model.
|
31
24
|
variant :thinking, -> { Anthropic::ThinkingBlockParam }
|
32
25
|
|
33
26
|
# A block specifying internal, redacted thinking by the model.
|
34
27
|
variant :redacted_thinking, -> { Anthropic::RedactedThinkingBlockParam }
|
35
28
|
|
29
|
+
# A block indicating a tool use by the model.
|
30
|
+
variant :tool_use, -> { Anthropic::ToolUseBlockParam }
|
31
|
+
|
32
|
+
# A block specifying the results of a tool use by the model.
|
33
|
+
variant :tool_result, -> { Anthropic::ToolResultBlockParam }
|
34
|
+
|
35
|
+
variant :server_tool_use, -> { Anthropic::ServerToolUseBlockParam }
|
36
|
+
|
37
|
+
variant :web_search_tool_result, -> { Anthropic::WebSearchToolResultBlockParam }
|
38
|
+
|
36
39
|
# @!method self.variants
|
37
|
-
# @return [Array(Anthropic::Models::
|
40
|
+
# @return [Array(Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam)]
|
38
41
|
end
|
39
42
|
end
|
40
43
|
end
|
@@ -22,7 +22,7 @@ module Anthropic
|
|
22
22
|
# @!attribute citations
|
23
23
|
#
|
24
24
|
# @return [Anthropic::Models::CitationsConfigParam, nil]
|
25
|
-
optional :citations, -> { Anthropic::CitationsConfigParam }
|
25
|
+
optional :citations, -> { Anthropic::CitationsConfigParam }, nil?: true
|
26
26
|
|
27
27
|
# @!attribute context
|
28
28
|
#
|
@@ -39,7 +39,7 @@ module Anthropic
|
|
39
39
|
#
|
40
40
|
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
|
41
41
|
#
|
42
|
-
# @param citations [Anthropic::Models::CitationsConfigParam]
|
42
|
+
# @param citations [Anthropic::Models::CitationsConfigParam, nil]
|
43
43
|
#
|
44
44
|
# @param context [String, nil]
|
45
45
|
#
|
@@ -8,13 +8,19 @@ module Anthropic
|
|
8
8
|
# @return [Anthropic::Models::InvalidRequestError, Anthropic::Models::AuthenticationError, Anthropic::Models::BillingError, Anthropic::Models::PermissionError, Anthropic::Models::NotFoundError, Anthropic::Models::RateLimitError, Anthropic::Models::GatewayTimeoutError, Anthropic::Models::APIErrorObject, Anthropic::Models::OverloadedError]
|
9
9
|
required :error, union: -> { Anthropic::ErrorObject }
|
10
10
|
|
11
|
+
# @!attribute request_id
|
12
|
+
#
|
13
|
+
# @return [String, nil]
|
14
|
+
required :request_id, String, nil?: true
|
15
|
+
|
11
16
|
# @!attribute type
|
12
17
|
#
|
13
18
|
# @return [Symbol, :error]
|
14
19
|
required :type, const: :error
|
15
20
|
|
16
|
-
# @!method initialize(error:, type: :error)
|
21
|
+
# @!method initialize(error:, request_id:, type: :error)
|
17
22
|
# @param error [Anthropic::Models::InvalidRequestError, Anthropic::Models::AuthenticationError, Anthropic::Models::BillingError, Anthropic::Models::PermissionError, Anthropic::Models::NotFoundError, Anthropic::Models::RateLimitError, Anthropic::Models::GatewayTimeoutError, Anthropic::Models::APIErrorObject, Anthropic::Models::OverloadedError]
|
23
|
+
# @param request_id [String, nil]
|
18
24
|
# @param type [Symbol, :error]
|
19
25
|
end
|
20
26
|
end
|
@@ -48,7 +48,7 @@ module Anthropic
|
|
48
48
|
# [{ "type": "text", "text": "B)" }]
|
49
49
|
# ```
|
50
50
|
#
|
51
|
-
# @return [Array<Anthropic::Models::TextBlock, Anthropic::Models::
|
51
|
+
# @return [Array<Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock>]
|
52
52
|
required :content, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::ContentBlock] }
|
53
53
|
|
54
54
|
# @!attribute model
|
@@ -76,6 +76,10 @@ module Anthropic
|
|
76
76
|
# - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
|
77
77
|
# - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
|
78
78
|
# - `"tool_use"`: the model invoked one or more tools
|
79
|
+
# - `"pause_turn"`: we paused a long-running turn. You may provide the response
|
80
|
+
# back as-is in a subsequent request to let the model continue.
|
81
|
+
# - `"refusal"`: when streaming classifiers intervene to handle potential policy
|
82
|
+
# violations
|
79
83
|
#
|
80
84
|
# In non-streaming mode this value is always non-null. In streaming mode, it is
|
81
85
|
# null in the `message_start` event and non-null otherwise.
|
@@ -126,7 +130,7 @@ module Anthropic
|
|
126
130
|
#
|
127
131
|
# @param id [String] Unique object identifier.
|
128
132
|
#
|
129
|
-
# @param content [Array<Anthropic::Models::TextBlock, Anthropic::Models::
|
133
|
+
# @param content [Array<Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock>] Content generated by the model.
|
130
134
|
#
|
131
135
|
# @param model [Symbol, String, Anthropic::Models::Model] The model that will complete your prompt.\n\nSee [models](https://docs.anthropic
|
132
136
|
#
|
@@ -65,37 +65,14 @@ module Anthropic
|
|
65
65
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
66
66
|
# ```
|
67
67
|
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
# ```json
|
71
|
-
# {
|
72
|
-
# "role": "user",
|
73
|
-
# "content": [
|
74
|
-
# {
|
75
|
-
# "type": "image",
|
76
|
-
# "source": {
|
77
|
-
# "type": "base64",
|
78
|
-
# "media_type": "image/jpeg",
|
79
|
-
# "data": "/9j/4AAQSkZJRg..."
|
80
|
-
# }
|
81
|
-
# },
|
82
|
-
# { "type": "text", "text": "What is in this image?" }
|
83
|
-
# ]
|
84
|
-
# }
|
85
|
-
# ```
|
86
|
-
#
|
87
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
88
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
89
|
-
#
|
90
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
91
|
-
# more input examples.
|
68
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
92
69
|
#
|
93
70
|
# Note that if you want to include a
|
94
71
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
95
72
|
# the top-level `system` parameter — there is no `"system"` role for input
|
96
73
|
# messages in the Messages API.
|
97
74
|
#
|
98
|
-
# There is a limit of
|
75
|
+
# There is a limit of 100,000 messages in a single request.
|
99
76
|
#
|
100
77
|
# @return [Array<Anthropic::Models::MessageParam>]
|
101
78
|
required :messages, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::MessageParam] }
|
@@ -147,6 +124,12 @@ module Anthropic
|
|
147
124
|
# those tools using the tool input generated by the model and then optionally
|
148
125
|
# return results back to the model using `tool_result` content blocks.
|
149
126
|
#
|
127
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
128
|
+
# behavior described below applies to client tools. For
|
129
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
130
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
131
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
132
|
+
#
|
150
133
|
# Each tool definition includes:
|
151
134
|
#
|
152
135
|
# - `name`: Name of the tool.
|
@@ -210,7 +193,7 @@ module Anthropic
|
|
210
193
|
#
|
211
194
|
# See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
212
195
|
#
|
213
|
-
# @return [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>, nil]
|
196
|
+
# @return [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolTextEditor20250429, Anthropic::Models::ToolTextEditor20250728, Anthropic::Models::WebSearchTool20250305>, nil]
|
214
197
|
optional :tools, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::MessageCountTokensTool] }
|
215
198
|
|
216
199
|
# @!method initialize(messages:, model:, system_: nil, thinking: nil, tool_choice: nil, tools: nil, request_options: {})
|
@@ -227,7 +210,7 @@ module Anthropic
|
|
227
210
|
#
|
228
211
|
# @param tool_choice [Anthropic::Models::ToolChoiceAuto, Anthropic::Models::ToolChoiceAny, Anthropic::Models::ToolChoiceTool, Anthropic::Models::ToolChoiceNone] How the model should use the provided tools. The model can use a specific tool,
|
229
212
|
#
|
230
|
-
# @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
|
213
|
+
# @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolTextEditor20250429, Anthropic::Models::ToolTextEditor20250728, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
|
231
214
|
#
|
232
215
|
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}]
|
233
216
|
|
@@ -11,10 +11,14 @@ module Anthropic
|
|
11
11
|
|
12
12
|
variant -> { Anthropic::ToolTextEditor20250124 }
|
13
13
|
|
14
|
+
variant -> { Anthropic::ToolTextEditor20250429 }
|
15
|
+
|
16
|
+
variant -> { Anthropic::ToolTextEditor20250728 }
|
17
|
+
|
14
18
|
variant -> { Anthropic::WebSearchTool20250305 }
|
15
19
|
|
16
20
|
# @!method self.variants
|
17
|
-
# @return [Array(Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305)]
|
21
|
+
# @return [Array(Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolTextEditor20250429, Anthropic::Models::ToolTextEditor20250728, Anthropic::Models::WebSearchTool20250305)]
|
18
22
|
end
|
19
23
|
end
|
20
24
|
end
|
@@ -79,37 +79,14 @@ module Anthropic
|
|
79
79
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
80
80
|
# ```
|
81
81
|
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
# ```json
|
85
|
-
# {
|
86
|
-
# "role": "user",
|
87
|
-
# "content": [
|
88
|
-
# {
|
89
|
-
# "type": "image",
|
90
|
-
# "source": {
|
91
|
-
# "type": "base64",
|
92
|
-
# "media_type": "image/jpeg",
|
93
|
-
# "data": "/9j/4AAQSkZJRg..."
|
94
|
-
# }
|
95
|
-
# },
|
96
|
-
# { "type": "text", "text": "What is in this image?" }
|
97
|
-
# ]
|
98
|
-
# }
|
99
|
-
# ```
|
100
|
-
#
|
101
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
102
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
103
|
-
#
|
104
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
105
|
-
# more input examples.
|
82
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
106
83
|
#
|
107
84
|
# Note that if you want to include a
|
108
85
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
109
86
|
# the top-level `system` parameter — there is no `"system"` role for input
|
110
87
|
# messages in the Messages API.
|
111
88
|
#
|
112
|
-
# There is a limit of
|
89
|
+
# There is a limit of 100,000 messages in a single request.
|
113
90
|
#
|
114
91
|
# @return [Array<Anthropic::Models::MessageParam>]
|
115
92
|
required :messages, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::MessageParam] }
|
@@ -204,6 +181,12 @@ module Anthropic
|
|
204
181
|
# those tools using the tool input generated by the model and then optionally
|
205
182
|
# return results back to the model using `tool_result` content blocks.
|
206
183
|
#
|
184
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
185
|
+
# behavior described below applies to client tools. For
|
186
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
187
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
188
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
189
|
+
#
|
207
190
|
# Each tool definition includes:
|
208
191
|
#
|
209
192
|
# - `name`: Name of the tool.
|
@@ -267,7 +250,7 @@ module Anthropic
|
|
267
250
|
#
|
268
251
|
# See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
269
252
|
#
|
270
|
-
# @return [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>, nil]
|
253
|
+
# @return [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolTextEditor20250429, Anthropic::Models::ToolTextEditor20250728, Anthropic::Models::WebSearchTool20250305>, nil]
|
271
254
|
optional :tools, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::ToolUnion] }
|
272
255
|
|
273
256
|
# @!attribute top_k
|
@@ -320,7 +303,7 @@ module Anthropic
|
|
320
303
|
#
|
321
304
|
# @param tool_choice [Anthropic::Models::ToolChoiceAuto, Anthropic::Models::ToolChoiceAny, Anthropic::Models::ToolChoiceTool, Anthropic::Models::ToolChoiceNone] How the model should use the provided tools. The model can use a specific tool,
|
322
305
|
#
|
323
|
-
# @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
|
306
|
+
# @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolTextEditor20250429, Anthropic::Models::ToolTextEditor20250728, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
|
324
307
|
#
|
325
308
|
# @param top_k [Integer] Only sample from the top K options for each subsequent token.
|
326
309
|
#
|
@@ -5,7 +5,7 @@ module Anthropic
|
|
5
5
|
class MessageParam < Anthropic::Internal::Type::BaseModel
|
6
6
|
# @!attribute content
|
7
7
|
#
|
8
|
-
# @return [String, Array<Anthropic::Models::
|
8
|
+
# @return [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam>]
|
9
9
|
required :content, union: -> { Anthropic::MessageParam::Content }
|
10
10
|
|
11
11
|
# @!attribute role
|
@@ -14,7 +14,7 @@ module Anthropic
|
|
14
14
|
required :role, enum: -> { Anthropic::MessageParam::Role }
|
15
15
|
|
16
16
|
# @!method initialize(content:, role:)
|
17
|
-
# @param content [String, Array<Anthropic::Models::
|
17
|
+
# @param content [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam>]
|
18
18
|
# @param role [Symbol, Anthropic::Models::MessageParam::Role]
|
19
19
|
|
20
20
|
# @see Anthropic::Models::MessageParam#content
|
@@ -26,7 +26,7 @@ module Anthropic
|
|
26
26
|
variant -> { Anthropic::Models::MessageParam::Content::ContentBlockParamArray }
|
27
27
|
|
28
28
|
# @!method self.variants
|
29
|
-
# @return [Array(String, Array<Anthropic::Models::
|
29
|
+
# @return [Array(String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::DocumentBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::ThinkingBlockParam, Anthropic::Models::RedactedThinkingBlockParam, Anthropic::Models::ToolUseBlockParam, Anthropic::Models::ToolResultBlockParam, Anthropic::Models::ServerToolUseBlockParam, Anthropic::Models::WebSearchToolResultBlockParam>)]
|
30
30
|
|
31
31
|
# @type [Anthropic::Internal::Type::Converter]
|
32
32
|
ContentBlockParamArray = Anthropic::Internal::Type::ArrayOf[union: -> {
|
@@ -123,37 +123,14 @@ module Anthropic
|
|
123
123
|
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
124
124
|
# ```
|
125
125
|
#
|
126
|
-
#
|
127
|
-
#
|
128
|
-
# ```json
|
129
|
-
# {
|
130
|
-
# "role": "user",
|
131
|
-
# "content": [
|
132
|
-
# {
|
133
|
-
# "type": "image",
|
134
|
-
# "source": {
|
135
|
-
# "type": "base64",
|
136
|
-
# "media_type": "image/jpeg",
|
137
|
-
# "data": "/9j/4AAQSkZJRg..."
|
138
|
-
# }
|
139
|
-
# },
|
140
|
-
# { "type": "text", "text": "What is in this image?" }
|
141
|
-
# ]
|
142
|
-
# }
|
143
|
-
# ```
|
144
|
-
#
|
145
|
-
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
146
|
-
# `image/png`, `image/gif`, and `image/webp` media types.
|
147
|
-
#
|
148
|
-
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
149
|
-
# more input examples.
|
126
|
+
# See [input examples](https://docs.anthropic.com/en/api/messages-examples).
|
150
127
|
#
|
151
128
|
# Note that if you want to include a
|
152
129
|
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
153
130
|
# the top-level `system` parameter — there is no `"system"` role for input
|
154
131
|
# messages in the Messages API.
|
155
132
|
#
|
156
|
-
# There is a limit of
|
133
|
+
# There is a limit of 100,000 messages in a single request.
|
157
134
|
#
|
158
135
|
# @return [Array<Anthropic::Models::MessageParam>]
|
159
136
|
required :messages, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::MessageParam] }
|
@@ -180,10 +157,7 @@ module Anthropic
|
|
180
157
|
# [service-tiers](https://docs.anthropic.com/en/api/service-tiers) for details.
|
181
158
|
#
|
182
159
|
# @return [Symbol, Anthropic::Models::Messages::BatchCreateParams::Request::Params::ServiceTier, nil]
|
183
|
-
optional :service_tier,
|
184
|
-
enum: -> {
|
185
|
-
Anthropic::Messages::BatchCreateParams::Request::Params::ServiceTier
|
186
|
-
}
|
160
|
+
optional :service_tier, enum: -> { Anthropic::Messages::BatchCreateParams::Request::Params::ServiceTier }
|
187
161
|
|
188
162
|
# @!attribute stop_sequences
|
189
163
|
# Custom text sequences that will cause the model to stop generating.
|
@@ -262,6 +236,12 @@ module Anthropic
|
|
262
236
|
# those tools using the tool input generated by the model and then optionally
|
263
237
|
# return results back to the model using `tool_result` content blocks.
|
264
238
|
#
|
239
|
+
# There are two types of tools: **client tools** and **server tools**. The
|
240
|
+
# behavior described below applies to client tools. For
|
241
|
+
# [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
|
242
|
+
# see their individual documentation as each has its own behavior (e.g., the
|
243
|
+
# [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
|
244
|
+
#
|
265
245
|
# Each tool definition includes:
|
266
246
|
#
|
267
247
|
# - `name`: Name of the tool.
|
@@ -325,7 +305,7 @@ module Anthropic
|
|
325
305
|
#
|
326
306
|
# See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
327
307
|
#
|
328
|
-
# @return [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>, nil]
|
308
|
+
# @return [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolTextEditor20250429, Anthropic::Models::ToolTextEditor20250728, Anthropic::Models::WebSearchTool20250305>, nil]
|
329
309
|
optional :tools, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::ToolUnion] }
|
330
310
|
|
331
311
|
# @!attribute top_k
|
@@ -386,7 +366,7 @@ module Anthropic
|
|
386
366
|
#
|
387
367
|
# @param tool_choice [Anthropic::Models::ToolChoiceAuto, Anthropic::Models::ToolChoiceAny, Anthropic::Models::ToolChoiceTool, Anthropic::Models::ToolChoiceNone] How the model should use the provided tools. The model can use a specific tool,
|
388
368
|
#
|
389
|
-
# @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
|
369
|
+
# @param tools [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolTextEditor20250429, Anthropic::Models::ToolTextEditor20250728, Anthropic::Models::WebSearchTool20250305>] Definitions of tools that the model may use.
|
390
370
|
#
|
391
371
|
# @param top_k [Integer] Only sample from the top K options for each subsequent token.
|
392
372
|
#
|