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
@@ -0,0 +1,199 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Helpers
|
5
|
+
module InputSchema
|
6
|
+
# To customize the JSON schema conversion for a type, implement the `JsonSchemaConverter` interface.
|
7
|
+
module JsonSchemaConverter
|
8
|
+
# @api private
|
9
|
+
POINTERS = Object.new.tap do
|
10
|
+
_1.define_singleton_method(:inspect) do
|
11
|
+
"#<#{Anthropic::Helpers::InputSchema::JsonSchemaConverter}::POINTERS>"
|
12
|
+
end
|
13
|
+
end.freeze
|
14
|
+
# @api private
|
15
|
+
NO_REF = Object.new.tap do
|
16
|
+
_1.define_singleton_method(:inspect) do
|
17
|
+
"#<#{Anthropic::Helpers::InputSchema::JsonSchemaConverter}::NO_REF>"
|
18
|
+
end
|
19
|
+
end.freeze
|
20
|
+
|
21
|
+
# rubocop:disable Lint/UnusedMethodArgument
|
22
|
+
|
23
|
+
# The exact JSON schema produced is subject to improvement between minor release versions.
|
24
|
+
#
|
25
|
+
# @param state [Hash{Symbol=>Object}]
|
26
|
+
#
|
27
|
+
# @option state [Hash{Object=>String}] :defs
|
28
|
+
#
|
29
|
+
# @option state [Array<String>] :path
|
30
|
+
#
|
31
|
+
# @return [Hash{Symbol=>Object}]
|
32
|
+
def to_json_schema_inner(state:) = (raise NotImplementedError)
|
33
|
+
|
34
|
+
# rubocop:enable Lint/UnusedMethodArgument
|
35
|
+
|
36
|
+
# Internal helpers methods.
|
37
|
+
class << self
|
38
|
+
# @api private
|
39
|
+
#
|
40
|
+
# @param schema [Hash{Symbol=>Object}]
|
41
|
+
#
|
42
|
+
# @return [Hash{Symbol=>Object}]
|
43
|
+
def to_nilable(schema)
|
44
|
+
null = "null"
|
45
|
+
case schema
|
46
|
+
in {"$ref": String} | {allOf: _}
|
47
|
+
# For references (simple or with allOf pattern for descriptions),
|
48
|
+
# wrap in anyOf with null. The allOf pattern is used when we need
|
49
|
+
# to add a description to a $ref (JSON Schema doesn't allow
|
50
|
+
# additional properties alongside $ref).
|
51
|
+
{anyOf: [schema, {type: null}]}
|
52
|
+
in {anyOf: schemas}
|
53
|
+
null = {type: null}
|
54
|
+
schemas.any? { _1 == null || _1 == {type: ["null"]} } ? schema : {anyOf: [*schemas, null]}
|
55
|
+
in {type: String => type}
|
56
|
+
type == null ? schema : schema.update(type: [type, null])
|
57
|
+
in {type: Array => types}
|
58
|
+
types.include?(null) ? schema : schema.update(type: [*types, null])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# @api private
|
63
|
+
#
|
64
|
+
# @param schema [Hash{Symbol=>Object}]
|
65
|
+
def assoc_meta!(schema, meta:)
|
66
|
+
xformed = meta.transform_keys(Anthropic::Helpers::InputSchema::PROPERTY_MAPPING)
|
67
|
+
schema.merge!(xformed)
|
68
|
+
end
|
69
|
+
|
70
|
+
# @api private
|
71
|
+
#
|
72
|
+
# @param state [Hash{Symbol=>Object}]
|
73
|
+
#
|
74
|
+
# @option state [Hash{Object=>String}] :defs
|
75
|
+
#
|
76
|
+
# @option state [Array<String>] :path
|
77
|
+
#
|
78
|
+
# @param type [Object]
|
79
|
+
#
|
80
|
+
# @param blk [Proc]
|
81
|
+
#
|
82
|
+
def cache_def!(state, type:, &blk)
|
83
|
+
defs, path = state.fetch_values(:defs, :path)
|
84
|
+
if (stored = defs[type])
|
85
|
+
pointers = stored.fetch(Anthropic::Helpers::InputSchema::JsonSchemaConverter::POINTERS)
|
86
|
+
pointers.first.except(Anthropic::Helpers::InputSchema::JsonSchemaConverter::NO_REF).tap do
|
87
|
+
pointers << _1
|
88
|
+
end
|
89
|
+
else
|
90
|
+
ref_path = String.new
|
91
|
+
ref = {"$ref": ref_path}
|
92
|
+
stored = {
|
93
|
+
Anthropic::Helpers::InputSchema::JsonSchemaConverter::POINTERS => [ref]
|
94
|
+
}
|
95
|
+
defs.store(type, stored)
|
96
|
+
schema = blk.call
|
97
|
+
ref_path.replace("#/$defs/#{path.join('/')}")
|
98
|
+
stored.update(schema)
|
99
|
+
ref
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# @api private
|
104
|
+
#
|
105
|
+
# @param type [Anthropic::Helpers::InputSchema::JsonSchemaConverter, Class]
|
106
|
+
#
|
107
|
+
# @return [Hash{Symbol=>Object}]
|
108
|
+
def to_json_schema(type)
|
109
|
+
defs = {}
|
110
|
+
state = {defs: defs, path: []}
|
111
|
+
schema = Anthropic::Helpers::InputSchema::JsonSchemaConverter.to_json_schema_inner(
|
112
|
+
type,
|
113
|
+
state: state
|
114
|
+
)
|
115
|
+
reused_defs = {}
|
116
|
+
defs.each_value do |acc|
|
117
|
+
sch = acc.except(Anthropic::Helpers::InputSchema::JsonSchemaConverter::POINTERS)
|
118
|
+
pointers = acc.fetch(Anthropic::Helpers::InputSchema::JsonSchemaConverter::POINTERS)
|
119
|
+
|
120
|
+
no_refs, refs = pointers.partition do
|
121
|
+
_1.delete(Anthropic::Helpers::InputSchema::JsonSchemaConverter::NO_REF)
|
122
|
+
end
|
123
|
+
|
124
|
+
case refs
|
125
|
+
in [ref]
|
126
|
+
ref.replace(ref.except(:$ref).merge(sch))
|
127
|
+
in [_, ref, *]
|
128
|
+
reused_defs.store(ref.fetch(:$ref), sch)
|
129
|
+
refs.each do
|
130
|
+
next if (meta = _1.except(:$ref)).empty?
|
131
|
+
# JSON Schema does not allow keyword properties to be defined alongside a $ref.
|
132
|
+
# If we have a keyword property associated with a $ref, it must be wrapped in an allOf.
|
133
|
+
_1.replace(allOf: [_1.slice(:$ref), meta])
|
134
|
+
end
|
135
|
+
else
|
136
|
+
end
|
137
|
+
no_refs.each { _1.replace(_1.except(:$ref).merge(sch)) }
|
138
|
+
end
|
139
|
+
|
140
|
+
xformed = reused_defs.transform_keys { _1.delete_prefix("#/$defs/") }
|
141
|
+
xformed.empty? ? schema : {"$defs": xformed}.update(schema)
|
142
|
+
end
|
143
|
+
|
144
|
+
# @api private
|
145
|
+
#
|
146
|
+
# @param type [Anthropic::Helpers::InputSchema::JsonSchemaConverter, Class]
|
147
|
+
#
|
148
|
+
# @param state [Hash{Symbol=>Object}]
|
149
|
+
#
|
150
|
+
# @option state [Hash{Object=>String}] :defs
|
151
|
+
#
|
152
|
+
# @option state [Array<String>] :path
|
153
|
+
#
|
154
|
+
# @return [Hash{Symbol=>Object}]
|
155
|
+
def to_json_schema_inner(type, state:)
|
156
|
+
case type
|
157
|
+
in {"$ref": String}
|
158
|
+
return type
|
159
|
+
in Anthropic::Helpers::InputSchema::JsonSchemaConverter
|
160
|
+
return type.to_json_schema_inner(state: state)
|
161
|
+
in Class
|
162
|
+
case type
|
163
|
+
in -> { _1 <= NilClass }
|
164
|
+
return {type: "null"}
|
165
|
+
in -> { _1 <= Integer }
|
166
|
+
return {type: "integer"}
|
167
|
+
in -> { _1 <= Float }
|
168
|
+
return {type: "number"}
|
169
|
+
in -> { _1 <= Symbol || _1 <= String }
|
170
|
+
return {type: "string"}
|
171
|
+
else
|
172
|
+
end
|
173
|
+
in _ if Anthropic::Internal::Util.primitive?(type)
|
174
|
+
return {const: type.is_a?(Symbol) ? type.to_s : type}
|
175
|
+
else
|
176
|
+
end
|
177
|
+
|
178
|
+
models = %w[
|
179
|
+
NilClass
|
180
|
+
String
|
181
|
+
Symbol
|
182
|
+
Integer
|
183
|
+
Float
|
184
|
+
Anthropic::Boolean
|
185
|
+
Anthropic::ArrayOf
|
186
|
+
Anthropic::EnumOf
|
187
|
+
Anthropic::UnionOf
|
188
|
+
Anthropic::BaseModel
|
189
|
+
]
|
190
|
+
# rubocop:disable Layout/LineLength
|
191
|
+
message = "#{type} does not implement the #{Anthropic::Helpers::InputSchema::JsonSchemaConverter} interface. Please use one of the supported types: #{models}"
|
192
|
+
# rubocop:enable Layout/LineLength
|
193
|
+
raise ArgumentError.new(message)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Helpers
|
5
|
+
module InputSchema
|
6
|
+
# @abstract
|
7
|
+
#
|
8
|
+
# Like Anthropic::Internal::Type::Unknown, but for parsed JSON values, which can be incomplete or malformed.
|
9
|
+
class ParsedJson < Anthropic::Internal::Type::Unknown
|
10
|
+
class << self
|
11
|
+
# @api private
|
12
|
+
#
|
13
|
+
# No coercion needed for Unknown type.
|
14
|
+
#
|
15
|
+
# @param value [Object]
|
16
|
+
#
|
17
|
+
# @param state [Hash{Symbol=>Object}] .
|
18
|
+
#
|
19
|
+
# @option state [Boolean] :translate_names
|
20
|
+
#
|
21
|
+
# @option state [Boolean] :strictness
|
22
|
+
#
|
23
|
+
# @option state [Hash{Symbol=>Object}] :exactness
|
24
|
+
#
|
25
|
+
# @option state [Class<StandardError>] :error
|
26
|
+
#
|
27
|
+
# @option state [Integer] :branched
|
28
|
+
#
|
29
|
+
# @return [Object]
|
30
|
+
def coerce(value, state:)
|
31
|
+
(state[:error] = value) if value.is_a?(StandardError)
|
32
|
+
|
33
|
+
super
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Helpers
|
5
|
+
module InputSchema
|
6
|
+
# rubocop:disable Style/MutableConstant
|
7
|
+
PROPERTY_MAPPING = {
|
8
|
+
# Numeric properties:
|
9
|
+
minimum: :minimum,
|
10
|
+
maximum: :maximum,
|
11
|
+
exclusive_minimum: :exclusiveMinimum,
|
12
|
+
exclusive_maximum: :exclusiveMaximum,
|
13
|
+
multiple_of: :multipleOf,
|
14
|
+
|
15
|
+
# String properties:
|
16
|
+
min_length: :minLength,
|
17
|
+
max_length: :maxLength,
|
18
|
+
pattern: :pattern,
|
19
|
+
format: :format,
|
20
|
+
content_media_type: :contentMediaType,
|
21
|
+
content_encoding: :contentEncoding,
|
22
|
+
|
23
|
+
# Array properties:
|
24
|
+
min_items: :minItems,
|
25
|
+
max_items: :maxItems,
|
26
|
+
unique_items: :uniqueItems,
|
27
|
+
prefix_items: :prefixItems,
|
28
|
+
contains: :contains,
|
29
|
+
min_contains: :minContains,
|
30
|
+
max_contains: :maxContains,
|
31
|
+
|
32
|
+
# Object properties:
|
33
|
+
pattern_properties: :patternProperties,
|
34
|
+
dependent_schemas: :dependentSchemas,
|
35
|
+
dependent_required: :dependentRequired,
|
36
|
+
property_names: :propertyNames,
|
37
|
+
|
38
|
+
# Metadata:
|
39
|
+
default: :default,
|
40
|
+
examples: :examples,
|
41
|
+
|
42
|
+
doc: :description
|
43
|
+
}
|
44
|
+
# rubocop:enable Style/MutableConstant
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Helpers
|
5
|
+
module InputSchema
|
6
|
+
# @generic Member
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# example = Anthropic::UnionOf[Float, Anthropic::ArrayOf[Integer]]
|
10
|
+
class UnionOf
|
11
|
+
include Anthropic::Internal::Type::Union
|
12
|
+
include Anthropic::Helpers::InputSchema::JsonSchemaConverter
|
13
|
+
|
14
|
+
# @api private
|
15
|
+
#
|
16
|
+
# @param state [Hash{Symbol=>Object}]
|
17
|
+
#
|
18
|
+
# @option state [Hash{Object=>String}] :defs
|
19
|
+
#
|
20
|
+
# @option state [Array<String>] :path
|
21
|
+
#
|
22
|
+
# @return [Hash{Symbol=>Object}]
|
23
|
+
def to_json_schema_inner(state:)
|
24
|
+
Anthropic::Helpers::InputSchema::JsonSchemaConverter.cache_def!(state, type: self) do
|
25
|
+
path = state.fetch(:path)
|
26
|
+
mergeable_keys = {[:anyOf] => 0, [:type] => 0}
|
27
|
+
schemas = variants.to_enum.with_index.map do
|
28
|
+
new_state = {**state, path: [*path, "?.#{_2}"]}
|
29
|
+
Anthropic::Helpers::InputSchema::JsonSchemaConverter.to_json_schema_inner(
|
30
|
+
_1,
|
31
|
+
state: new_state
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
schemas.each do |schema|
|
36
|
+
mergeable_keys.each_key { mergeable_keys[_1] += 1 if schema.keys == _1 }
|
37
|
+
end
|
38
|
+
mergeable = mergeable_keys.any? { _1.last == schemas.length }
|
39
|
+
mergeable ? Anthropic::Internal::Util.deep_merge(*schemas, concat: true) : {anyOf: schemas}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private_class_method :new
|
44
|
+
|
45
|
+
def self.[](...) = new(...)
|
46
|
+
|
47
|
+
# @param variants [Array<generic<Member>>]
|
48
|
+
def initialize(*variants)
|
49
|
+
variants.each do |v|
|
50
|
+
v.is_a?(Proc) ? variant(v) : variant(-> { v })
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Helpers
|
5
|
+
# Helpers for the structured output API.
|
6
|
+
#
|
7
|
+
# see https://platform.Anthropic.com/docs/guides/structured-outputs
|
8
|
+
# see https://json-schema.org
|
9
|
+
#
|
10
|
+
# Based on the DSL in {Anthropic::Internal::Type}, but currently only support the limited subset of JSON schema types used in structured output APIs.
|
11
|
+
#
|
12
|
+
# Supported types: {NilClass} {String} {Symbol} {Integer} {Float} {Anthropic::Boolean}, {Anthropic::EnumOf}, {Anthropic::UnionOf}, {Anthropic::ArrayOf}, {Anthropic::BaseModel}
|
13
|
+
module InputSchema
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Helpers
|
5
|
+
module Streaming
|
6
|
+
class TextEvent < Anthropic::Internal::Type::BaseModel
|
7
|
+
# @!attribute type
|
8
|
+
#
|
9
|
+
# @return [Symbol, :text]
|
10
|
+
required :type, const: :text
|
11
|
+
|
12
|
+
# @!attribute text
|
13
|
+
# The text delta received in this streaming event.
|
14
|
+
#
|
15
|
+
# @return [String]
|
16
|
+
required :text, String
|
17
|
+
|
18
|
+
# @!attribute snapshot
|
19
|
+
# The entire accumulated text up to this point in the stream.
|
20
|
+
#
|
21
|
+
# @return [String]
|
22
|
+
required :snapshot, String
|
23
|
+
end
|
24
|
+
|
25
|
+
class CitationEvent < Anthropic::Internal::Type::BaseModel
|
26
|
+
# @!attribute type
|
27
|
+
#
|
28
|
+
# @return [Symbol, :citation]
|
29
|
+
required :type, const: :citation
|
30
|
+
|
31
|
+
# @!attribute citation
|
32
|
+
# The new citation received in this streaming event.
|
33
|
+
#
|
34
|
+
# @return [Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation]
|
35
|
+
required :citation, union: -> { Anthropic::CitationsDelta::Citation }
|
36
|
+
|
37
|
+
# @!attribute snapshot
|
38
|
+
# All of the accumulated citations up to this point in the stream.
|
39
|
+
#
|
40
|
+
# @return [Array<Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation>]
|
41
|
+
required :snapshot,
|
42
|
+
-> {
|
43
|
+
Anthropic::Internal::Type::ArrayOf[union: Anthropic::CitationsDelta::Citation]
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
class ThinkingEvent < Anthropic::Internal::Type::BaseModel
|
48
|
+
# @!attribute type
|
49
|
+
#
|
50
|
+
# @return [Symbol, :thinking]
|
51
|
+
required :type, const: :thinking
|
52
|
+
|
53
|
+
# @!attribute thinking
|
54
|
+
# The thinking delta received in this streaming event.
|
55
|
+
#
|
56
|
+
# @return [String]
|
57
|
+
required :thinking, String
|
58
|
+
|
59
|
+
# @!attribute snapshot
|
60
|
+
# The accumulated thinking content up to this point in the stream.
|
61
|
+
#
|
62
|
+
# @return [String]
|
63
|
+
required :snapshot, String
|
64
|
+
end
|
65
|
+
|
66
|
+
class SignatureEvent < Anthropic::Internal::Type::BaseModel
|
67
|
+
# @!attribute type
|
68
|
+
#
|
69
|
+
# @return [Symbol, :signature]
|
70
|
+
required :type, const: :signature
|
71
|
+
|
72
|
+
# @!attribute signature
|
73
|
+
# The signature of the thinking block.
|
74
|
+
#
|
75
|
+
# @return [String]
|
76
|
+
required :signature, String
|
77
|
+
end
|
78
|
+
|
79
|
+
class InputJsonEvent < Anthropic::Internal::Type::BaseModel
|
80
|
+
# @!attribute type
|
81
|
+
#
|
82
|
+
# @return [Symbol, :input_json]
|
83
|
+
required :type, const: :input_json
|
84
|
+
|
85
|
+
# @!attribute partial_json
|
86
|
+
# A partial JSON string delta received in this streaming event.
|
87
|
+
#
|
88
|
+
# Example:
|
89
|
+
# ```
|
90
|
+
# "{'location':,"
|
91
|
+
# ```
|
92
|
+
#
|
93
|
+
# @return [String]
|
94
|
+
required :partial_json, String
|
95
|
+
|
96
|
+
# @!attribute snapshot
|
97
|
+
# The currently accumulated parsed object up to this point in the stream.
|
98
|
+
#
|
99
|
+
# Example:
|
100
|
+
# ```
|
101
|
+
# {'location': 'San Francisco, CA'}
|
102
|
+
# ```
|
103
|
+
#
|
104
|
+
# @return [Object]
|
105
|
+
required :snapshot, Anthropic::Internal::Type::Unknown
|
106
|
+
end
|
107
|
+
|
108
|
+
class MessageStopEvent < Anthropic::Models::RawMessageStopEvent
|
109
|
+
# @!attribute type
|
110
|
+
#
|
111
|
+
# @return [Symbol, :message_stop]
|
112
|
+
required :type, const: :message_stop
|
113
|
+
|
114
|
+
# @!attribute message
|
115
|
+
# The completed message when streaming ends.
|
116
|
+
#
|
117
|
+
# @return [Anthropic::Models::Message]
|
118
|
+
required :message, Anthropic::Models::Message
|
119
|
+
end
|
120
|
+
|
121
|
+
class ContentBlockStopEvent < Anthropic::Models::RawContentBlockStopEvent
|
122
|
+
# @!attribute index
|
123
|
+
# The index of the content block that has stopped streaming.
|
124
|
+
#
|
125
|
+
# @return [Integer]
|
126
|
+
required :index, Integer
|
127
|
+
|
128
|
+
# @!attribute type
|
129
|
+
#
|
130
|
+
# @return [Symbol, :content_block_stop]
|
131
|
+
required :type, const: :content_block_stop
|
132
|
+
|
133
|
+
# @!attribute content_block
|
134
|
+
# The completed content block when streaming for this block ends.
|
135
|
+
#
|
136
|
+
# @return [Anthropic::Models::TextBlock, Anthropic::Models::ToolUseBlock]
|
137
|
+
required :content_block, Anthropic::Models::ContentBlock
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|