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
@@ -34,18 +34,14 @@ module Anthropic
|
|
34
34
|
|
35
35
|
variant const: -> { Anthropic::Models::Model::CLAUDE_4_OPUS_20250514 }
|
36
36
|
|
37
|
+
variant const: -> { Anthropic::Models::Model::CLAUDE_OPUS_4_1_20250805 }
|
38
|
+
|
37
39
|
variant const: -> { Anthropic::Models::Model::CLAUDE_3_OPUS_LATEST }
|
38
40
|
|
39
41
|
variant const: -> { Anthropic::Models::Model::CLAUDE_3_OPUS_20240229 }
|
40
42
|
|
41
|
-
variant const: -> { Anthropic::Models::Model::CLAUDE_3_SONNET_20240229 }
|
42
|
-
|
43
43
|
variant const: -> { Anthropic::Models::Model::CLAUDE_3_HAIKU_20240307 }
|
44
44
|
|
45
|
-
variant const: -> { Anthropic::Models::Model::CLAUDE_2_1 }
|
46
|
-
|
47
|
-
variant const: -> { Anthropic::Models::Model::CLAUDE_2_0 }
|
48
|
-
|
49
45
|
variant String
|
50
46
|
|
51
47
|
# @!method self.variants
|
@@ -82,8 +78,14 @@ module Anthropic
|
|
82
78
|
CLAUDE_3_5_SONNET_LATEST = :"claude-3-5-sonnet-latest"
|
83
79
|
|
84
80
|
# Our previous most intelligent model
|
81
|
+
# @deprecated Will reach end-of-life on October 22, 2025. Please migrate to a newer model.
|
82
|
+
# Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
|
83
|
+
# information.
|
85
84
|
CLAUDE_3_5_SONNET_20241022 = :"claude-3-5-sonnet-20241022"
|
86
85
|
|
86
|
+
# @deprecated Will reach end-of-life on October 22, 2025. Please migrate to a newer model.
|
87
|
+
# Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
|
88
|
+
# information.
|
87
89
|
CLAUDE_3_5_SONNET_20240620 = :"claude-3-5-sonnet-20240620"
|
88
90
|
|
89
91
|
# Our most capable model
|
@@ -95,31 +97,24 @@ module Anthropic
|
|
95
97
|
# Our most capable model
|
96
98
|
CLAUDE_4_OPUS_20250514 = :"claude-4-opus-20250514"
|
97
99
|
|
100
|
+
# Our most capable model
|
101
|
+
CLAUDE_OPUS_4_1_20250805 = :"claude-opus-4-1-20250805"
|
102
|
+
|
98
103
|
# Excels at writing and complex tasks
|
104
|
+
# @deprecated Will reach end-of-life on January 5th, 2026. Please migrate to a newer model.
|
105
|
+
# Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
|
106
|
+
# information.
|
99
107
|
CLAUDE_3_OPUS_LATEST = :"claude-3-opus-latest"
|
100
108
|
|
101
109
|
# Excels at writing and complex tasks
|
102
|
-
|
103
|
-
|
104
|
-
# Balance of speed and intelligence
|
105
|
-
# @deprecated Will reach end-of-life on July 21st, 2025. Please migrate to a newer model.
|
110
|
+
# @deprecated Will reach end-of-life on January 5th, 2026. Please migrate to a newer model.
|
106
111
|
# Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
|
107
112
|
# information.
|
108
|
-
|
113
|
+
CLAUDE_3_OPUS_20240229 = :"claude-3-opus-20240229"
|
109
114
|
|
110
115
|
# Our previous most fast and cost-effective
|
111
116
|
CLAUDE_3_HAIKU_20240307 = :"claude-3-haiku-20240307"
|
112
117
|
|
113
|
-
# @deprecated Will reach end-of-life on July 21st, 2025. Please migrate to a newer model.
|
114
|
-
# Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
|
115
|
-
# information.
|
116
|
-
CLAUDE_2_1 = :"claude-2.1"
|
117
|
-
|
118
|
-
# @deprecated Will reach end-of-life on July 21st, 2025. Please migrate to a newer model.
|
119
|
-
# Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
|
120
|
-
# information.
|
121
|
-
CLAUDE_2_0 = :"claude-2.0"
|
122
|
-
|
123
118
|
# @!endgroup
|
124
119
|
end
|
125
120
|
end
|
@@ -5,7 +5,7 @@ module Anthropic
|
|
5
5
|
class RawContentBlockStartEvent < Anthropic::Internal::Type::BaseModel
|
6
6
|
# @!attribute content_block
|
7
7
|
#
|
8
|
-
# @return [Anthropic::Models::TextBlock, Anthropic::Models::
|
8
|
+
# @return [Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock]
|
9
9
|
required :content_block, union: -> { Anthropic::RawContentBlockStartEvent::ContentBlock }
|
10
10
|
|
11
11
|
# @!attribute index
|
@@ -19,7 +19,7 @@ module Anthropic
|
|
19
19
|
required :type, const: :content_block_start
|
20
20
|
|
21
21
|
# @!method initialize(content_block:, index:, type: :content_block_start)
|
22
|
-
# @param content_block [Anthropic::Models::TextBlock, Anthropic::Models::
|
22
|
+
# @param content_block [Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock]
|
23
23
|
# @param index [Integer]
|
24
24
|
# @param type [Symbol, :content_block_start]
|
25
25
|
|
@@ -31,18 +31,18 @@ module Anthropic
|
|
31
31
|
|
32
32
|
variant :text, -> { Anthropic::TextBlock }
|
33
33
|
|
34
|
+
variant :thinking, -> { Anthropic::ThinkingBlock }
|
35
|
+
|
36
|
+
variant :redacted_thinking, -> { Anthropic::RedactedThinkingBlock }
|
37
|
+
|
34
38
|
variant :tool_use, -> { Anthropic::ToolUseBlock }
|
35
39
|
|
36
40
|
variant :server_tool_use, -> { Anthropic::ServerToolUseBlock }
|
37
41
|
|
38
42
|
variant :web_search_tool_result, -> { Anthropic::WebSearchToolResultBlock }
|
39
43
|
|
40
|
-
variant :thinking, -> { Anthropic::ThinkingBlock }
|
41
|
-
|
42
|
-
variant :redacted_thinking, -> { Anthropic::RedactedThinkingBlock }
|
43
|
-
|
44
44
|
# @!method self.variants
|
45
|
-
# @return [Array(Anthropic::Models::TextBlock, Anthropic::Models::
|
45
|
+
# @return [Array(Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock)]
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
class SearchResultBlockParam < Anthropic::Internal::Type::BaseModel
|
6
|
+
# @!attribute content
|
7
|
+
#
|
8
|
+
# @return [Array<Anthropic::Models::TextBlockParam>]
|
9
|
+
required :content, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::TextBlockParam] }
|
10
|
+
|
11
|
+
# @!attribute source
|
12
|
+
#
|
13
|
+
# @return [String]
|
14
|
+
required :source, String
|
15
|
+
|
16
|
+
# @!attribute title
|
17
|
+
#
|
18
|
+
# @return [String]
|
19
|
+
required :title, String
|
20
|
+
|
21
|
+
# @!attribute type
|
22
|
+
#
|
23
|
+
# @return [Symbol, :search_result]
|
24
|
+
required :type, const: :search_result
|
25
|
+
|
26
|
+
# @!attribute cache_control
|
27
|
+
# Create a cache control breakpoint at this content block.
|
28
|
+
#
|
29
|
+
# @return [Anthropic::Models::CacheControlEphemeral, nil]
|
30
|
+
optional :cache_control, -> { Anthropic::CacheControlEphemeral }, nil?: true
|
31
|
+
|
32
|
+
# @!attribute citations
|
33
|
+
#
|
34
|
+
# @return [Anthropic::Models::CitationsConfigParam, nil]
|
35
|
+
optional :citations, -> { Anthropic::CitationsConfigParam }
|
36
|
+
|
37
|
+
# @!method initialize(content:, source:, title:, cache_control: nil, citations: nil, type: :search_result)
|
38
|
+
# @param content [Array<Anthropic::Models::TextBlockParam>]
|
39
|
+
#
|
40
|
+
# @param source [String]
|
41
|
+
#
|
42
|
+
# @param title [String]
|
43
|
+
#
|
44
|
+
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
|
45
|
+
#
|
46
|
+
# @param citations [Anthropic::Models::CitationsConfigParam]
|
47
|
+
#
|
48
|
+
# @param type [Symbol, :search_result]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -10,7 +10,7 @@ module Anthropic
|
|
10
10
|
# Citing a PDF results in `page_location`, plain text results in `char_location`,
|
11
11
|
# and content document results in `content_block_location`.
|
12
12
|
#
|
13
|
-
# @return [Array<Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation>, nil]
|
13
|
+
# @return [Array<Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation>, nil]
|
14
14
|
required :citations,
|
15
15
|
-> {
|
16
16
|
Anthropic::Internal::Type::ArrayOf[union: Anthropic::TextCitation]
|
@@ -31,7 +31,7 @@ module Anthropic
|
|
31
31
|
# Some parameter documentations has been truncated, see
|
32
32
|
# {Anthropic::Models::TextBlock} for more details.
|
33
33
|
#
|
34
|
-
# @param citations [Array<Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation>, nil] Citations supporting the text block.
|
34
|
+
# @param citations [Array<Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation>, nil] Citations supporting the text block.
|
35
35
|
#
|
36
36
|
# @param text [String]
|
37
37
|
#
|
@@ -21,7 +21,7 @@ module Anthropic
|
|
21
21
|
|
22
22
|
# @!attribute citations
|
23
23
|
#
|
24
|
-
# @return [Array<Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam>, nil]
|
24
|
+
# @return [Array<Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam, Anthropic::Models::CitationSearchResultLocationParam>, nil]
|
25
25
|
optional :citations,
|
26
26
|
-> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::TextCitationParam] },
|
27
27
|
nil?: true
|
@@ -31,7 +31,7 @@ module Anthropic
|
|
31
31
|
#
|
32
32
|
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
|
33
33
|
#
|
34
|
-
# @param citations [Array<Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam>, nil]
|
34
|
+
# @param citations [Array<Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam, Anthropic::Models::CitationSearchResultLocationParam>, nil]
|
35
35
|
#
|
36
36
|
# @param type [Symbol, :text]
|
37
37
|
end
|
@@ -15,8 +15,10 @@ module Anthropic
|
|
15
15
|
|
16
16
|
variant :web_search_result_location, -> { Anthropic::CitationsWebSearchResultLocation }
|
17
17
|
|
18
|
+
variant :search_result_location, -> { Anthropic::CitationsSearchResultLocation }
|
19
|
+
|
18
20
|
# @!method self.variants
|
19
|
-
# @return [Array(Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation)]
|
21
|
+
# @return [Array(Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation)]
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -15,8 +15,10 @@ module Anthropic
|
|
15
15
|
|
16
16
|
variant :web_search_result_location, -> { Anthropic::CitationWebSearchResultLocationParam }
|
17
17
|
|
18
|
+
variant :search_result_location, -> { Anthropic::CitationSearchResultLocationParam }
|
19
|
+
|
18
20
|
# @!method self.variants
|
19
|
-
# @return [Array(Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam)]
|
21
|
+
# @return [Array(Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam, Anthropic::Models::CitationSearchResultLocationParam)]
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -68,13 +68,19 @@ module Anthropic
|
|
68
68
|
# @return [Object, nil]
|
69
69
|
optional :properties, Anthropic::Internal::Type::Unknown, nil?: true
|
70
70
|
|
71
|
-
# @!
|
71
|
+
# @!attribute required
|
72
|
+
#
|
73
|
+
# @return [Array<String>, nil]
|
74
|
+
optional :required, Anthropic::Internal::Type::ArrayOf[String], nil?: true
|
75
|
+
|
76
|
+
# @!method initialize(properties: nil, required: nil, type: :object)
|
72
77
|
# [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
|
73
78
|
#
|
74
79
|
# This defines the shape of the `input` that your tool accepts and that the model
|
75
80
|
# will produce.
|
76
81
|
#
|
77
82
|
# @param properties [Object, nil]
|
83
|
+
# @param required [Array<String>, nil]
|
78
84
|
# @param type [Symbol, :object]
|
79
85
|
end
|
80
86
|
|
@@ -21,7 +21,7 @@ module Anthropic
|
|
21
21
|
|
22
22
|
# @!attribute content
|
23
23
|
#
|
24
|
-
# @return [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam>, nil]
|
24
|
+
# @return [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::DocumentBlockParam>, nil]
|
25
25
|
optional :content, union: -> { Anthropic::ToolResultBlockParam::Content }
|
26
26
|
|
27
27
|
# @!attribute is_error
|
@@ -34,7 +34,7 @@ module Anthropic
|
|
34
34
|
#
|
35
35
|
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
|
36
36
|
#
|
37
|
-
# @param content [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam>]
|
37
|
+
# @param content [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::DocumentBlockParam>]
|
38
38
|
#
|
39
39
|
# @param is_error [Boolean]
|
40
40
|
#
|
@@ -57,12 +57,16 @@ module Anthropic
|
|
57
57
|
|
58
58
|
variant :image, -> { Anthropic::ImageBlockParam }
|
59
59
|
|
60
|
+
variant :search_result, -> { Anthropic::SearchResultBlockParam }
|
61
|
+
|
62
|
+
variant :document, -> { Anthropic::DocumentBlockParam }
|
63
|
+
|
60
64
|
# @!method self.variants
|
61
|
-
# @return [Array(Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam)]
|
65
|
+
# @return [Array(Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::DocumentBlockParam)]
|
62
66
|
end
|
63
67
|
|
64
68
|
# @!method self.variants
|
65
|
-
# @return [Array(String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam>)]
|
69
|
+
# @return [Array(String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::DocumentBlockParam>)]
|
66
70
|
|
67
71
|
# @type [Anthropic::Internal::Type::Converter]
|
68
72
|
ContentArray =
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
class ToolTextEditor20250429 < Anthropic::Internal::Type::BaseModel
|
6
|
+
# @!attribute name
|
7
|
+
# Name of the tool.
|
8
|
+
#
|
9
|
+
# This is how the tool will be called by the model and in `tool_use` blocks.
|
10
|
+
#
|
11
|
+
# @return [Symbol, :str_replace_based_edit_tool]
|
12
|
+
required :name, const: :str_replace_based_edit_tool
|
13
|
+
|
14
|
+
# @!attribute type
|
15
|
+
#
|
16
|
+
# @return [Symbol, :text_editor_20250429]
|
17
|
+
required :type, const: :text_editor_20250429
|
18
|
+
|
19
|
+
# @!attribute cache_control
|
20
|
+
# Create a cache control breakpoint at this content block.
|
21
|
+
#
|
22
|
+
# @return [Anthropic::Models::CacheControlEphemeral, nil]
|
23
|
+
optional :cache_control, -> { Anthropic::CacheControlEphemeral }, nil?: true
|
24
|
+
|
25
|
+
# @!method initialize(cache_control: nil, name: :str_replace_based_edit_tool, type: :text_editor_20250429)
|
26
|
+
# Some parameter documentations has been truncated, see
|
27
|
+
# {Anthropic::Models::ToolTextEditor20250429} for more details.
|
28
|
+
#
|
29
|
+
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
|
30
|
+
#
|
31
|
+
# @param name [Symbol, :str_replace_based_edit_tool] Name of the tool.
|
32
|
+
#
|
33
|
+
# @param type [Symbol, :text_editor_20250429]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Models
|
5
|
+
class ToolTextEditor20250728 < Anthropic::Internal::Type::BaseModel
|
6
|
+
# @!attribute name
|
7
|
+
# Name of the tool.
|
8
|
+
#
|
9
|
+
# This is how the tool will be called by the model and in `tool_use` blocks.
|
10
|
+
#
|
11
|
+
# @return [Symbol, :str_replace_based_edit_tool]
|
12
|
+
required :name, const: :str_replace_based_edit_tool
|
13
|
+
|
14
|
+
# @!attribute type
|
15
|
+
#
|
16
|
+
# @return [Symbol, :text_editor_20250728]
|
17
|
+
required :type, const: :text_editor_20250728
|
18
|
+
|
19
|
+
# @!attribute cache_control
|
20
|
+
# Create a cache control breakpoint at this content block.
|
21
|
+
#
|
22
|
+
# @return [Anthropic::Models::CacheControlEphemeral, nil]
|
23
|
+
optional :cache_control, -> { Anthropic::CacheControlEphemeral }, nil?: true
|
24
|
+
|
25
|
+
# @!attribute max_characters
|
26
|
+
# Maximum number of characters to display when viewing a file. If not specified,
|
27
|
+
# defaults to displaying the full file.
|
28
|
+
#
|
29
|
+
# @return [Integer, nil]
|
30
|
+
optional :max_characters, Integer, nil?: true
|
31
|
+
|
32
|
+
# @!method initialize(cache_control: nil, max_characters: nil, name: :str_replace_based_edit_tool, type: :text_editor_20250728)
|
33
|
+
# Some parameter documentations has been truncated, see
|
34
|
+
# {Anthropic::Models::ToolTextEditor20250728} for more details.
|
35
|
+
#
|
36
|
+
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
|
37
|
+
#
|
38
|
+
# @param max_characters [Integer, nil] Maximum number of characters to display when viewing a file. If not specified, d
|
39
|
+
#
|
40
|
+
# @param name [Symbol, :str_replace_based_edit_tool] Name of the tool.
|
41
|
+
#
|
42
|
+
# @param type [Symbol, :text_editor_20250728]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -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
|
@@ -23,6 +23,20 @@ module Anthropic
|
|
23
23
|
# @return [Symbol, :tool_use]
|
24
24
|
required :type, const: :tool_use
|
25
25
|
|
26
|
+
# @api private
|
27
|
+
#
|
28
|
+
# Internal buffer for accumulating partial JSON during streaming.
|
29
|
+
# Used by streaming helpers to reconstruct complete JSON input from deltas.
|
30
|
+
optional :json_buf, String
|
31
|
+
|
32
|
+
response_only do
|
33
|
+
# @api public
|
34
|
+
#
|
35
|
+
# Parsed input data coerced to the tool's input schema model.
|
36
|
+
# Only present when tools are defined using the InputSchema DSL.
|
37
|
+
optional :parsed, Anthropic::Internal::Type::Unknown
|
38
|
+
end
|
39
|
+
|
26
40
|
# @!method initialize(id:, input:, name:, type: :tool_use)
|
27
41
|
# @param id [String]
|
28
42
|
# @param input [Object]
|
@@ -3,6 +3,12 @@
|
|
3
3
|
module Anthropic
|
4
4
|
module Models
|
5
5
|
class Usage < Anthropic::Internal::Type::BaseModel
|
6
|
+
# @!attribute cache_creation
|
7
|
+
# Breakdown of cached tokens by TTL
|
8
|
+
#
|
9
|
+
# @return [Anthropic::Models::CacheCreation, nil]
|
10
|
+
required :cache_creation, -> { Anthropic::CacheCreation }, nil?: true
|
11
|
+
|
6
12
|
# @!attribute cache_creation_input_tokens
|
7
13
|
# The number of input tokens used to create the cache entry.
|
8
14
|
#
|
@@ -39,7 +45,9 @@ module Anthropic
|
|
39
45
|
# @return [Symbol, Anthropic::Models::Usage::ServiceTier, nil]
|
40
46
|
required :service_tier, enum: -> { Anthropic::Usage::ServiceTier }, nil?: true
|
41
47
|
|
42
|
-
# @!method initialize(cache_creation_input_tokens:, cache_read_input_tokens:, input_tokens:, output_tokens:, server_tool_use:, service_tier:)
|
48
|
+
# @!method initialize(cache_creation:, cache_creation_input_tokens:, cache_read_input_tokens:, input_tokens:, output_tokens:, server_tool_use:, service_tier:)
|
49
|
+
# @param cache_creation [Anthropic::Models::CacheCreation, nil] Breakdown of cached tokens by TTL
|
50
|
+
#
|
43
51
|
# @param cache_creation_input_tokens [Integer, nil] The number of input tokens used to create the cache entry.
|
44
52
|
#
|
45
53
|
# @param cache_read_input_tokens [Integer, nil] The number of input tokens read from the cache.
|
data/lib/anthropic/models.rb
CHANGED
@@ -11,16 +11,16 @@ module Anthropic
|
|
11
11
|
mod.constants.each do |name|
|
12
12
|
case mod.const_get(name)
|
13
13
|
in true | false
|
14
|
-
mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T
|
14
|
+
mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
|
15
15
|
mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
|
16
16
|
in Integer
|
17
|
-
mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias {
|
17
|
+
mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
|
18
18
|
mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
|
19
19
|
in Float
|
20
|
-
mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias {
|
20
|
+
mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
|
21
21
|
mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
|
22
22
|
in Symbol
|
23
|
-
mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias {
|
23
|
+
mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
|
24
24
|
mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
|
25
25
|
else
|
26
26
|
end
|
@@ -77,6 +77,8 @@ module Anthropic
|
|
77
77
|
|
78
78
|
CacheControlEphemeral = Anthropic::Models::CacheControlEphemeral
|
79
79
|
|
80
|
+
CacheCreation = Anthropic::Models::CacheCreation
|
81
|
+
|
80
82
|
CitationCharLocation = Anthropic::Models::CitationCharLocation
|
81
83
|
|
82
84
|
CitationCharLocationParam = Anthropic::Models::CitationCharLocationParam
|
@@ -93,6 +95,10 @@ module Anthropic
|
|
93
95
|
|
94
96
|
CitationsDelta = Anthropic::Models::CitationsDelta
|
95
97
|
|
98
|
+
CitationSearchResultLocationParam = Anthropic::Models::CitationSearchResultLocationParam
|
99
|
+
|
100
|
+
CitationsSearchResultLocation = Anthropic::Models::CitationsSearchResultLocation
|
101
|
+
|
96
102
|
CitationsWebSearchResultLocation = Anthropic::Models::CitationsWebSearchResultLocation
|
97
103
|
|
98
104
|
CitationWebSearchResultLocationParam = Anthropic::Models::CitationWebSearchResultLocationParam
|
@@ -179,6 +185,8 @@ module Anthropic
|
|
179
185
|
|
180
186
|
RedactedThinkingBlockParam = Anthropic::Models::RedactedThinkingBlockParam
|
181
187
|
|
188
|
+
SearchResultBlockParam = Anthropic::Models::SearchResultBlockParam
|
189
|
+
|
182
190
|
ServerToolUsage = Anthropic::Models::ServerToolUsage
|
183
191
|
|
184
192
|
ServerToolUseBlock = Anthropic::Models::ServerToolUseBlock
|
@@ -229,6 +237,10 @@ module Anthropic
|
|
229
237
|
|
230
238
|
ToolTextEditor20250124 = Anthropic::Models::ToolTextEditor20250124
|
231
239
|
|
240
|
+
ToolTextEditor20250429 = Anthropic::Models::ToolTextEditor20250429
|
241
|
+
|
242
|
+
ToolTextEditor20250728 = Anthropic::Models::ToolTextEditor20250728
|
243
|
+
|
232
244
|
ToolUnion = Anthropic::Models::ToolUnion
|
233
245
|
|
234
246
|
ToolUseBlock = Anthropic::Models::ToolUseBlock
|
@@ -46,7 +46,7 @@ module Anthropic
|
|
46
46
|
#
|
47
47
|
# @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
|
48
48
|
#
|
49
|
-
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::
|
49
|
+
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910>] Body param: Definitions of tools that the model may use.
|
50
50
|
#
|
51
51
|
# @param top_k [Integer] Body param: Only sample from the top K options for each subsequent token.
|
52
52
|
#
|
@@ -62,7 +62,7 @@ module Anthropic
|
|
62
62
|
def create(params)
|
63
63
|
parsed, options = Anthropic::Beta::MessageCreateParams.dump_request(params)
|
64
64
|
if parsed[:stream]
|
65
|
-
message = "Please use `#
|
65
|
+
message = "Please use `#stream` for the streaming use case."
|
66
66
|
raise ArgumentError.new(message)
|
67
67
|
end
|
68
68
|
|
@@ -89,8 +89,75 @@ module Anthropic
|
|
89
89
|
)
|
90
90
|
end
|
91
91
|
|
92
|
-
|
93
|
-
|
92
|
+
# See {Anthropic::Resources::Beta::Messages#create} for non-streaming counterpart.
|
93
|
+
#
|
94
|
+
# Some parameter documentations has been truncated, see
|
95
|
+
# {Anthropic::Models::Beta::MessageCreateParams} for more details.
|
96
|
+
#
|
97
|
+
# Send a structured list of input messages with text and/or image content, and the
|
98
|
+
# model will generate the next message in the conversation.
|
99
|
+
#
|
100
|
+
# The Messages API can be used for either single queries or stateless multi-turn
|
101
|
+
# conversations.
|
102
|
+
#
|
103
|
+
# Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
|
104
|
+
#
|
105
|
+
# @overload stream_raw(max_tokens:, messages:, model:, container: nil, mcp_servers: nil, metadata: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
|
106
|
+
#
|
107
|
+
# @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
|
108
|
+
#
|
109
|
+
# @param messages [Array<Anthropic::Models::Beta::BetaMessageParam>] Body param: Input messages.
|
110
|
+
#
|
111
|
+
# @param model [Symbol, String, Anthropic::Models::Model] Body param: The model that will complete your prompt.\n\nSee [models](https://do
|
112
|
+
#
|
113
|
+
# @param container [String, nil] Body param: Container identifier for reuse across requests.
|
114
|
+
#
|
115
|
+
# @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] Body param: MCP servers to be utilized in this request
|
116
|
+
#
|
117
|
+
# @param metadata [Anthropic::Models::Beta::BetaMetadata] Body param: An object describing metadata about the request.
|
118
|
+
#
|
119
|
+
# @param service_tier [Symbol, Anthropic::Models::Beta::MessageCreateParams::ServiceTier] Body param: Determines whether to use priority capacity (if available) or standa
|
120
|
+
#
|
121
|
+
# @param stop_sequences [Array<String>] Body param: Custom text sequences that will cause the model to stop generating.
|
122
|
+
#
|
123
|
+
# @param system_ [String, Array<Anthropic::Models::Beta::BetaTextBlockParam>] Body param: System prompt.
|
124
|
+
#
|
125
|
+
# @param temperature [Float] Body param: Amount of randomness injected into the response.
|
126
|
+
#
|
127
|
+
# @param thinking [Anthropic::Models::Beta::BetaThinkingConfigEnabled, Anthropic::Models::Beta::BetaThinkingConfigDisabled] Body param: Configuration for enabling Claude's extended thinking.
|
128
|
+
#
|
129
|
+
# @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
|
130
|
+
#
|
131
|
+
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910>] Body param: Definitions of tools that the model may use.
|
132
|
+
#
|
133
|
+
# @param top_k [Integer] Body param: Only sample from the top K options for each subsequent token.
|
134
|
+
#
|
135
|
+
# @param top_p [Float] Body param: Use nucleus sampling.
|
136
|
+
#
|
137
|
+
# @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
|
138
|
+
#
|
139
|
+
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
|
140
|
+
#
|
141
|
+
# @return [Anthropic::Internal::Stream<Anthropic::Models::Beta::BetaRawMessageStartEvent, Anthropic::Models::Beta::BetaRawMessageDeltaEvent, Anthropic::Models::Beta::BetaRawMessageStopEvent, Anthropic::Models::Beta::BetaRawContentBlockStartEvent, Anthropic::Models::Beta::BetaRawContentBlockDeltaEvent, Anthropic::Models::Beta::BetaRawContentBlockStopEvent>]
|
142
|
+
#
|
143
|
+
# @see Anthropic::Models::Beta::MessageCreateParams
|
144
|
+
def stream(params)
|
145
|
+
parsed, options = Anthropic::Models::Beta::MessageCreateParams.dump_request(params)
|
146
|
+
unless parsed.fetch(:stream, true)
|
147
|
+
message = "Please use `#create` for the non-streaming use case."
|
148
|
+
raise ArgumentError.new(message)
|
149
|
+
end
|
150
|
+
parsed.store(:stream, true)
|
151
|
+
raw_stream = @client.request(
|
152
|
+
method: :post,
|
153
|
+
path: "v1/messages?beta=true",
|
154
|
+
headers: {"accept" => "text/event-stream"},
|
155
|
+
body: parsed,
|
156
|
+
stream: Anthropic::Internal::Stream,
|
157
|
+
model: Anthropic::Beta::BetaRawMessageStreamEvent,
|
158
|
+
options: options
|
159
|
+
)
|
160
|
+
Anthropic::Streaming::MessageStream.new(raw_stream: raw_stream)
|
94
161
|
end
|
95
162
|
|
96
163
|
# See {Anthropic::Resources::Beta::Messages#create} for non-streaming counterpart.
|
@@ -132,7 +199,7 @@ module Anthropic
|
|
132
199
|
#
|
133
200
|
# @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
|
134
201
|
#
|
135
|
-
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::
|
202
|
+
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305>] Body param: Definitions of tools that the model may use.
|
136
203
|
#
|
137
204
|
# @param top_k [Integer] Body param: Only sample from the top K options for each subsequent token.
|
138
205
|
#
|
@@ -192,7 +259,7 @@ module Anthropic
|
|
192
259
|
#
|
193
260
|
# @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
|
194
261
|
#
|
195
|
-
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::
|
262
|
+
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910>] Body param: Definitions of tools that the model may use.
|
196
263
|
#
|
197
264
|
# @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
|
198
265
|
#
|