anthropic-sdk-beta 0.1.0.pre.beta.6 → 0.1.0.pre.beta.7
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/.ignore +2 -0
- data/CHANGELOG.md +88 -0
- data/README.md +171 -126
- data/lib/anthropic/bedrock.rb +5 -0
- data/lib/anthropic/client.rb +7 -6
- data/lib/anthropic/errors.rb +10 -10
- data/lib/anthropic/file_part.rb +55 -0
- data/lib/anthropic/helpers/bedrock/client.rb +259 -0
- data/lib/anthropic/helpers/vertex/client.rb +218 -0
- data/lib/anthropic/internal/page.rb +28 -38
- data/lib/anthropic/internal/transport/base_client.rb +104 -19
- data/lib/anthropic/internal/transport/pooled_net_requester.rb +20 -4
- data/lib/anthropic/internal/type/array_of.rb +28 -2
- data/lib/anthropic/internal/type/base_model.rb +125 -31
- data/lib/anthropic/internal/type/base_page.rb +10 -1
- data/lib/anthropic/internal/type/base_stream.rb +19 -2
- data/lib/anthropic/internal/type/boolean.rb +16 -11
- data/lib/anthropic/internal/type/converter.rb +46 -1
- data/lib/anthropic/internal/type/enum.rb +43 -23
- data/lib/anthropic/internal/type/{io_like.rb → file_input.rb} +36 -15
- data/lib/anthropic/internal/type/hash_of.rb +28 -2
- data/lib/anthropic/internal/type/request_parameters.rb +7 -14
- data/lib/anthropic/internal/type/union.rb +32 -8
- data/lib/anthropic/internal/type/unknown.rb +16 -11
- data/lib/anthropic/internal/util.rb +180 -73
- data/lib/anthropic/internal.rb +11 -2
- data/lib/anthropic/models/anthropic_beta.rb +14 -11
- data/lib/anthropic/models/api_error_object.rb +3 -7
- data/lib/anthropic/models/authentication_error.rb +3 -7
- data/lib/anthropic/models/base64_image_source.rb +9 -16
- data/lib/anthropic/models/base64_pdf_source.rb +4 -8
- data/lib/anthropic/models/beta/beta_base64_image_source.rb +9 -16
- data/lib/anthropic/models/beta/beta_base64_pdf_block.rb +38 -30
- data/lib/anthropic/models/beta/beta_base64_pdf_source.rb +4 -8
- data/lib/anthropic/models/beta/beta_cache_control_ephemeral.rb +2 -6
- data/lib/anthropic/models/beta/beta_citation_char_location.rb +7 -21
- data/lib/anthropic/models/beta/beta_citation_char_location_param.rb +7 -21
- data/lib/anthropic/models/beta/beta_citation_content_block_location.rb +7 -21
- data/lib/anthropic/models/beta/beta_citation_content_block_location_param.rb +7 -21
- data/lib/anthropic/models/beta/beta_citation_page_location.rb +7 -21
- data/lib/anthropic/models/beta/beta_citation_page_location_param.rb +7 -21
- data/lib/anthropic/models/beta/beta_citation_web_search_result_location_param.rb +43 -0
- data/lib/anthropic/models/beta/beta_citations_config_param.rb +3 -11
- data/lib/anthropic/models/beta/beta_citations_delta.rb +24 -16
- data/lib/anthropic/models/beta/beta_citations_web_search_result_location.rb +43 -0
- data/lib/anthropic/models/beta/beta_content_block.rb +23 -7
- data/lib/anthropic/models/beta/beta_content_block_param.rb +29 -10
- data/lib/anthropic/models/beta/beta_content_block_source.rb +23 -15
- data/lib/anthropic/models/beta/beta_content_block_source_content.rb +8 -5
- data/lib/anthropic/models/beta/beta_image_block_param.rb +22 -18
- data/lib/anthropic/models/beta/beta_input_json_delta.rb +3 -7
- data/lib/anthropic/models/beta/beta_message.rb +27 -22
- data/lib/anthropic/models/beta/beta_message_delta_usage.rb +33 -5
- data/lib/anthropic/models/beta/beta_message_param.rb +37 -23
- data/lib/anthropic/models/beta/beta_message_tokens_count.rb +5 -6
- data/lib/anthropic/models/beta/beta_metadata.rb +5 -6
- data/lib/anthropic/models/beta/beta_model_info.rb +11 -9
- data/lib/anthropic/models/beta/beta_plain_text_source.rb +4 -8
- data/lib/anthropic/models/beta/beta_raw_content_block_delta.rb +19 -8
- data/lib/anthropic/models/beta/beta_raw_content_block_delta_event.rb +6 -10
- data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +30 -19
- data/lib/anthropic/models/beta/beta_raw_content_block_stop_event.rb +3 -7
- data/lib/anthropic/models/beta/beta_raw_message_delta_event.rb +19 -22
- data/lib/anthropic/models/beta/beta_raw_message_start_event.rb +5 -9
- data/lib/anthropic/models/beta/beta_raw_message_stop_event.rb +2 -6
- data/lib/anthropic/models/beta/beta_raw_message_stream_event.rb +21 -9
- data/lib/anthropic/models/beta/beta_redacted_thinking_block.rb +3 -7
- data/lib/anthropic/models/beta/beta_redacted_thinking_block_param.rb +3 -7
- data/lib/anthropic/models/beta/beta_server_tool_usage.rb +20 -0
- data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +37 -0
- data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +48 -0
- data/lib/anthropic/models/beta/beta_signature_delta.rb +3 -7
- data/lib/anthropic/models/beta/beta_stop_reason.rb +4 -5
- data/lib/anthropic/models/beta/beta_text_block.rb +11 -10
- data/lib/anthropic/models/beta/beta_text_block_param.rb +13 -13
- data/lib/anthropic/models/beta/beta_text_citation.rb +18 -6
- data/lib/anthropic/models/beta/beta_text_citation_param.rb +18 -6
- data/lib/anthropic/models/beta/beta_text_delta.rb +3 -7
- data/lib/anthropic/models/beta/beta_thinking_block.rb +4 -8
- data/lib/anthropic/models/beta/beta_thinking_block_param.rb +4 -8
- data/lib/anthropic/models/beta/beta_thinking_config_disabled.rb +2 -6
- data/lib/anthropic/models/beta/beta_thinking_config_enabled.rb +7 -7
- data/lib/anthropic/models/beta/beta_thinking_config_param.rb +10 -5
- data/lib/anthropic/models/beta/beta_thinking_delta.rb +3 -7
- data/lib/anthropic/models/beta/beta_tool.rb +34 -41
- data/lib/anthropic/models/beta/beta_tool_bash_20241022.rb +13 -11
- data/lib/anthropic/models/beta/beta_tool_bash_20250124.rb +13 -11
- data/lib/anthropic/models/beta/beta_tool_choice.rb +18 -8
- data/lib/anthropic/models/beta/beta_tool_choice_any.rb +10 -14
- data/lib/anthropic/models/beta/beta_tool_choice_auto.rb +10 -14
- data/lib/anthropic/models/beta/beta_tool_choice_none.rb +4 -8
- data/lib/anthropic/models/beta/beta_tool_choice_tool.rb +12 -15
- data/lib/anthropic/models/beta/beta_tool_computer_use_20241022.rb +19 -24
- data/lib/anthropic/models/beta/beta_tool_computer_use_20250124.rb +19 -24
- data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +47 -35
- data/lib/anthropic/models/beta/beta_tool_text_editor_20241022.rb +13 -11
- data/lib/anthropic/models/beta/beta_tool_text_editor_20250124.rb +13 -11
- data/lib/anthropic/models/beta/beta_tool_union.rb +26 -10
- data/lib/anthropic/models/beta/beta_tool_use_block.rb +5 -9
- data/lib/anthropic/models/beta/beta_tool_use_block_param.rb +13 -12
- data/lib/anthropic/models/beta/beta_url_image_source.rb +3 -7
- data/lib/anthropic/models/beta/beta_url_pdf_source.rb +3 -7
- data/lib/anthropic/models/beta/beta_usage.rb +15 -8
- data/lib/anthropic/models/beta/beta_web_search_result_block.rb +43 -0
- data/lib/anthropic/models/beta/beta_web_search_result_block_param.rb +43 -0
- data/lib/anthropic/models/beta/beta_web_search_tool_20250305.rb +126 -0
- data/lib/anthropic/models/beta/beta_web_search_tool_request_error.rb +39 -0
- data/lib/anthropic/models/beta/beta_web_search_tool_result_block.rb +31 -0
- data/lib/anthropic/models/beta/beta_web_search_tool_result_block_content.rb +33 -0
- data/lib/anthropic/models/beta/beta_web_search_tool_result_block_param.rb +41 -0
- data/lib/anthropic/models/beta/beta_web_search_tool_result_block_param_content.rb +35 -0
- data/lib/anthropic/models/beta/beta_web_search_tool_result_error.rb +39 -0
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +80 -84
- data/lib/anthropic/models/beta/message_create_params.rb +71 -111
- data/lib/anthropic/models/beta/messages/batch_cancel_params.rb +8 -16
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +105 -140
- data/lib/anthropic/models/beta/messages/batch_delete_params.rb +8 -16
- data/lib/anthropic/models/beta/messages/batch_list_params.rb +20 -34
- data/lib/anthropic/models/beta/messages/batch_results_params.rb +8 -16
- data/lib/anthropic/models/beta/messages/batch_retrieve_params.rb +8 -16
- data/lib/anthropic/models/beta/messages/beta_deleted_message_batch.rb +7 -7
- data/lib/anthropic/models/beta/messages/beta_message_batch.rb +32 -39
- data/lib/anthropic/models/beta/messages/beta_message_batch_canceled_result.rb +2 -6
- data/lib/anthropic/models/beta/messages/beta_message_batch_errored_result.rb +5 -9
- data/lib/anthropic/models/beta/messages/beta_message_batch_expired_result.rb +2 -6
- data/lib/anthropic/models/beta/messages/beta_message_batch_individual_response.rb +13 -12
- data/lib/anthropic/models/beta/messages/beta_message_batch_request_counts.rb +13 -10
- data/lib/anthropic/models/beta/messages/beta_message_batch_result.rb +17 -7
- data/lib/anthropic/models/beta/messages/beta_message_batch_succeeded_result.rb +5 -9
- data/lib/anthropic/models/beta/model_list_params.rb +22 -25
- data/lib/anthropic/models/beta/model_retrieve_params.rb +10 -7
- data/lib/anthropic/models/beta_api_error.rb +3 -7
- data/lib/anthropic/models/beta_authentication_error.rb +3 -7
- data/lib/anthropic/models/beta_billing_error.rb +3 -7
- data/lib/anthropic/models/beta_error.rb +27 -12
- data/lib/anthropic/models/beta_error_response.rb +5 -9
- data/lib/anthropic/models/beta_gateway_timeout_error.rb +3 -7
- data/lib/anthropic/models/beta_invalid_request_error.rb +3 -7
- data/lib/anthropic/models/beta_not_found_error.rb +3 -7
- data/lib/anthropic/models/beta_overloaded_error.rb +3 -7
- data/lib/anthropic/models/beta_permission_error.rb +3 -7
- data/lib/anthropic/models/beta_rate_limit_error.rb +3 -7
- data/lib/anthropic/models/billing_error.rb +3 -7
- data/lib/anthropic/models/cache_control_ephemeral.rb +2 -6
- data/lib/anthropic/models/citation_char_location.rb +7 -21
- data/lib/anthropic/models/citation_char_location_param.rb +7 -21
- data/lib/anthropic/models/citation_content_block_location.rb +7 -21
- data/lib/anthropic/models/citation_content_block_location_param.rb +7 -21
- data/lib/anthropic/models/citation_page_location.rb +7 -21
- data/lib/anthropic/models/citation_page_location_param.rb +7 -21
- data/lib/anthropic/models/citation_web_search_result_location_param.rb +39 -0
- data/lib/anthropic/models/citations_config_param.rb +3 -11
- data/lib/anthropic/models/citations_delta.rb +24 -16
- data/lib/anthropic/models/citations_web_search_result_location.rb +39 -0
- data/lib/anthropic/models/completion.rb +15 -12
- data/lib/anthropic/models/completion_create_params.rb +38 -57
- data/lib/anthropic/models/content_block.rb +23 -7
- data/lib/anthropic/models/content_block_param.rb +29 -10
- data/lib/anthropic/models/content_block_source.rb +17 -15
- data/lib/anthropic/models/content_block_source_content.rb +8 -5
- data/lib/anthropic/models/document_block_param.rb +38 -30
- data/lib/anthropic/models/error_object.rb +27 -12
- data/lib/anthropic/models/error_response.rb +5 -9
- data/lib/anthropic/models/gateway_timeout_error.rb +3 -7
- data/lib/anthropic/models/image_block_param.rb +20 -18
- data/lib/anthropic/models/input_json_delta.rb +3 -7
- data/lib/anthropic/models/invalid_request_error.rb +3 -7
- data/lib/anthropic/models/message.rb +27 -21
- data/lib/anthropic/models/message_count_tokens_params.rb +45 -52
- data/lib/anthropic/models/message_count_tokens_tool.rb +18 -6
- data/lib/anthropic/models/message_create_params.rb +64 -101
- data/lib/anthropic/models/message_delta_usage.rb +33 -5
- data/lib/anthropic/models/message_param.rb +39 -24
- data/lib/anthropic/models/message_tokens_count.rb +5 -6
- data/lib/anthropic/models/messages/batch_cancel_params.rb +3 -8
- data/lib/anthropic/models/messages/batch_create_params.rb +92 -131
- data/lib/anthropic/models/messages/batch_delete_params.rb +3 -8
- data/lib/anthropic/models/messages/batch_list_params.rb +15 -26
- data/lib/anthropic/models/messages/batch_results_params.rb +3 -8
- data/lib/anthropic/models/messages/batch_retrieve_params.rb +3 -8
- data/lib/anthropic/models/messages/deleted_message_batch.rb +7 -7
- data/lib/anthropic/models/messages/message_batch.rb +30 -39
- data/lib/anthropic/models/messages/message_batch_canceled_result.rb +2 -6
- data/lib/anthropic/models/messages/message_batch_errored_result.rb +5 -9
- data/lib/anthropic/models/messages/message_batch_expired_result.rb +2 -6
- data/lib/anthropic/models/messages/message_batch_individual_response.rb +12 -12
- data/lib/anthropic/models/messages/message_batch_request_counts.rb +13 -10
- data/lib/anthropic/models/messages/message_batch_result.rb +17 -7
- data/lib/anthropic/models/messages/message_batch_succeeded_result.rb +5 -9
- data/lib/anthropic/models/metadata.rb +5 -6
- data/lib/anthropic/models/model.rb +19 -16
- data/lib/anthropic/models/model_info.rb +11 -9
- data/lib/anthropic/models/model_list_params.rb +22 -25
- data/lib/anthropic/models/model_retrieve_params.rb +10 -7
- data/lib/anthropic/models/not_found_error.rb +3 -7
- data/lib/anthropic/models/overloaded_error.rb +3 -7
- data/lib/anthropic/models/permission_error.rb +3 -7
- data/lib/anthropic/models/plain_text_source.rb +4 -8
- data/lib/anthropic/models/rate_limit_error.rb +3 -7
- data/lib/anthropic/models/raw_content_block_delta.rb +19 -8
- data/lib/anthropic/models/raw_content_block_delta_event.rb +6 -10
- data/lib/anthropic/models/raw_content_block_start_event.rb +30 -18
- data/lib/anthropic/models/raw_content_block_stop_event.rb +3 -7
- data/lib/anthropic/models/raw_message_delta_event.rb +19 -22
- data/lib/anthropic/models/raw_message_start_event.rb +5 -9
- data/lib/anthropic/models/raw_message_stop_event.rb +2 -6
- data/lib/anthropic/models/raw_message_stream_event.rb +21 -9
- data/lib/anthropic/models/redacted_thinking_block.rb +3 -7
- data/lib/anthropic/models/redacted_thinking_block_param.rb +3 -7
- data/lib/anthropic/models/server_tool_usage.rb +16 -0
- data/lib/anthropic/models/server_tool_use_block.rb +33 -0
- data/lib/anthropic/models/server_tool_use_block_param.rb +44 -0
- data/lib/anthropic/models/signature_delta.rb +3 -7
- data/lib/anthropic/models/stop_reason.rb +4 -5
- data/lib/anthropic/models/text_block.rb +13 -10
- data/lib/anthropic/models/text_block_param.rb +13 -13
- data/lib/anthropic/models/text_citation.rb +18 -6
- data/lib/anthropic/models/text_citation_param.rb +18 -6
- data/lib/anthropic/models/text_delta.rb +3 -7
- data/lib/anthropic/models/thinking_block.rb +4 -8
- data/lib/anthropic/models/thinking_block_param.rb +4 -8
- data/lib/anthropic/models/thinking_config_disabled.rb +2 -6
- data/lib/anthropic/models/thinking_config_enabled.rb +7 -7
- data/lib/anthropic/models/thinking_config_param.rb +8 -5
- data/lib/anthropic/models/thinking_delta.rb +3 -7
- data/lib/anthropic/models/tool.rb +42 -30
- data/lib/anthropic/models/tool_bash_20250124.rb +13 -11
- data/lib/anthropic/models/tool_choice.rb +17 -7
- data/lib/anthropic/models/tool_choice_any.rb +10 -14
- data/lib/anthropic/models/tool_choice_auto.rb +10 -14
- data/lib/anthropic/models/tool_choice_none.rb +4 -8
- data/lib/anthropic/models/tool_choice_tool.rb +12 -15
- data/lib/anthropic/models/tool_result_block_param.rb +37 -35
- data/lib/anthropic/models/tool_text_editor_20250124.rb +13 -11
- data/lib/anthropic/models/tool_union.rb +18 -6
- data/lib/anthropic/models/tool_use_block.rb +5 -9
- data/lib/anthropic/models/tool_use_block_param.rb +13 -12
- data/lib/anthropic/models/url_image_source.rb +3 -7
- data/lib/anthropic/models/url_pdf_source.rb +3 -7
- data/lib/anthropic/models/usage.rb +15 -8
- data/lib/anthropic/models/web_search_result_block.rb +39 -0
- data/lib/anthropic/models/web_search_result_block_param.rb +39 -0
- data/lib/anthropic/models/web_search_tool_20250305.rb +122 -0
- data/lib/anthropic/models/web_search_tool_request_error.rb +35 -0
- data/lib/anthropic/models/web_search_tool_result_block.rb +27 -0
- data/lib/anthropic/models/web_search_tool_result_block_content.rb +23 -0
- data/lib/anthropic/models/web_search_tool_result_block_param.rb +37 -0
- data/lib/anthropic/models/web_search_tool_result_block_param_content.rb +26 -0
- data/lib/anthropic/models/web_search_tool_result_error.rb +35 -0
- data/lib/anthropic/models.rb +250 -0
- data/lib/anthropic/request_options.rb +8 -6
- data/lib/anthropic/resources/beta/messages/batches.rb +58 -38
- data/lib/anthropic/resources/beta/messages.rb +86 -44
- data/lib/anthropic/resources/beta/models.rb +28 -13
- data/lib/anthropic/resources/completions.rb +61 -29
- data/lib/anthropic/resources/messages/batches.rb +36 -22
- data/lib/anthropic/resources/messages.rb +80 -41
- data/lib/anthropic/resources/models.rb +28 -13
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic/vertex.rb +5 -0
- data/lib/anthropic.rb +37 -12
- data/rbi/anthropic/bedrock.rbi +5 -0
- data/rbi/{lib/anthropic → anthropic}/client.rbi +16 -12
- data/rbi/{lib/anthropic → anthropic}/errors.rbi +34 -15
- data/rbi/anthropic/file_part.rbi +37 -0
- data/rbi/anthropic/helpers/bedrock/client.rbi +82 -0
- data/rbi/anthropic/helpers/vertex/client.rbi +58 -0
- data/rbi/{lib/anthropic → anthropic}/internal/jsonl_stream.rbi +3 -2
- data/rbi/{lib/anthropic → anthropic}/internal/page.rbi +3 -1
- data/rbi/{lib/anthropic → anthropic}/internal/stream.rbi +6 -2
- data/rbi/anthropic/internal/transport/base_client.rbi +310 -0
- data/rbi/{lib/anthropic → anthropic}/internal/transport/pooled_net_requester.rbi +32 -13
- data/rbi/anthropic/internal/type/array_of.rbi +98 -0
- data/rbi/anthropic/internal/type/base_model.rbi +299 -0
- data/rbi/{lib/anthropic → anthropic}/internal/type/base_page.rbi +14 -8
- data/rbi/{lib/anthropic → anthropic}/internal/type/base_stream.rbi +27 -10
- data/rbi/anthropic/internal/type/boolean.rbi +50 -0
- data/rbi/{lib/anthropic → anthropic}/internal/type/converter.rbi +76 -26
- data/rbi/{lib/anthropic → anthropic}/internal/type/enum.rbi +33 -19
- data/rbi/{lib/anthropic/internal/type/io_like.rbi → anthropic/internal/type/file_input.rbi} +18 -11
- data/rbi/anthropic/internal/type/hash_of.rbi +98 -0
- data/rbi/anthropic/internal/type/request_parameters.rbi +29 -0
- data/rbi/anthropic/internal/type/union.rbi +111 -0
- data/rbi/anthropic/internal/type/unknown.rbi +50 -0
- data/rbi/anthropic/internal/util.rbi +451 -0
- data/rbi/{lib/anthropic → anthropic}/internal.rbi +3 -2
- data/rbi/anthropic/models/anthropic_beta.rbi +54 -0
- data/rbi/{lib/anthropic → anthropic}/models/api_error_object.rbi +10 -3
- data/rbi/{lib/anthropic → anthropic}/models/authentication_error.rbi +10 -3
- data/rbi/anthropic/models/base64_image_source.rbi +82 -0
- data/rbi/anthropic/models/base64_pdf_source.rbi +35 -0
- data/rbi/anthropic/models/beta/beta_base64_image_source.rbi +95 -0
- data/rbi/anthropic/models/beta/beta_base64_pdf_block.rbi +134 -0
- data/rbi/anthropic/models/beta/beta_base64_pdf_source.rbi +42 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_cache_control_ephemeral.rbi +15 -5
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_citation_char_location.rbi +23 -16
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_citation_char_location_param.rbi +23 -16
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_citation_content_block_location.rbi +26 -17
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_citation_content_block_location_param.rbi +27 -17
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_citation_page_location.rbi +23 -16
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_citation_page_location_param.rbi +23 -16
- data/rbi/anthropic/models/beta/beta_citation_web_search_result_location_param.rbi +67 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_citations_config_param.rbi +15 -5
- data/rbi/anthropic/models/beta/beta_citations_delta.rbi +88 -0
- data/rbi/anthropic/models/beta/beta_citations_web_search_result_location.rbi +67 -0
- data/rbi/anthropic/models/beta/beta_content_block.rbi +33 -0
- data/rbi/anthropic/models/beta/beta_content_block_param.rbi +36 -0
- data/rbi/anthropic/models/beta/beta_content_block_source.rbi +110 -0
- data/rbi/anthropic/models/beta/beta_content_block_source_content.rbi +29 -0
- data/rbi/anthropic/models/beta/beta_image_block_param.rbi +101 -0
- data/rbi/anthropic/models/beta/beta_input_json_delta.rbi +35 -0
- data/rbi/anthropic/models/beta/beta_message.rbi +268 -0
- data/rbi/anthropic/models/beta/beta_message_delta_usage.rbi +85 -0
- data/rbi/anthropic/models/beta/beta_message_param.rbi +162 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_message_tokens_count.rbi +19 -5
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_metadata.rbi +19 -5
- data/rbi/anthropic/models/beta/beta_model_info.rbi +66 -0
- data/rbi/anthropic/models/beta/beta_plain_text_source.rbi +42 -0
- data/rbi/anthropic/models/beta/beta_raw_content_block_delta.rbi +32 -0
- data/rbi/anthropic/models/beta/beta_raw_content_block_delta_event.rbi +74 -0
- data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +103 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_raw_content_block_stop_event.rbi +15 -5
- data/rbi/anthropic/models/beta/beta_raw_message_delta_event.rbi +135 -0
- data/rbi/anthropic/models/beta/beta_raw_message_start_event.rbi +45 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_raw_message_stop_event.rbi +15 -5
- data/rbi/anthropic/models/beta/beta_raw_message_stream_event.rbi +33 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_redacted_thinking_block.rbi +15 -5
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_redacted_thinking_block_param.rbi +15 -5
- data/rbi/anthropic/models/beta/beta_server_tool_usage.rbi +34 -0
- data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +50 -0
- data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +78 -0
- data/rbi/anthropic/models/beta/beta_signature_delta.rbi +35 -0
- data/rbi/anthropic/models/beta/beta_stop_reason.rbi +37 -0
- data/rbi/anthropic/models/beta/beta_text_block.rbi +94 -0
- data/rbi/anthropic/models/beta/beta_text_block_param.rbi +105 -0
- data/rbi/anthropic/models/beta/beta_text_citation.rbi +31 -0
- data/rbi/anthropic/models/beta/beta_text_citation_param.rbi +31 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_text_delta.rbi +12 -5
- data/rbi/anthropic/models/beta/beta_thinking_block.rbi +44 -0
- data/rbi/anthropic/models/beta/beta_thinking_block_param.rbi +44 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_thinking_config_disabled.rbi +15 -5
- data/rbi/anthropic/models/beta/beta_thinking_config_enabled.rbi +56 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_thinking_config_param.rbi +15 -7
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_thinking_delta.rbi +15 -5
- data/rbi/anthropic/models/beta/beta_tool.rbi +165 -0
- data/rbi/anthropic/models/beta/beta_tool_bash_20241022.rbi +72 -0
- data/rbi/anthropic/models/beta/beta_tool_bash_20250124.rbi +72 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_tool_choice.rbi +15 -7
- data/rbi/anthropic/models/beta/beta_tool_choice_any.rbi +56 -0
- data/rbi/anthropic/models/beta/beta_tool_choice_auto.rbi +56 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_tool_choice_none.rbi +15 -5
- data/rbi/anthropic/models/beta/beta_tool_choice_tool.rbi +68 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_tool_computer_use_20241022.rbi +42 -23
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_tool_computer_use_20250124.rbi +42 -23
- data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +187 -0
- data/rbi/anthropic/models/beta/beta_tool_text_editor_20241022.rbi +72 -0
- data/rbi/anthropic/models/beta/beta_tool_text_editor_20250124.rbi +72 -0
- data/rbi/anthropic/models/beta/beta_tool_union.rbi +33 -0
- data/rbi/anthropic/models/beta/beta_tool_use_block.rbi +50 -0
- data/rbi/anthropic/models/beta/beta_tool_use_block_param.rbi +78 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_url_image_source.rbi +15 -5
- data/rbi/{lib/anthropic → anthropic}/models/beta/beta_url_pdf_source.rbi +15 -5
- data/rbi/anthropic/models/beta/beta_usage.rbi +82 -0
- data/rbi/anthropic/models/beta/beta_web_search_result_block.rbi +66 -0
- data/rbi/anthropic/models/beta/beta_web_search_result_block_param.rbi +66 -0
- data/rbi/anthropic/models/beta/beta_web_search_tool_20250305.rbi +201 -0
- data/rbi/anthropic/models/beta/beta_web_search_tool_request_error.rbi +100 -0
- data/rbi/anthropic/models/beta/beta_web_search_tool_result_block.rbi +65 -0
- data/rbi/anthropic/models/beta/beta_web_search_tool_result_block_content.rbi +40 -0
- data/rbi/anthropic/models/beta/beta_web_search_tool_result_block_param.rbi +89 -0
- data/rbi/anthropic/models/beta/beta_web_search_tool_result_block_param_content.rbi +40 -0
- data/rbi/anthropic/models/beta/beta_web_search_tool_result_error.rbi +100 -0
- data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +656 -0
- data/rbi/anthropic/models/beta/message_create_params.rbi +759 -0
- data/rbi/anthropic/models/beta/messages/batch_cancel_params.rbi +65 -0
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +906 -0
- data/rbi/anthropic/models/beta/messages/batch_delete_params.rbi +65 -0
- data/rbi/anthropic/models/beta/messages/batch_list_params.rbi +106 -0
- data/rbi/anthropic/models/beta/messages/batch_results_params.rbi +65 -0
- data/rbi/anthropic/models/beta/messages/batch_retrieve_params.rbi +65 -0
- data/rbi/anthropic/models/beta/messages/beta_deleted_message_batch.rbi +44 -0
- data/rbi/anthropic/models/beta/messages/beta_message_batch.rbi +214 -0
- data/rbi/anthropic/models/beta/messages/beta_message_batch_canceled_result.rbi +30 -0
- data/rbi/anthropic/models/beta/messages/beta_message_batch_errored_result.rbi +45 -0
- data/rbi/anthropic/models/beta/messages/beta_message_batch_expired_result.rbi +30 -0
- data/rbi/anthropic/models/beta/messages/beta_message_batch_individual_response.rbi +89 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta/messages/beta_message_batch_request_counts.rbi +41 -12
- data/rbi/anthropic/models/beta/messages/beta_message_batch_result.rbi +38 -0
- data/rbi/anthropic/models/beta/messages/beta_message_batch_succeeded_result.rbi +45 -0
- data/rbi/anthropic/models/beta/model_list_params.rbi +103 -0
- data/rbi/anthropic/models/beta/model_retrieve_params.rbi +62 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta_api_error.rbi +10 -3
- data/rbi/{lib/anthropic → anthropic}/models/beta_authentication_error.rbi +13 -3
- data/rbi/{lib/anthropic → anthropic}/models/beta_billing_error.rbi +10 -3
- data/rbi/anthropic/models/beta_error.rbi +28 -0
- data/rbi/anthropic/models/beta_error_response.rbi +74 -0
- data/rbi/{lib/anthropic → anthropic}/models/beta_gateway_timeout_error.rbi +13 -3
- data/rbi/{lib/anthropic → anthropic}/models/beta_invalid_request_error.rbi +13 -3
- data/rbi/{lib/anthropic → anthropic}/models/beta_not_found_error.rbi +10 -3
- data/rbi/{lib/anthropic → anthropic}/models/beta_overloaded_error.rbi +10 -3
- data/rbi/{lib/anthropic → anthropic}/models/beta_permission_error.rbi +10 -3
- data/rbi/{lib/anthropic → anthropic}/models/beta_rate_limit_error.rbi +10 -3
- data/rbi/{lib/anthropic → anthropic}/models/billing_error.rbi +10 -3
- data/rbi/{lib/anthropic → anthropic}/models/cache_control_ephemeral.rbi +10 -3
- data/rbi/{lib/anthropic → anthropic}/models/citation_char_location.rbi +18 -14
- data/rbi/{lib/anthropic → anthropic}/models/citation_char_location_param.rbi +21 -14
- data/rbi/{lib/anthropic → anthropic}/models/citation_content_block_location.rbi +24 -15
- data/rbi/{lib/anthropic → anthropic}/models/citation_content_block_location_param.rbi +24 -15
- data/rbi/{lib/anthropic → anthropic}/models/citation_page_location.rbi +18 -14
- data/rbi/{lib/anthropic → anthropic}/models/citation_page_location_param.rbi +21 -14
- data/rbi/anthropic/models/citation_web_search_result_location_param.rbi +62 -0
- data/rbi/{lib/anthropic → anthropic}/models/citations_config_param.rbi +10 -3
- data/rbi/anthropic/models/citations_delta.rbi +81 -0
- data/rbi/anthropic/models/citations_web_search_result_location.rbi +62 -0
- data/rbi/anthropic/models/completion.rbi +93 -0
- data/rbi/anthropic/models/completion_create_params.rbi +217 -0
- data/rbi/anthropic/models/content_block.rbi +25 -0
- data/rbi/anthropic/models/content_block_param.rbi +28 -0
- data/rbi/anthropic/models/content_block_source.rbi +92 -0
- data/rbi/anthropic/models/content_block_source_content.rbi +22 -0
- data/rbi/anthropic/models/document_block_param.rbi +120 -0
- data/rbi/anthropic/models/error_object.rbi +28 -0
- data/rbi/anthropic/models/error_response.rbi +74 -0
- data/rbi/{lib/anthropic → anthropic}/models/gateway_timeout_error.rbi +10 -3
- data/rbi/anthropic/models/image_block_param.rbi +80 -0
- data/rbi/anthropic/models/input_json_delta.rbi +28 -0
- data/rbi/{lib/anthropic → anthropic}/models/invalid_request_error.rbi +10 -3
- data/rbi/anthropic/models/message.rbi +259 -0
- data/rbi/anthropic/models/message_count_tokens_params.rbi +569 -0
- data/rbi/anthropic/models/message_count_tokens_tool.rbi +25 -0
- data/rbi/anthropic/models/message_create_params.rbi +699 -0
- data/rbi/anthropic/models/message_delta_usage.rbi +76 -0
- data/rbi/anthropic/models/message_param.rbi +147 -0
- data/rbi/anthropic/models/message_tokens_count.rbi +29 -0
- data/rbi/anthropic/models/messages/batch_cancel_params.rbi +32 -0
- data/rbi/anthropic/models/messages/batch_create_params.rbi +840 -0
- data/rbi/anthropic/models/messages/batch_delete_params.rbi +32 -0
- data/rbi/{lib/anthropic → anthropic}/models/messages/batch_list_params.rbi +34 -12
- data/rbi/anthropic/models/messages/batch_results_params.rbi +32 -0
- data/rbi/anthropic/models/messages/batch_retrieve_params.rbi +32 -0
- data/rbi/anthropic/models/messages/deleted_message_batch.rbi +42 -0
- data/rbi/anthropic/models/messages/message_batch.rbi +208 -0
- data/rbi/{lib/anthropic → anthropic}/models/messages/message_batch_canceled_result.rbi +15 -5
- data/rbi/anthropic/models/messages/message_batch_errored_result.rbi +42 -0
- data/rbi/{lib/anthropic → anthropic}/models/messages/message_batch_expired_result.rbi +15 -5
- data/rbi/anthropic/models/messages/message_batch_individual_response.rbi +89 -0
- data/rbi/{lib/anthropic → anthropic}/models/messages/message_batch_request_counts.rbi +43 -14
- data/rbi/{lib/anthropic → anthropic}/models/messages/message_batch_result.rbi +17 -7
- data/rbi/anthropic/models/messages/message_batch_succeeded_result.rbi +40 -0
- data/rbi/anthropic/models/metadata.rbi +35 -0
- data/rbi/anthropic/models/model.rbi +68 -0
- data/rbi/anthropic/models/model_info.rbi +62 -0
- data/rbi/anthropic/models/model_list_params.rbi +95 -0
- data/rbi/anthropic/models/model_retrieve_params.rbi +54 -0
- data/rbi/{lib/anthropic → anthropic}/models/not_found_error.rbi +10 -3
- data/rbi/{lib/anthropic → anthropic}/models/overloaded_error.rbi +10 -3
- data/rbi/{lib/anthropic → anthropic}/models/permission_error.rbi +10 -3
- data/rbi/anthropic/models/plain_text_source.rbi +35 -0
- data/rbi/{lib/anthropic → anthropic}/models/rate_limit_error.rbi +10 -3
- data/rbi/anthropic/models/raw_content_block_delta.rbi +26 -0
- data/rbi/anthropic/models/raw_content_block_delta_event.rbi +70 -0
- data/rbi/anthropic/models/raw_content_block_start_event.rbi +99 -0
- data/rbi/{lib/anthropic → anthropic}/models/raw_content_block_stop_event.rbi +13 -3
- data/rbi/anthropic/models/raw_message_delta_event.rbi +119 -0
- data/rbi/anthropic/models/raw_message_start_event.rbi +33 -0
- data/rbi/anthropic/models/raw_message_stop_event.rbi +23 -0
- data/rbi/anthropic/models/raw_message_stream_event.rbi +27 -0
- data/rbi/{lib/anthropic → anthropic}/models/redacted_thinking_block.rbi +10 -3
- data/rbi/{lib/anthropic → anthropic}/models/redacted_thinking_block_param.rbi +13 -3
- data/rbi/anthropic/models/server_tool_usage.rbi +27 -0
- data/rbi/anthropic/models/server_tool_use_block.rbi +43 -0
- data/rbi/anthropic/models/server_tool_use_block_param.rbi +71 -0
- data/rbi/{lib/anthropic → anthropic}/models/signature_delta.rbi +10 -3
- data/rbi/anthropic/models/stop_reason.rbi +23 -0
- data/rbi/anthropic/models/text_block.rbi +90 -0
- data/rbi/anthropic/models/text_block_param.rbi +95 -0
- data/rbi/anthropic/models/text_citation.rbi +23 -0
- data/rbi/anthropic/models/text_citation_param.rbi +23 -0
- data/rbi/{lib/anthropic → anthropic}/models/text_delta.rbi +10 -3
- data/rbi/anthropic/models/thinking_block.rbi +35 -0
- data/rbi/anthropic/models/thinking_block_param.rbi +35 -0
- data/rbi/{lib/anthropic → anthropic}/models/thinking_config_disabled.rbi +10 -3
- data/rbi/anthropic/models/thinking_config_enabled.rbi +49 -0
- data/rbi/{lib/anthropic → anthropic}/models/thinking_config_param.rbi +13 -2
- data/rbi/{lib/anthropic → anthropic}/models/thinking_delta.rbi +10 -3
- data/rbi/anthropic/models/tool.rbi +142 -0
- data/rbi/anthropic/models/tool_bash_20250124.rbi +62 -0
- data/rbi/anthropic/models/tool_choice.rbi +25 -0
- data/rbi/anthropic/models/tool_choice_any.rbi +49 -0
- data/rbi/anthropic/models/tool_choice_auto.rbi +49 -0
- data/rbi/{lib/anthropic → anthropic}/models/tool_choice_none.rbi +10 -3
- data/rbi/anthropic/models/tool_choice_tool.rbi +57 -0
- data/rbi/anthropic/models/tool_result_block_param.rbi +162 -0
- data/rbi/anthropic/models/tool_text_editor_20250124.rbi +62 -0
- data/rbi/anthropic/models/tool_union.rbi +23 -0
- data/rbi/anthropic/models/tool_use_block.rbi +43 -0
- data/rbi/anthropic/models/tool_use_block_param.rbi +68 -0
- data/rbi/{lib/anthropic → anthropic}/models/url_image_source.rbi +10 -3
- data/rbi/{lib/anthropic → anthropic}/models/url_pdf_source.rbi +10 -3
- data/rbi/anthropic/models/usage.rbi +74 -0
- data/rbi/anthropic/models/web_search_result_block.rbi +59 -0
- data/rbi/anthropic/models/web_search_result_block_param.rbi +62 -0
- data/rbi/anthropic/models/web_search_tool_20250305.rbi +181 -0
- data/rbi/anthropic/models/web_search_tool_request_error.rbi +88 -0
- data/rbi/anthropic/models/web_search_tool_result_block.rbi +61 -0
- data/rbi/anthropic/models/web_search_tool_result_block_content.rbi +31 -0
- data/rbi/anthropic/models/web_search_tool_result_block_param.rbi +80 -0
- data/rbi/anthropic/models/web_search_tool_result_block_param_content.rbi +33 -0
- data/rbi/anthropic/models/web_search_tool_result_error.rbi +90 -0
- data/rbi/anthropic/models.rbi +229 -0
- data/rbi/{lib/anthropic → anthropic}/request_options.rbi +18 -5
- data/rbi/{lib/anthropic → anthropic}/resources/beta/messages/batches.rbi +54 -32
- data/rbi/{lib/anthropic → anthropic}/resources/beta/messages.rbi +131 -106
- data/rbi/{lib/anthropic → anthropic}/resources/beta/models.rbi +23 -14
- data/rbi/{lib/anthropic → anthropic}/resources/beta.rbi +2 -1
- data/rbi/{lib/anthropic → anthropic}/resources/completions.rbi +38 -29
- data/rbi/{lib/anthropic → anthropic}/resources/messages/batches.rbi +38 -24
- data/rbi/{lib/anthropic → anthropic}/resources/messages.rbi +104 -91
- data/rbi/anthropic/resources/models.rbi +62 -0
- data/rbi/anthropic/vertex.rbi +5 -0
- data/sig/anthropic/bedrock.rbs +3 -0
- data/sig/anthropic/file_part.rbs +21 -0
- data/sig/anthropic/helpers/bedrock/client.rbs +43 -0
- data/sig/anthropic/helpers/vertex/client.rbs +36 -0
- data/sig/anthropic/internal/transport/base_client.rbs +25 -4
- data/sig/anthropic/internal/transport/pooled_net_requester.rbs +4 -0
- data/sig/anthropic/internal/type/array_of.rbs +4 -0
- data/sig/anthropic/internal/type/base_model.rbs +19 -1
- data/sig/anthropic/internal/type/base_page.rbs +1 -1
- data/sig/anthropic/internal/type/base_stream.rbs +2 -0
- data/sig/anthropic/internal/type/converter.rbs +6 -0
- data/sig/anthropic/internal/type/enum.rbs +5 -2
- data/sig/anthropic/internal/type/{io_like.rbs → file_input.rbs} +1 -1
- data/sig/anthropic/internal/type/hash_of.rbs +4 -0
- data/sig/anthropic/internal/type/request_parameters.rbs +5 -1
- data/sig/anthropic/internal/type/union.rbs +5 -0
- data/sig/anthropic/internal/util.rbs +31 -12
- data/sig/anthropic/internal.rbs +3 -1
- data/sig/anthropic/models/anthropic_beta.rbs +1 -8
- data/sig/anthropic/models/api_error_object.rbs +0 -2
- data/sig/anthropic/models/authentication_error.rbs +0 -2
- data/sig/anthropic/models/base64_image_source.rbs +4 -6
- data/sig/anthropic/models/base64_pdf_source.rbs +0 -2
- data/sig/anthropic/models/beta/beta_base64_image_source.rbs +4 -6
- data/sig/anthropic/models/beta/beta_base64_pdf_block.rbs +16 -18
- data/sig/anthropic/models/beta/beta_base64_pdf_source.rbs +0 -2
- data/sig/anthropic/models/beta/beta_cache_control_ephemeral.rbs +0 -2
- data/sig/anthropic/models/beta/beta_citation_char_location.rbs +0 -2
- data/sig/anthropic/models/beta/beta_citation_char_location_param.rbs +0 -2
- data/sig/anthropic/models/beta/beta_citation_content_block_location.rbs +0 -2
- data/sig/anthropic/models/beta/beta_citation_content_block_location_param.rbs +0 -2
- data/sig/anthropic/models/beta/beta_citation_page_location.rbs +0 -2
- data/sig/anthropic/models/beta/beta_citation_page_location_param.rbs +0 -2
- data/sig/anthropic/models/beta/beta_citation_web_search_result_location_param.rbs +36 -0
- data/sig/anthropic/models/beta/beta_citations_config_param.rbs +0 -2
- data/sig/anthropic/models/beta/beta_citations_delta.rbs +8 -9
- data/sig/anthropic/models/beta/beta_citations_web_search_result_location.rbs +36 -0
- data/sig/anthropic/models/beta/beta_content_block.rbs +7 -5
- data/sig/anthropic/models/beta/beta_content_block_param.rbs +10 -8
- data/sig/anthropic/models/beta/beta_content_block_source.rbs +5 -10
- data/sig/anthropic/models/beta/beta_content_block_source_content.rbs +3 -3
- data/sig/anthropic/models/beta/beta_image_block_param.rbs +9 -11
- data/sig/anthropic/models/beta/beta_input_json_delta.rbs +0 -2
- data/sig/anthropic/models/beta/beta_message.rbs +3 -5
- data/sig/anthropic/models/beta/beta_message_delta_usage.rbs +22 -3
- data/sig/anthropic/models/beta/beta_message_param.rbs +9 -14
- data/sig/anthropic/models/beta/beta_message_tokens_count.rbs +0 -2
- data/sig/anthropic/models/beta/beta_metadata.rbs +0 -2
- data/sig/anthropic/models/beta/beta_model_info.rbs +0 -2
- data/sig/anthropic/models/beta/beta_plain_text_source.rbs +0 -2
- data/sig/anthropic/models/beta/beta_raw_content_block_delta.rbs +6 -6
- data/sig/anthropic/models/beta/beta_raw_content_block_delta_event.rbs +0 -2
- data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +10 -10
- data/sig/anthropic/models/beta/beta_raw_content_block_stop_event.rbs +0 -2
- data/sig/anthropic/models/beta/beta_raw_message_delta_event.rbs +6 -10
- data/sig/anthropic/models/beta/beta_raw_message_start_event.rbs +3 -5
- data/sig/anthropic/models/beta/beta_raw_message_stop_event.rbs +0 -2
- data/sig/anthropic/models/beta/beta_raw_message_stream_event.rbs +7 -7
- data/sig/anthropic/models/beta/beta_redacted_thinking_block.rbs +0 -2
- data/sig/anthropic/models/beta/beta_redacted_thinking_block_param.rbs +0 -2
- data/sig/anthropic/models/beta/beta_server_tool_usage.rbs +15 -0
- data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +27 -0
- data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +36 -0
- data/sig/anthropic/models/beta/beta_signature_delta.rbs +0 -2
- data/sig/anthropic/models/beta/beta_stop_reason.rbs +8 -1
- data/sig/anthropic/models/beta/beta_text_block.rbs +0 -2
- data/sig/anthropic/models/beta/beta_text_block_param.rbs +3 -5
- data/sig/anthropic/models/beta/beta_text_citation.rbs +5 -4
- data/sig/anthropic/models/beta/beta_text_citation_param.rbs +5 -4
- data/sig/anthropic/models/beta/beta_text_delta.rbs +0 -2
- data/sig/anthropic/models/beta/beta_thinking_block.rbs +0 -2
- data/sig/anthropic/models/beta/beta_thinking_block_param.rbs +0 -2
- data/sig/anthropic/models/beta/beta_thinking_config_disabled.rbs +0 -2
- data/sig/anthropic/models/beta/beta_thinking_config_enabled.rbs +0 -2
- data/sig/anthropic/models/beta/beta_thinking_config_param.rbs +3 -3
- data/sig/anthropic/models/beta/beta_thinking_delta.rbs +0 -2
- data/sig/anthropic/models/beta/beta_tool.rbs +10 -14
- data/sig/anthropic/models/beta/beta_tool_bash_20241022.rbs +3 -5
- data/sig/anthropic/models/beta/beta_tool_bash_20250124.rbs +3 -5
- data/sig/anthropic/models/beta/beta_tool_choice.rbs +5 -5
- data/sig/anthropic/models/beta/beta_tool_choice_any.rbs +0 -2
- data/sig/anthropic/models/beta/beta_tool_choice_auto.rbs +0 -2
- data/sig/anthropic/models/beta/beta_tool_choice_none.rbs +0 -2
- data/sig/anthropic/models/beta/beta_tool_choice_tool.rbs +0 -2
- data/sig/anthropic/models/beta/beta_tool_computer_use_20241022.rbs +3 -5
- data/sig/anthropic/models/beta/beta_tool_computer_use_20250124.rbs +3 -5
- data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +14 -19
- data/sig/anthropic/models/beta/beta_tool_text_editor_20241022.rbs +3 -5
- data/sig/anthropic/models/beta/beta_tool_text_editor_20250124.rbs +3 -5
- data/sig/anthropic/models/beta/beta_tool_union.rbs +9 -8
- data/sig/anthropic/models/beta/beta_tool_use_block.rbs +0 -2
- data/sig/anthropic/models/beta/beta_tool_use_block_param.rbs +3 -5
- data/sig/anthropic/models/beta/beta_url_image_source.rbs +0 -2
- data/sig/anthropic/models/beta/beta_url_pdf_source.rbs +0 -2
- data/sig/anthropic/models/beta/beta_usage.rbs +6 -4
- data/sig/anthropic/models/beta/beta_web_search_result_block.rbs +36 -0
- data/sig/anthropic/models/beta/beta_web_search_result_block_param.rbs +36 -0
- data/sig/anthropic/models/beta/beta_web_search_tool_20250305.rbs +73 -0
- data/sig/anthropic/models/beta/beta_web_search_tool_request_error.rbs +43 -0
- data/sig/anthropic/models/beta/beta_web_search_tool_result_block.rbs +28 -0
- data/sig/anthropic/models/beta/beta_web_search_tool_result_block_content.rbs +19 -0
- data/sig/anthropic/models/beta/beta_web_search_tool_result_block_param.rbs +32 -0
- data/sig/anthropic/models/beta/beta_web_search_tool_result_block_param_content.rbs +19 -0
- data/sig/anthropic/models/beta/beta_web_search_tool_result_error.rbs +43 -0
- data/sig/anthropic/models/beta/message_count_tokens_params.rbs +20 -25
- data/sig/anthropic/models/beta/message_create_params.rbs +11 -17
- data/sig/anthropic/models/beta/messages/batch_cancel_params.rbs +0 -2
- data/sig/anthropic/models/beta/messages/batch_create_params.rbs +22 -31
- data/sig/anthropic/models/beta/messages/batch_delete_params.rbs +0 -2
- data/sig/anthropic/models/beta/messages/batch_list_params.rbs +0 -2
- data/sig/anthropic/models/beta/messages/batch_results_params.rbs +0 -2
- data/sig/anthropic/models/beta/messages/batch_retrieve_params.rbs +0 -2
- data/sig/anthropic/models/beta/messages/beta_deleted_message_batch.rbs +0 -2
- data/sig/anthropic/models/beta/messages/beta_message_batch.rbs +7 -9
- data/sig/anthropic/models/beta/messages/beta_message_batch_canceled_result.rbs +0 -2
- data/sig/anthropic/models/beta/messages/beta_message_batch_errored_result.rbs +3 -5
- data/sig/anthropic/models/beta/messages/beta_message_batch_expired_result.rbs +0 -2
- data/sig/anthropic/models/beta/messages/beta_message_batch_individual_response.rbs +0 -2
- data/sig/anthropic/models/beta/messages/beta_message_batch_request_counts.rbs +0 -2
- data/sig/anthropic/models/beta/messages/beta_message_batch_result.rbs +5 -5
- data/sig/anthropic/models/beta/messages/beta_message_batch_succeeded_result.rbs +3 -5
- data/sig/anthropic/models/beta/model_list_params.rbs +13 -3
- data/sig/anthropic/models/beta/model_retrieve_params.rbs +11 -3
- data/sig/anthropic/models/beta_api_error.rbs +0 -2
- data/sig/anthropic/models/beta_authentication_error.rbs +0 -2
- data/sig/anthropic/models/beta_billing_error.rbs +0 -2
- data/sig/anthropic/models/beta_error.rbs +10 -10
- data/sig/anthropic/models/beta_error_response.rbs +0 -2
- data/sig/anthropic/models/beta_gateway_timeout_error.rbs +0 -2
- data/sig/anthropic/models/beta_invalid_request_error.rbs +0 -2
- data/sig/anthropic/models/beta_not_found_error.rbs +0 -2
- data/sig/anthropic/models/beta_overloaded_error.rbs +0 -2
- data/sig/anthropic/models/beta_permission_error.rbs +0 -2
- data/sig/anthropic/models/beta_rate_limit_error.rbs +0 -2
- data/sig/anthropic/models/billing_error.rbs +0 -2
- data/sig/anthropic/models/cache_control_ephemeral.rbs +0 -2
- data/sig/anthropic/models/citation_char_location.rbs +0 -2
- data/sig/anthropic/models/citation_char_location_param.rbs +0 -2
- data/sig/anthropic/models/citation_content_block_location.rbs +0 -2
- data/sig/anthropic/models/citation_content_block_location_param.rbs +0 -2
- data/sig/anthropic/models/citation_page_location.rbs +0 -2
- data/sig/anthropic/models/citation_page_location_param.rbs +0 -2
- data/sig/anthropic/models/citation_web_search_result_location_param.rbs +32 -0
- data/sig/anthropic/models/citations_config_param.rbs +0 -2
- data/sig/anthropic/models/citations_delta.rbs +8 -12
- data/sig/anthropic/models/citations_web_search_result_location.rbs +32 -0
- data/sig/anthropic/models/completion.rbs +0 -2
- data/sig/anthropic/models/completion_create_params.rbs +13 -9
- data/sig/anthropic/models/content_block.rbs +7 -5
- data/sig/anthropic/models/content_block_param.rbs +10 -8
- data/sig/anthropic/models/content_block_source.rbs +5 -13
- data/sig/anthropic/models/content_block_source_content.rbs +2 -2
- data/sig/anthropic/models/document_block_param.rbs +16 -18
- data/sig/anthropic/models/error_object.rbs +10 -10
- data/sig/anthropic/models/error_response.rbs +0 -2
- data/sig/anthropic/models/gateway_timeout_error.rbs +0 -2
- data/sig/anthropic/models/image_block_param.rbs +8 -11
- data/sig/anthropic/models/input_json_delta.rbs +0 -2
- data/sig/anthropic/models/invalid_request_error.rbs +0 -2
- data/sig/anthropic/models/message.rbs +3 -5
- data/sig/anthropic/models/message_count_tokens_params.rbs +6 -10
- data/sig/anthropic/models/message_count_tokens_tool.rbs +5 -4
- data/sig/anthropic/models/message_create_params.rbs +10 -16
- data/sig/anthropic/models/message_delta_usage.rbs +22 -3
- data/sig/anthropic/models/message_param.rbs +9 -14
- data/sig/anthropic/models/message_tokens_count.rbs +0 -2
- data/sig/anthropic/models/messages/batch_cancel_params.rbs +0 -2
- data/sig/anthropic/models/messages/batch_create_params.rbs +21 -34
- data/sig/anthropic/models/messages/batch_delete_params.rbs +0 -2
- data/sig/anthropic/models/messages/batch_list_params.rbs +0 -2
- data/sig/anthropic/models/messages/batch_results_params.rbs +0 -2
- data/sig/anthropic/models/messages/batch_retrieve_params.rbs +0 -2
- data/sig/anthropic/models/messages/deleted_message_batch.rbs +0 -2
- data/sig/anthropic/models/messages/message_batch.rbs +7 -9
- data/sig/anthropic/models/messages/message_batch_canceled_result.rbs +0 -2
- data/sig/anthropic/models/messages/message_batch_errored_result.rbs +3 -5
- data/sig/anthropic/models/messages/message_batch_expired_result.rbs +0 -2
- data/sig/anthropic/models/messages/message_batch_individual_response.rbs +0 -2
- data/sig/anthropic/models/messages/message_batch_request_counts.rbs +0 -2
- data/sig/anthropic/models/messages/message_batch_result.rbs +5 -5
- data/sig/anthropic/models/messages/message_batch_succeeded_result.rbs +3 -8
- data/sig/anthropic/models/metadata.rbs +0 -2
- data/sig/anthropic/models/model.rbs +1 -13
- data/sig/anthropic/models/model_info.rbs +0 -2
- data/sig/anthropic/models/model_list_params.rbs +13 -3
- data/sig/anthropic/models/model_retrieve_params.rbs +11 -3
- data/sig/anthropic/models/not_found_error.rbs +0 -2
- data/sig/anthropic/models/overloaded_error.rbs +0 -2
- data/sig/anthropic/models/permission_error.rbs +0 -2
- data/sig/anthropic/models/plain_text_source.rbs +0 -2
- data/sig/anthropic/models/rate_limit_error.rbs +0 -2
- data/sig/anthropic/models/raw_content_block_delta.rbs +6 -6
- data/sig/anthropic/models/raw_content_block_delta_event.rbs +0 -2
- data/sig/anthropic/models/raw_content_block_start_event.rbs +10 -10
- data/sig/anthropic/models/raw_content_block_stop_event.rbs +0 -2
- data/sig/anthropic/models/raw_message_delta_event.rbs +6 -10
- data/sig/anthropic/models/raw_message_start_event.rbs +3 -5
- data/sig/anthropic/models/raw_message_stop_event.rbs +0 -2
- data/sig/anthropic/models/raw_message_stream_event.rbs +7 -7
- data/sig/anthropic/models/redacted_thinking_block.rbs +0 -2
- data/sig/anthropic/models/redacted_thinking_block_param.rbs +0 -2
- data/sig/anthropic/models/server_tool_usage.rbs +11 -0
- data/sig/anthropic/models/server_tool_use_block.rbs +23 -0
- data/sig/anthropic/models/server_tool_use_block_param.rbs +32 -0
- data/sig/anthropic/models/signature_delta.rbs +0 -2
- data/sig/anthropic/models/stop_reason.rbs +9 -1
- data/sig/anthropic/models/text_block.rbs +0 -2
- data/sig/anthropic/models/text_block_param.rbs +3 -5
- data/sig/anthropic/models/text_citation.rbs +5 -4
- data/sig/anthropic/models/text_citation_param.rbs +5 -4
- data/sig/anthropic/models/text_delta.rbs +0 -2
- data/sig/anthropic/models/thinking_block.rbs +0 -2
- data/sig/anthropic/models/thinking_block_param.rbs +0 -2
- data/sig/anthropic/models/thinking_config_disabled.rbs +0 -2
- data/sig/anthropic/models/thinking_config_enabled.rbs +0 -2
- data/sig/anthropic/models/thinking_config_param.rbs +2 -3
- data/sig/anthropic/models/thinking_delta.rbs +0 -2
- data/sig/anthropic/models/tool.rbs +21 -11
- data/sig/anthropic/models/tool_bash_20250124.rbs +3 -5
- data/sig/anthropic/models/tool_choice.rbs +5 -5
- data/sig/anthropic/models/tool_choice_any.rbs +0 -2
- data/sig/anthropic/models/tool_choice_auto.rbs +0 -2
- data/sig/anthropic/models/tool_choice_none.rbs +0 -2
- data/sig/anthropic/models/tool_choice_tool.rbs +0 -2
- data/sig/anthropic/models/tool_result_block_param.rbs +13 -20
- data/sig/anthropic/models/tool_text_editor_20250124.rbs +3 -5
- data/sig/anthropic/models/tool_union.rbs +5 -4
- data/sig/anthropic/models/tool_use_block.rbs +0 -2
- data/sig/anthropic/models/tool_use_block_param.rbs +3 -5
- data/sig/anthropic/models/url_image_source.rbs +0 -2
- data/sig/anthropic/models/url_pdf_source.rbs +0 -2
- data/sig/anthropic/models/usage.rbs +6 -4
- data/sig/anthropic/models/web_search_result_block.rbs +32 -0
- data/sig/anthropic/models/web_search_result_block_param.rbs +32 -0
- data/sig/anthropic/models/web_search_tool_20250305.rbs +69 -0
- data/sig/anthropic/models/web_search_tool_request_error.rbs +39 -0
- data/sig/anthropic/models/web_search_tool_result_block.rbs +24 -0
- data/sig/anthropic/models/web_search_tool_result_block_content.rbs +15 -0
- data/sig/anthropic/models/web_search_tool_result_block_param.rbs +28 -0
- data/sig/anthropic/models/web_search_tool_result_block_param_content.rbs +15 -0
- data/sig/anthropic/models/web_search_tool_result_error.rbs +39 -0
- data/sig/anthropic/models.rbs +221 -0
- data/sig/anthropic/request_options.rbs +1 -1
- data/sig/anthropic/resources/beta/messages/batches.rbs +7 -7
- data/sig/anthropic/resources/beta/messages.rbs +8 -8
- data/sig/anthropic/resources/beta/models.rbs +4 -2
- data/sig/anthropic/resources/completions.rbs +6 -4
- data/sig/anthropic/resources/messages/batches.rbs +7 -7
- data/sig/anthropic/resources/messages.rbs +7 -7
- data/sig/anthropic/resources/models.rbs +4 -2
- data/sig/anthropic/vertex.rbs +3 -0
- metadata +335 -238
- data/lib/anthropic/bedrock/client.rb +0 -261
- data/lib/anthropic/vertex/client.rb +0 -210
- data/rbi/lib/anthropic/bedrock/client.rbi +0 -80
- data/rbi/lib/anthropic/internal/transport/base_client.rbi +0 -204
- data/rbi/lib/anthropic/internal/type/array_of.rbi +0 -82
- data/rbi/lib/anthropic/internal/type/base_model.rbi +0 -197
- data/rbi/lib/anthropic/internal/type/boolean.rbi +0 -49
- data/rbi/lib/anthropic/internal/type/hash_of.rbi +0 -82
- data/rbi/lib/anthropic/internal/type/request_parameters.rbi +0 -21
- data/rbi/lib/anthropic/internal/type/union.rbi +0 -68
- data/rbi/lib/anthropic/internal/type/unknown.rbi +0 -41
- data/rbi/lib/anthropic/internal/util.rbi +0 -282
- data/rbi/lib/anthropic/models/anthropic_beta.rbi +0 -30
- data/rbi/lib/anthropic/models/base64_image_source.rbi +0 -46
- data/rbi/lib/anthropic/models/base64_pdf_source.rbi +0 -22
- data/rbi/lib/anthropic/models/beta/beta_base64_image_source.rbi +0 -56
- data/rbi/lib/anthropic/models/beta/beta_base64_pdf_block.rbi +0 -104
- data/rbi/lib/anthropic/models/beta/beta_base64_pdf_source.rbi +0 -26
- data/rbi/lib/anthropic/models/beta/beta_citations_delta.rbi +0 -66
- data/rbi/lib/anthropic/models/beta/beta_content_block.rbi +0 -21
- data/rbi/lib/anthropic/models/beta/beta_content_block_param.rbi +0 -21
- data/rbi/lib/anthropic/models/beta/beta_content_block_source.rbi +0 -74
- data/rbi/lib/anthropic/models/beta/beta_content_block_source_content.rbi +0 -19
- data/rbi/lib/anthropic/models/beta/beta_image_block_param.rbi +0 -68
- data/rbi/lib/anthropic/models/beta/beta_input_json_delta.rbi +0 -23
- data/rbi/lib/anthropic/models/beta/beta_message.rbi +0 -180
- data/rbi/lib/anthropic/models/beta/beta_message_delta_usage.rbi +0 -21
- data/rbi/lib/anthropic/models/beta/beta_message_param.rbi +0 -126
- data/rbi/lib/anthropic/models/beta/beta_model_info.rbi +0 -38
- data/rbi/lib/anthropic/models/beta/beta_plain_text_source.rbi +0 -26
- data/rbi/lib/anthropic/models/beta/beta_raw_content_block_delta.rbi +0 -21
- data/rbi/lib/anthropic/models/beta/beta_raw_content_block_delta_event.rbi +0 -65
- data/rbi/lib/anthropic/models/beta/beta_raw_content_block_start_event.rbi +0 -74
- data/rbi/lib/anthropic/models/beta/beta_raw_message_delta_event.rbi +0 -96
- data/rbi/lib/anthropic/models/beta/beta_raw_message_start_event.rbi +0 -29
- data/rbi/lib/anthropic/models/beta/beta_raw_message_stream_event.rbi +0 -21
- data/rbi/lib/anthropic/models/beta/beta_signature_delta.rbi +0 -23
- data/rbi/lib/anthropic/models/beta/beta_stop_reason.rbi +0 -24
- data/rbi/lib/anthropic/models/beta/beta_text_block.rbi +0 -76
- data/rbi/lib/anthropic/models/beta/beta_text_block_param.rbi +0 -84
- data/rbi/lib/anthropic/models/beta/beta_text_citation.rbi +0 -21
- data/rbi/lib/anthropic/models/beta/beta_text_citation_param.rbi +0 -21
- data/rbi/lib/anthropic/models/beta/beta_thinking_block.rbi +0 -26
- data/rbi/lib/anthropic/models/beta/beta_thinking_block_param.rbi +0 -26
- data/rbi/lib/anthropic/models/beta/beta_thinking_config_enabled.rbi +0 -32
- data/rbi/lib/anthropic/models/beta/beta_tool.rbi +0 -112
- data/rbi/lib/anthropic/models/beta/beta_tool_bash_20241022.rbi +0 -49
- data/rbi/lib/anthropic/models/beta/beta_tool_bash_20250124.rbi +0 -49
- data/rbi/lib/anthropic/models/beta/beta_tool_choice_any.rbi +0 -31
- data/rbi/lib/anthropic/models/beta/beta_tool_choice_auto.rbi +0 -31
- data/rbi/lib/anthropic/models/beta/beta_tool_choice_tool.rbi +0 -37
- data/rbi/lib/anthropic/models/beta/beta_tool_result_block_param.rbi +0 -129
- data/rbi/lib/anthropic/models/beta/beta_tool_text_editor_20241022.rbi +0 -49
- data/rbi/lib/anthropic/models/beta/beta_tool_text_editor_20250124.rbi +0 -49
- data/rbi/lib/anthropic/models/beta/beta_tool_union.rbi +0 -21
- data/rbi/lib/anthropic/models/beta/beta_tool_use_block.rbi +0 -29
- data/rbi/lib/anthropic/models/beta/beta_tool_use_block_param.rbi +0 -60
- data/rbi/lib/anthropic/models/beta/beta_usage.rbi +0 -52
- data/rbi/lib/anthropic/models/beta/message_count_tokens_params.rbi +0 -409
- data/rbi/lib/anthropic/models/beta/message_create_params.rbi +0 -489
- data/rbi/lib/anthropic/models/beta/messages/batch_cancel_params.rbi +0 -41
- data/rbi/lib/anthropic/models/beta/messages/batch_create_params.rbi +0 -572
- data/rbi/lib/anthropic/models/beta/messages/batch_delete_params.rbi +0 -41
- data/rbi/lib/anthropic/models/beta/messages/batch_list_params.rbi +0 -72
- data/rbi/lib/anthropic/models/beta/messages/batch_results_params.rbi +0 -41
- data/rbi/lib/anthropic/models/beta/messages/batch_retrieve_params.rbi +0 -41
- data/rbi/lib/anthropic/models/beta/messages/beta_deleted_message_batch.rbi +0 -27
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch.rbi +0 -148
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch_canceled_result.rbi +0 -20
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch_errored_result.rbi +0 -29
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch_expired_result.rbi +0 -20
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch_individual_response.rbi +0 -68
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch_result.rbi +0 -26
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch_succeeded_result.rbi +0 -29
- data/rbi/lib/anthropic/models/beta/model_list_params.rbi +0 -59
- data/rbi/lib/anthropic/models/beta/model_retrieve_params.rbi +0 -21
- data/rbi/lib/anthropic/models/beta_error.rbi +0 -17
- data/rbi/lib/anthropic/models/beta_error_response.rbi +0 -68
- data/rbi/lib/anthropic/models/citations_delta.rbi +0 -62
- data/rbi/lib/anthropic/models/completion.rbi +0 -65
- data/rbi/lib/anthropic/models/completion_create_params.rbi +0 -142
- data/rbi/lib/anthropic/models/content_block.rbi +0 -17
- data/rbi/lib/anthropic/models/content_block_param.rbi +0 -17
- data/rbi/lib/anthropic/models/content_block_source.rbi +0 -56
- data/rbi/lib/anthropic/models/content_block_source_content.rbi +0 -12
- data/rbi/lib/anthropic/models/document_block_param.rbi +0 -97
- data/rbi/lib/anthropic/models/error_object.rbi +0 -17
- data/rbi/lib/anthropic/models/error_response.rbi +0 -68
- data/rbi/lib/anthropic/models/image_block_param.rbi +0 -57
- data/rbi/lib/anthropic/models/input_json_delta.rbi +0 -19
- data/rbi/lib/anthropic/models/message.rbi +0 -176
- data/rbi/lib/anthropic/models/message_count_tokens_params.rbi +0 -363
- data/rbi/lib/anthropic/models/message_count_tokens_tool.rbi +0 -17
- data/rbi/lib/anthropic/models/message_create_params.rbi +0 -453
- data/rbi/lib/anthropic/models/message_delta_usage.rbi +0 -17
- data/rbi/lib/anthropic/models/message_param.rbi +0 -121
- data/rbi/lib/anthropic/models/message_tokens_count.rbi +0 -18
- data/rbi/lib/anthropic/models/messages/batch_cancel_params.rbi +0 -21
- data/rbi/lib/anthropic/models/messages/batch_create_params.rbi +0 -535
- data/rbi/lib/anthropic/models/messages/batch_delete_params.rbi +0 -21
- data/rbi/lib/anthropic/models/messages/batch_results_params.rbi +0 -21
- data/rbi/lib/anthropic/models/messages/batch_retrieve_params.rbi +0 -21
- data/rbi/lib/anthropic/models/messages/deleted_message_batch.rbi +0 -25
- data/rbi/lib/anthropic/models/messages/message_batch.rbi +0 -143
- data/rbi/lib/anthropic/models/messages/message_batch_errored_result.rbi +0 -29
- data/rbi/lib/anthropic/models/messages/message_batch_individual_response.rbi +0 -68
- data/rbi/lib/anthropic/models/messages/message_batch_succeeded_result.rbi +0 -29
- data/rbi/lib/anthropic/models/metadata.rbi +0 -21
- data/rbi/lib/anthropic/models/model.rbi +0 -54
- data/rbi/lib/anthropic/models/model_info.rbi +0 -34
- data/rbi/lib/anthropic/models/model_list_params.rbi +0 -57
- data/rbi/lib/anthropic/models/model_retrieve_params.rbi +0 -19
- data/rbi/lib/anthropic/models/plain_text_source.rbi +0 -22
- data/rbi/lib/anthropic/models/raw_content_block_delta.rbi +0 -17
- data/rbi/lib/anthropic/models/raw_content_block_delta_event.rbi +0 -61
- data/rbi/lib/anthropic/models/raw_content_block_start_event.rbi +0 -70
- data/rbi/lib/anthropic/models/raw_message_delta_event.rbi +0 -81
- data/rbi/lib/anthropic/models/raw_message_start_event.rbi +0 -25
- data/rbi/lib/anthropic/models/raw_message_stop_event.rbi +0 -16
- data/rbi/lib/anthropic/models/raw_message_stream_event.rbi +0 -17
- data/rbi/lib/anthropic/models/stop_reason.rbi +0 -20
- data/rbi/lib/anthropic/models/text_block.rbi +0 -72
- data/rbi/lib/anthropic/models/text_block_param.rbi +0 -80
- data/rbi/lib/anthropic/models/text_citation.rbi +0 -17
- data/rbi/lib/anthropic/models/text_citation_param.rbi +0 -17
- data/rbi/lib/anthropic/models/thinking_block.rbi +0 -22
- data/rbi/lib/anthropic/models/thinking_block_param.rbi +0 -22
- data/rbi/lib/anthropic/models/thinking_config_enabled.rbi +0 -28
- data/rbi/lib/anthropic/models/tool.rbi +0 -88
- data/rbi/lib/anthropic/models/tool_bash_20250124.rbi +0 -43
- data/rbi/lib/anthropic/models/tool_choice.rbi +0 -19
- data/rbi/lib/anthropic/models/tool_choice_any.rbi +0 -27
- data/rbi/lib/anthropic/models/tool_choice_auto.rbi +0 -27
- data/rbi/lib/anthropic/models/tool_choice_tool.rbi +0 -33
- data/rbi/lib/anthropic/models/tool_result_block_param.rbi +0 -102
- data/rbi/lib/anthropic/models/tool_text_editor_20250124.rbi +0 -43
- data/rbi/lib/anthropic/models/tool_union.rbi +0 -17
- data/rbi/lib/anthropic/models/tool_use_block.rbi +0 -25
- data/rbi/lib/anthropic/models/tool_use_block_param.rbi +0 -56
- data/rbi/lib/anthropic/models/usage.rbi +0 -47
- data/rbi/lib/anthropic/resources/models.rbi +0 -53
- data/rbi/lib/anthropic/vertex/client.rbi +0 -56
- data/sig/anthropic/bedrock/client.rbs +0 -41
- data/sig/anthropic/vertex/client.rbs +0 -34
- /data/rbi/{lib/anthropic → anthropic}/version.rbi +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00c97457f993b57bfa54518c2dcb7e2803e57b6e0b95945e092203237365cda9
|
4
|
+
data.tar.gz: 4eeed4f7e125f383408ac8fd26d64a1f848c629f60d5aa8c330a02d6bb166544
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b3bb5172a2bcec1683c1f56ccdce051d277f3ca92399463fd9f26a845950a29bece5d95517f43782b96214cf2c59288785581e559e9e0737c32149421297c40
|
7
|
+
data.tar.gz: d4e75f974863994c07fe6308be6b0d8a8cd13fc63a4bd155e2d16837f3c51ecf5de5e8cc619935496810b939c4d81487abd4db477c1797a8e722682add47da23
|
data/.ignore
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,93 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.1.0-beta.7 (2025-05-15)
|
4
|
+
|
5
|
+
Full Changelog: [v0.1.0-beta.6...v0.1.0-beta.7](https://github.com/anthropics/anthropic-sdk-ruby/compare/v0.1.0-beta.6...v0.1.0-beta.7)
|
6
|
+
|
7
|
+
### ⚠ BREAKING CHANGES
|
8
|
+
|
9
|
+
* rename Vertex::Client and Bedrock::Client to VertexClient and BedrockClient
|
10
|
+
|
11
|
+
### Features
|
12
|
+
|
13
|
+
* bump default connection pool size limit to minimum of 99 ([5170cb6](https://github.com/anthropics/anthropic-sdk-ruby/commit/5170cb6172644012bb6f2580a6789c965088a01a))
|
14
|
+
* **client:** enable setting base URL from environment variable ([9cb10b1](https://github.com/anthropics/anthropic-sdk-ruby/commit/9cb10b1491761bb101269b92f4229183355ff77b))
|
15
|
+
* expose base client options as read only attributes ([2813fa7](https://github.com/anthropics/anthropic-sdk-ruby/commit/2813fa78dbc68c7c38cf0b00141f758fda2ff7c3))
|
16
|
+
* expose recursive `#to_h` conversion ([386a6a7](https://github.com/anthropics/anthropic-sdk-ruby/commit/386a6a78e1ca1f28841a6883d7a72433a9bd40a9))
|
17
|
+
* implement `#hash` for data containers ([f289994](https://github.com/anthropics/anthropic-sdk-ruby/commit/f2899941f30d6ce62414a1a866a5c9b47d54c340))
|
18
|
+
* rename Vertex::Client and Bedrock::Client to VertexClient and BedrockClient ([0506c4f](https://github.com/anthropics/anthropic-sdk-ruby/commit/0506c4f850ed6e289766ebcef7780aeee078398f))
|
19
|
+
* support sorbet aliases at the runtime ([239b6bb](https://github.com/anthropics/anthropic-sdk-ruby/commit/239b6bb99ad9a6549d30e15dfa7dffe7748fca3f))
|
20
|
+
* support specifying content-type with FilePart class ([d81f97d](https://github.com/anthropics/anthropic-sdk-ruby/commit/d81f97d27b72fcb30813d037c420657878f78c54))
|
21
|
+
* support webmock for testing ([91c3d67](https://github.com/anthropics/anthropic-sdk-ruby/commit/91c3d6748c9ead461bbffcd2fac8c621a357160c))
|
22
|
+
|
23
|
+
|
24
|
+
### Bug Fixes
|
25
|
+
|
26
|
+
* always send idempotency header when specified as a request option ([c53396e](https://github.com/anthropics/anthropic-sdk-ruby/commit/c53396ea8e8b3afdb572c338af34f7bb0a712151))
|
27
|
+
* **client:** send correct HTTP path ([4ff371b](https://github.com/anthropics/anthropic-sdk-ruby/commit/4ff371b538e07f3a2ab6c7c4be72616bf425789b))
|
28
|
+
* ensure gem release is unaffected by renaming ([9dbcb33](https://github.com/anthropics/anthropic-sdk-ruby/commit/9dbcb339381980f9e3e809dda6e9f9fe7133463e))
|
29
|
+
* **internal:** ensure formatting always uses c.utf-8 locale ([8cdaf4e](https://github.com/anthropics/anthropic-sdk-ruby/commit/8cdaf4ec891bb4b52af12f194d83a8a65d20f72d))
|
30
|
+
* **internal:** fix formatting script for macos ([acf7bb0](https://github.com/anthropics/anthropic-sdk-ruby/commit/acf7bb0313f4ead5b714864fcd8ca65e9a7a5999))
|
31
|
+
* **internal:** update gemspec name ([6e1994d](https://github.com/anthropics/anthropic-sdk-ruby/commit/6e1994d2742d7915aceec13b51e25c700c9b82c2))
|
32
|
+
* make a typo for `FilePart.content` ([8dee858](https://github.com/anthropics/anthropic-sdk-ruby/commit/8dee858a316df5faa7e9e9153f79eee8c558c4d3))
|
33
|
+
* vertex and bedrock sorbet types ([de4bf33](https://github.com/anthropics/anthropic-sdk-ruby/commit/de4bf3384ee0047e570baee5c7dfe13a2d53aa2b))
|
34
|
+
|
35
|
+
|
36
|
+
### Chores
|
37
|
+
|
38
|
+
* accept all nd-json mimetype variants ([1a0c3e3](https://github.com/anthropics/anthropic-sdk-ruby/commit/1a0c3e350ac480539d84fe11edb8bc8a7bde75ba))
|
39
|
+
* add generator safe directory ([cbaa546](https://github.com/anthropics/anthropic-sdk-ruby/commit/cbaa54667b544ac6afbe182fa88a59f4dda51b80))
|
40
|
+
* always check if current page is empty in `next_page?` ([ef41b35](https://github.com/anthropics/anthropic-sdk-ruby/commit/ef41b35500600a1c1f02f201832855762d49e2e2))
|
41
|
+
* amend Gemfile.lock SHA for git dependency ([617d7df](https://github.com/anthropics/anthropic-sdk-ruby/commit/617d7df30d5eec60d4c7af63a2954b6a945c4277))
|
42
|
+
* broadly detect json family of content-type headers ([eb41428](https://github.com/anthropics/anthropic-sdk-ruby/commit/eb41428c85973c2e664e053415e2777f0d2f39a7))
|
43
|
+
* **ci:** add timeout thresholds for CI jobs ([ea76f5c](https://github.com/anthropics/anthropic-sdk-ruby/commit/ea76f5c57dc556b094630150248b63a1ae7f431e))
|
44
|
+
* **ci:** only use depot for staging repos ([213392b](https://github.com/anthropics/anthropic-sdk-ruby/commit/213392bb8c4b3765684a68de2a6aea1e59c0692b))
|
45
|
+
* **ci:** run on more branches and use depot runners ([b85caa6](https://github.com/anthropics/anthropic-sdk-ruby/commit/b85caa6b9ccb6074a446f195d04b6e2eca07482d))
|
46
|
+
* consistently use string in examples, even for enums ([2f6528e](https://github.com/anthropics/anthropic-sdk-ruby/commit/2f6528e4f6b4b6317e3f1903bd1381423f0aa8eb))
|
47
|
+
* documentation improvements ([e479e74](https://github.com/anthropics/anthropic-sdk-ruby/commit/e479e7423fd7db99723af7e000af7915d9025128))
|
48
|
+
* explicitly mark apis public under `Internal` module ([5adf74c](https://github.com/anthropics/anthropic-sdk-ruby/commit/5adf74c6032dd6bc304f936968d1f90391fc8654))
|
49
|
+
* fix misc linting / minor issues ([753f93a](https://github.com/anthropics/anthropic-sdk-ruby/commit/753f93acc061764313883e12c3e2c21a65c89344))
|
50
|
+
* **internal:** always run post-processing when formatting when syntax_tree ([6b66ae9](https://github.com/anthropics/anthropic-sdk-ruby/commit/6b66ae9b0b7bcb695a531ea37242b6ab666490b7))
|
51
|
+
* **internal:** annotate request options with type aliases in sorbet ([78301c8](https://github.com/anthropics/anthropic-sdk-ruby/commit/78301c845d2f19ca67af13310443699801ca715b))
|
52
|
+
* **internal:** codegen related update ([c8424fb](https://github.com/anthropics/anthropic-sdk-ruby/commit/c8424fb051fdd61fa9ea747acb3df264409b01e7))
|
53
|
+
* **internal:** codegen related update ([ea9c02e](https://github.com/anthropics/anthropic-sdk-ruby/commit/ea9c02ed98b2db9103353d5a427daa2fe5531782))
|
54
|
+
* **internal:** codegen related update ([e60bcc4](https://github.com/anthropics/anthropic-sdk-ruby/commit/e60bcc4b11cd93720300277d28302d86d8566762))
|
55
|
+
* **internal:** codegen related update ([453af53](https://github.com/anthropics/anthropic-sdk-ruby/commit/453af530dea415d610566e2f8a88f317b5950c0f))
|
56
|
+
* **internal:** contribute.md and contributor QoL improvements ([c48b418](https://github.com/anthropics/anthropic-sdk-ruby/commit/c48b418733b923bf8d470004df4a179aba989e96))
|
57
|
+
* **internal:** improve response envelope unwrap functionality ([b807072](https://github.com/anthropics/anthropic-sdk-ruby/commit/b8070726b4d2b2d2612e4141a4c5122935715f76))
|
58
|
+
* **internal:** loosen internal type restrictions ([7675f8e](https://github.com/anthropics/anthropic-sdk-ruby/commit/7675f8efad31278d372ac1d778fe542202706681))
|
59
|
+
* **internal:** minor sync ([14829b1](https://github.com/anthropics/anthropic-sdk-ruby/commit/14829b1c97379325af6c716fd25eec7cf75eb7bc))
|
60
|
+
* **internal:** minor touch ups on sdk internals ([3b4a873](https://github.com/anthropics/anthropic-sdk-ruby/commit/3b4a873177d9cdddcb6c07440619da007615c0bd))
|
61
|
+
* **internal:** minor type annotation improvements ([e493aef](https://github.com/anthropics/anthropic-sdk-ruby/commit/e493aef841e1c86ef2954c24e029fd3719d5982d))
|
62
|
+
* **internal:** mostly README touch ups ([b29f388](https://github.com/anthropics/anthropic-sdk-ruby/commit/b29f3887bd12df092cd8398ac6fb82b327c7d2b1))
|
63
|
+
* **internal:** protect SSE parsing pipeline from broken UTF-8 characters ([74056ed](https://github.com/anthropics/anthropic-sdk-ruby/commit/74056edcb149d9237db1ef83f6afab46ce489689))
|
64
|
+
* **internal:** remove unnecessary `rbi/lib` folder ([f238fa8](https://github.com/anthropics/anthropic-sdk-ruby/commit/f238fa8af1c36616dfb87ee102165183684898a9))
|
65
|
+
* **internal:** version bump ([8478780](https://github.com/anthropics/anthropic-sdk-ruby/commit/8478780254d9ea6b489baccefe0b4a33c314e0c8))
|
66
|
+
* make internal types pretty print ([99c01e4](https://github.com/anthropics/anthropic-sdk-ruby/commit/99c01e43cceeebd97875bdfa8551352076dfb69f))
|
67
|
+
* make sorbet enums easier to read ([1909c6e](https://github.com/anthropics/anthropic-sdk-ruby/commit/1909c6ed7049fcf0d3b05a32318bd142f8116af7))
|
68
|
+
* migrate away from deprecated `JSON#fast_generate` ([80308a9](https://github.com/anthropics/anthropic-sdk-ruby/commit/80308a9b311a0a2b9ee1311fdebce93e0aa0427e))
|
69
|
+
* more accurate type annotations and aliases ([54c04df](https://github.com/anthropics/anthropic-sdk-ruby/commit/54c04df8f8f760aa9eed2466e1af1712a41f8c69))
|
70
|
+
* move bedrock and vertex under anthropic/helpers ([#574](https://github.com/anthropics/anthropic-sdk-ruby/issues/574)) ([c2f3554](https://github.com/anthropics/anthropic-sdk-ruby/commit/c2f355403be66637d615ff9e8f2f79f27eb35af8))
|
71
|
+
* re-export top level models under library namespace ([41a5161](https://github.com/anthropics/anthropic-sdk-ruby/commit/41a516134b3a9f4ac62d02a033369fee00162e36))
|
72
|
+
* refine `#inspect` and `#to_s` for model classes ([de00260](https://github.com/anthropics/anthropic-sdk-ruby/commit/de002609060018c1f61ec5ed84cc497b6a0ef7bb))
|
73
|
+
* remove Gemfile.lock during bootstrap ([7d671aa](https://github.com/anthropics/anthropic-sdk-ruby/commit/7d671aa814ff52569a8a372691a8964924a6e30c))
|
74
|
+
* reorganize type aliases ([94c0258](https://github.com/anthropics/anthropic-sdk-ruby/commit/94c0258dc85df0094da63365021f1301c5700a7a))
|
75
|
+
* revert ignoring Gemfile.lock ([47413aa](https://github.com/anthropics/anthropic-sdk-ruby/commit/47413aa7cae463b941b59f4b963b0d3d12eb60eb))
|
76
|
+
* show truncated parameter docs in yard ([679c27b](https://github.com/anthropics/anthropic-sdk-ruby/commit/679c27b578b746360f92e778c48c9e9bb105174c))
|
77
|
+
* simplify yard annotations by removing most `@!parse` directives ([5b23af5](https://github.com/anthropics/anthropic-sdk-ruby/commit/5b23af5a32f8317576e1f37e2685fead060956a6))
|
78
|
+
* update README with recommended editor plugins ([0c706bb](https://github.com/anthropics/anthropic-sdk-ruby/commit/0c706bbcc23d6affe8223cdf7ec06cc75a241859))
|
79
|
+
* use `@!method` instead of `@!parse` for virtual method type definitions ([2834dd6](https://github.com/anthropics/anthropic-sdk-ruby/commit/2834dd6f8bcb7ac7fbf2319c3ca948a8ecaa6c07))
|
80
|
+
* validate request option coercion correctness ([cd89ec5](https://github.com/anthropics/anthropic-sdk-ruby/commit/cd89ec570f37d602b594de786863e6d146d98833))
|
81
|
+
|
82
|
+
|
83
|
+
### Documentation
|
84
|
+
|
85
|
+
* fix misplaced coming soon snippet in README.md ([6979aae](https://github.com/anthropics/anthropic-sdk-ruby/commit/6979aae6105c9a26557e756f3a62963c59f9c742))
|
86
|
+
* illustrate environmental defaults for auth variables ([3f295d8](https://github.com/anthropics/anthropic-sdk-ruby/commit/3f295d8348e7e1c841b99911aa28e49a1b13a3cc))
|
87
|
+
* **readme:** fix typo ([6effd14](https://github.com/anthropics/anthropic-sdk-ruby/commit/6effd148a3510980e40ecada7b05dd4b856ef5e4))
|
88
|
+
* rewrite much of README.md for readability ([aaf7e8c](https://github.com/anthropics/anthropic-sdk-ruby/commit/aaf7e8c5ff69c1e209b7af078e3723418ec25b3c))
|
89
|
+
* update documentation links to be more uniform ([6b95412](https://github.com/anthropics/anthropic-sdk-ruby/commit/6b95412c1193c99bd7f1c701929e76a021f6e39e))
|
90
|
+
|
3
91
|
## 0.1.0-beta.6 (2025-04-11)
|
4
92
|
|
5
93
|
Full Changelog: [v0.1.0-beta.5...v0.1.0-beta.6](https://github.com/anthropics/anthropic-sdk-ruby/compare/v0.1.0-beta.5...v0.1.0-beta.6)
|
data/README.md
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
# Anthropic Ruby API library
|
2
2
|
|
3
|
-
The Anthropic Ruby library provides convenient access to the Anthropic REST API from any Ruby 3.
|
3
|
+
The Anthropic Ruby library provides convenient access to the Anthropic REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/anthropics/anthropic-sdk-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.
|
4
4
|
|
5
5
|
## Documentation
|
6
6
|
|
7
|
-
Documentation for
|
7
|
+
Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/anthropic-sdk-beta).
|
8
8
|
|
9
|
-
The
|
9
|
+
The REST API documentation can be found on [docs.anthropic.com](https://docs.anthropic.com/claude/reference/).
|
10
10
|
|
11
11
|
## Installation
|
12
|
+
|
12
13
|
ℹ️ The `anthropic-sdk-beta` gem name is temporary. [@alexrudall](https://github.com/alexrudall) will be transitioning the [anthropic gem name](https://github.com/alexrudall/anthropic) to this repository. Here's the timeline:
|
14
|
+
|
13
15
|
- Early April, 2025: This library is released under the `anthropic-sdk-beta` gem name. We'll be gathering feedback from the community.
|
16
|
+
|
14
17
|
- Late April/early May: Bump the version `1.0`, and transition the `anthropic` gem name to this repository.
|
15
18
|
|
16
19
|
To use this gem, install via Bundler by adding the following to your application's `Gemfile`:
|
@@ -18,11 +21,17 @@ To use this gem, install via Bundler by adding the following to your application
|
|
18
21
|
<!-- x-release-please-start-version -->
|
19
22
|
|
20
23
|
```ruby
|
21
|
-
gem "anthropic-sdk-beta", "~> 0.1.0.pre.beta.
|
24
|
+
gem "anthropic-sdk-beta", "~> 0.1.0.pre.beta.7"
|
22
25
|
```
|
23
26
|
|
24
27
|
<!-- x-release-please-end -->
|
25
28
|
|
29
|
+
## Feedback
|
30
|
+
|
31
|
+
We're looking for as much feedback as possible while the SDK is in Beta. If you have recommendations, notice bugs, find things confusing, or anything else, create a github issue. Don't be shy -- we're very open to hearing any thoughts and musings you have!
|
32
|
+
|
33
|
+
Feel free to make an issue for more substantial issues. For smaller issues or stream-of-thought, you can use the [pinned issue here](https://github.com/anthropics/anthropic-sdk-ruby/issues/85).
|
34
|
+
|
26
35
|
## Usage
|
27
36
|
|
28
37
|
```ruby
|
@@ -30,26 +39,35 @@ require "bundler/setup"
|
|
30
39
|
require "anthropic"
|
31
40
|
|
32
41
|
anthropic = Anthropic::Client.new(
|
33
|
-
api_key: "
|
42
|
+
api_key: ENV["ANTHROPIC_API_KEY"] # This is the default and can be omitted
|
34
43
|
)
|
35
44
|
|
36
45
|
message = anthropic.messages.create(
|
37
46
|
max_tokens: 1024,
|
38
|
-
messages: [{
|
39
|
-
|
40
|
-
content: "Hello, Claude"
|
41
|
-
}],
|
42
|
-
model: "claude-3-5-sonnet-latest"
|
47
|
+
messages: [{role: "user", content: "Hello, Claude"}],
|
48
|
+
model: :"claude-3-7-sonnet-latest"
|
43
49
|
)
|
44
50
|
|
45
51
|
puts(message.content)
|
46
52
|
```
|
47
53
|
|
48
|
-
###
|
54
|
+
### Streaming
|
49
55
|
|
50
|
-
We
|
56
|
+
We provide support for streaming responses using Server-Sent Events (SSE).
|
51
57
|
|
52
|
-
|
58
|
+
**coming soon**: `anthropic.messages.stream` will have [Python SDK](https://github.com/anthropics/anthropic-sdk-python?tab=readme-ov-file#streaming-helpers) style streaming response helpers.
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
stream = anthropic.messages.stream_raw(
|
62
|
+
max_tokens: 1024,
|
63
|
+
messages: [{role: "user", content: "Hello, Claude"}],
|
64
|
+
model: :"claude-3-7-sonnet-latest"
|
65
|
+
)
|
66
|
+
|
67
|
+
stream.each do |message|
|
68
|
+
puts(message.type)
|
69
|
+
end
|
70
|
+
```
|
53
71
|
|
54
72
|
### Pagination
|
55
73
|
|
@@ -70,28 +88,16 @@ page.auto_paging_each do |batch|
|
|
70
88
|
end
|
71
89
|
```
|
72
90
|
|
73
|
-
|
74
|
-
|
75
|
-
We provide support for streaming responses using Server Side Events (SSE).
|
76
|
-
|
77
|
-
**coming soon**: `anthropic.messages.stream` will have [Python SDK](https://github.com/anthropics/anthropic-sdk-python?tab=readme-ov-file#streaming-helpers) style streaming response helpers.
|
91
|
+
Alternatively, you can use the `#next_page?` and `#next_page` methods for more granular control working with pages.
|
78
92
|
|
79
93
|
```ruby
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
role: "user",
|
84
|
-
content: "Hello, Claude"
|
85
|
-
}],
|
86
|
-
model: "claude-3-5-sonnet-latest"
|
87
|
-
)
|
88
|
-
|
89
|
-
stream.each do |message|
|
90
|
-
puts(message.type)
|
94
|
+
if page.next_page?
|
95
|
+
new_page = page.next_page
|
96
|
+
puts(new_page.data[0].id)
|
91
97
|
end
|
92
98
|
```
|
93
99
|
|
94
|
-
###
|
100
|
+
### Handling errors
|
95
101
|
|
96
102
|
When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Anthropic::Errors::APIError` will be thrown:
|
97
103
|
|
@@ -99,18 +105,21 @@ When the library is unable to connect to the API, or if the API returns a non-su
|
|
99
105
|
begin
|
100
106
|
message = anthropic.messages.create(
|
101
107
|
max_tokens: 1024,
|
102
|
-
messages: [{
|
103
|
-
|
104
|
-
content: "Hello, Claude"
|
105
|
-
}],
|
106
|
-
model: "claude-3-5-sonnet-latest"
|
108
|
+
messages: [{role: "user", content: "Hello, Claude"}],
|
109
|
+
model: :"claude-3-7-sonnet-latest"
|
107
110
|
)
|
108
|
-
rescue Anthropic::Errors::
|
109
|
-
puts(
|
111
|
+
rescue Anthropic::Errors::APIConnectionError => e
|
112
|
+
puts("The server could not be reached")
|
113
|
+
puts(e.cause) # an underlying Exception, likely raised within `net/http`
|
114
|
+
rescue Anthropic::Errors::RateLimitError => e
|
115
|
+
puts("A 429 status code was received; we should back off a bit.")
|
116
|
+
rescue Anthropic::Errors::APIStatusError => e
|
117
|
+
puts("Another non-200-range status code was received")
|
118
|
+
puts(e.status)
|
110
119
|
end
|
111
120
|
```
|
112
121
|
|
113
|
-
Error codes are as
|
122
|
+
Error codes are as follows:
|
114
123
|
|
115
124
|
| Cause | Error Type |
|
116
125
|
| ---------------- | -------------------------- |
|
@@ -143,22 +152,15 @@ anthropic = Anthropic::Client.new(
|
|
143
152
|
# Or, configure per-request:
|
144
153
|
anthropic.messages.create(
|
145
154
|
max_tokens: 1024,
|
146
|
-
messages: [{
|
147
|
-
|
148
|
-
content: "Hello, Claude"
|
149
|
-
}],
|
150
|
-
model: "claude-3-5-sonnet-latest",
|
155
|
+
messages: [{role: "user", content: "Hello, Claude"}],
|
156
|
+
model: :"claude-3-7-sonnet-latest",
|
151
157
|
request_options: {max_retries: 5}
|
152
158
|
)
|
153
159
|
```
|
154
160
|
|
155
161
|
### Timeouts
|
156
162
|
|
157
|
-
By default, requests will time out after 600 seconds.
|
158
|
-
|
159
|
-
Timeouts are applied separately to the initial connection and the overall request time, so in some cases a request could wait 2\*timeout seconds before it fails.
|
160
|
-
|
161
|
-
You can use the `timeout` option to configure or disable this:
|
163
|
+
By default, requests will time out after 600 seconds. You can use the timeout option to configure or disable this:
|
162
164
|
|
163
165
|
```ruby
|
164
166
|
# Configure the default for all requests:
|
@@ -169,72 +171,21 @@ anthropic = Anthropic::Client.new(
|
|
169
171
|
# Or, configure per-request:
|
170
172
|
anthropic.messages.create(
|
171
173
|
max_tokens: 1024,
|
172
|
-
messages: [{
|
173
|
-
|
174
|
-
content: "Hello, Claude"
|
175
|
-
}],
|
176
|
-
model: "claude-3-5-sonnet-latest",
|
174
|
+
messages: [{role: "user", content: "Hello, Claude"}],
|
175
|
+
model: :"claude-3-7-sonnet-latest",
|
177
176
|
request_options: {timeout: 5}
|
178
177
|
)
|
179
178
|
```
|
180
179
|
|
181
|
-
|
182
|
-
|
183
|
-
### Solargraph
|
184
|
-
|
185
|
-
This library includes [Solargraph](https://solargraph.org) support for both auto completion and go to definition.
|
186
|
-
|
187
|
-
```ruby
|
188
|
-
gem "solargraph", group: :development
|
189
|
-
```
|
190
|
-
|
191
|
-
After Solargraph is installed, **you must populate its index** either via the provided editor command, or by running the following in your terminal:
|
192
|
-
|
193
|
-
```sh
|
194
|
-
bundle exec solargraph gems
|
195
|
-
```
|
196
|
-
|
197
|
-
Note: if you had installed the gem either using a `git:` or `github:` URL, or had vendored the gem using bundler, you will need to set up your [`.solargraph.yml`](https://solargraph.org/guides/configuration) to include the path to the gem's `lib` directory.
|
198
|
-
|
199
|
-
```yaml
|
200
|
-
include:
|
201
|
-
- 'vendor/bundle/ruby/*/gems/anthropic-sdk-beta-*/lib/**/*.rb'
|
202
|
-
```
|
203
|
-
|
204
|
-
Otherwise Solargraph will not be able to provide type information or auto-completion for any non-indexed libraries.
|
205
|
-
|
206
|
-
### Sorbet
|
207
|
-
|
208
|
-
This library is written with [Sorbet type definitions](https://sorbet.org/docs/rbi). However, there is no runtime dependency on the `sorbet-runtime`.
|
209
|
-
|
210
|
-
What this means is that while you can use Sorbet to type check your code statically, and benefit from the [Sorbet Language Server](https://sorbet.org/docs/lsp) in your editor, there is no runtime type checking and execution overhead from Sorbet itself.
|
211
|
-
|
212
|
-
Due to limitations with the Sorbet type system, where a method otherwise can take an instance of `Anthropic::BaseModel` class, you will need to use the `**` splat operator to pass the arguments:
|
213
|
-
|
214
|
-
Please follow Sorbet's [setup guides](https://sorbet.org/docs/adopting) for best experience.
|
215
|
-
|
216
|
-
```ruby
|
217
|
-
params = Anthropic::Models::MessageCreateParams.new(
|
218
|
-
max_tokens: 1024,
|
219
|
-
messages: [Anthropic::Models::MessageParam.new(role: :user, content: "hello")],
|
220
|
-
model: "claude-3-5-sonnet-latest"
|
221
|
-
)
|
222
|
-
|
223
|
-
anthropic.messages.create(**params)
|
224
|
-
```
|
225
|
-
|
226
|
-
Note: **This library emits an intentional warning under the [`tapioca` toolchain](https://github.com/Shopify/tapioca)**. This is normal, and does not impact functionality.
|
227
|
-
|
228
|
-
### Ruby LSP
|
229
|
-
|
230
|
-
The Ruby LSP has [best effort support](https://shopify.github.io/ruby-lsp/#guessed-types) for inferring type information from Ruby code, and as such it may not always be able to provide accurate type information.
|
180
|
+
On timeout, `Anthropic::Errors::APITimeoutError` is raised.
|
231
181
|
|
182
|
+
Note that requests that time out are retried by default.
|
232
183
|
|
233
184
|
## AWS Bedrock
|
234
185
|
|
235
186
|
This library also provides support for the [Anthropic Bedrock API](https://aws.amazon.com/bedrock/claude/) if you install this library with the `aws-sdk-bedrockruntime` gem.
|
236
187
|
|
237
|
-
You can then instantiate a separate `Anthropic::
|
188
|
+
You can then instantiate a separate `Anthropic::BedrockClient` class, and use AWS's standard guide for configuring credentials (see [the aws-sdk-ruby gem README](https://github.com/aws/aws-sdk-ruby?tab=readme-ov-file#configuration) or [AWS Documentation](https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/setup-config.html#credchain)). It has the same API as the base `Anthropic::Client` class.
|
238
189
|
|
239
190
|
Note that the model ID required is different for Bedrock models, and, depending on the model you want to use, you will need to use either the AWS's model ID for Anthropic models -- which can be found in [AWS's Bedrock model catalog](https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html) -- or an inference profile id (e.g. `us.anthropic.claude-3-5-haiku-20241022-v1:0` for Claude 3.5 Haiku).
|
240
191
|
|
@@ -242,7 +193,7 @@ Note that the model ID required is different for Bedrock models, and, depending
|
|
242
193
|
require "bundler/setup"
|
243
194
|
require "anthropic"
|
244
195
|
|
245
|
-
anthropic = Anthropic::
|
196
|
+
anthropic = Anthropic::BedrockClient.new
|
246
197
|
|
247
198
|
message = anthropic.messages.create(
|
248
199
|
max_tokens: 1024,
|
@@ -255,7 +206,7 @@ message = anthropic.messages.create(
|
|
255
206
|
model: "anthropic.claude-3-5-sonnet-20241022-v2:0"
|
256
207
|
)
|
257
208
|
|
258
|
-
puts
|
209
|
+
puts(message)
|
259
210
|
```
|
260
211
|
|
261
212
|
For more examples see [`examples/bedrock`](examples/bedrock).
|
@@ -264,13 +215,13 @@ For more examples see [`examples/bedrock`](examples/bedrock).
|
|
264
215
|
|
265
216
|
This library also provides support for the [Anthropic Vertex API](https://cloud.google.com/vertex-ai?hl=en) if you install this library with the `googleauth` gem.
|
266
217
|
|
267
|
-
You can then import and instantiate a separate `Anthropic::
|
218
|
+
You can then import and instantiate a separate `Anthropic::VertexClient` class, and use Google's guide for configuring [Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc). It has the same API as the base `Anthropic::Client` class.
|
268
219
|
|
269
220
|
```ruby
|
270
221
|
require "bundler/setup"
|
271
222
|
require "anthropic"
|
272
223
|
|
273
|
-
anthropic = Anthropic::
|
224
|
+
anthropic = Anthropic::VertexClient.new(region: "us-east5", project_id: "my-project-id")
|
274
225
|
|
275
226
|
message = anthropic.messages.create(
|
276
227
|
max_tokens: 1024,
|
@@ -283,46 +234,135 @@ message = anthropic.messages.create(
|
|
283
234
|
model: "claude-3-7-sonnet@20250219"
|
284
235
|
)
|
285
236
|
|
286
|
-
puts
|
237
|
+
puts(message)
|
287
238
|
```
|
288
239
|
|
289
240
|
For more examples see [`examples/vertex`](examples/vertex).
|
290
241
|
|
291
|
-
## Advanced
|
242
|
+
## Advanced concepts
|
243
|
+
|
244
|
+
### BaseModel
|
245
|
+
|
246
|
+
All parameter and response objects inherit from `Anthropic::Internal::Type::BaseModel`, which provides several conveniences, including:
|
247
|
+
|
248
|
+
1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax.
|
292
249
|
|
293
|
-
|
250
|
+
2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.
|
294
251
|
|
295
|
-
|
252
|
+
3. Both instances and the classes themselves can be pretty-printed.
|
296
253
|
|
297
|
-
|
254
|
+
4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.
|
255
|
+
|
256
|
+
### Making custom or undocumented requests
|
257
|
+
|
258
|
+
#### Undocumented properties
|
259
|
+
|
260
|
+
You can send undocumented parameters to any endpoint, and read undocumented response properties, like so:
|
261
|
+
|
262
|
+
Note: the `extra_` parameters of the same name overrides the documented parameters.
|
263
|
+
|
264
|
+
```ruby
|
265
|
+
message =
|
266
|
+
anthropic.messages.create(
|
267
|
+
max_tokens: 1024,
|
268
|
+
messages: [{role: "user", content: "Hello, Claude"}],
|
269
|
+
model: :"claude-3-7-sonnet-latest",
|
270
|
+
request_options: {
|
271
|
+
extra_query: {my_query_parameter: value},
|
272
|
+
extra_body: {my_body_parameter: value},
|
273
|
+
extra_headers: {"my-header": value}
|
274
|
+
}
|
275
|
+
)
|
276
|
+
|
277
|
+
puts(message[:my_undocumented_property])
|
278
|
+
```
|
298
279
|
|
299
280
|
#### Undocumented request params
|
300
281
|
|
301
|
-
If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a
|
282
|
+
If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request as seen in examples above.
|
302
283
|
|
303
284
|
#### Undocumented endpoints
|
304
285
|
|
305
|
-
To make requests to undocumented endpoints, you can make requests using `client.request
|
286
|
+
To make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:
|
306
287
|
|
307
288
|
```ruby
|
308
289
|
response = client.request(
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
290
|
+
method: :post,
|
291
|
+
path: '/undocumented/endpoint',
|
292
|
+
query: {"dog": "woof"},
|
293
|
+
headers: {"useful-header": "interesting-value"},
|
294
|
+
body: {"hello": "world"}
|
295
|
+
)
|
315
296
|
```
|
316
297
|
|
317
|
-
### Concurrency &
|
298
|
+
### Concurrency & connection pooling
|
299
|
+
|
300
|
+
The `Anthropic::Client` instances are threadsafe, but only are fork-safe when there are no in-flight HTTP requests.
|
318
301
|
|
319
|
-
|
302
|
+
Each instance of `Anthropic::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.
|
320
303
|
|
321
|
-
When
|
304
|
+
When all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.
|
322
305
|
|
323
306
|
Unless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.
|
324
307
|
|
325
|
-
|
308
|
+
## Sorbet
|
309
|
+
|
310
|
+
This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.
|
311
|
+
|
312
|
+
You can provide typesafe request parameters like so:
|
313
|
+
|
314
|
+
```ruby
|
315
|
+
anthropic.messages.create(
|
316
|
+
max_tokens: 1024,
|
317
|
+
messages: [Anthropic::MessageParam.new(role: "user", content: "Hello, Claude")],
|
318
|
+
model: :"claude-3-7-sonnet-latest"
|
319
|
+
)
|
320
|
+
```
|
321
|
+
|
322
|
+
Or, equivalently:
|
323
|
+
|
324
|
+
```ruby
|
325
|
+
# Hashes work, but are not typesafe:
|
326
|
+
anthropic.messages.create(
|
327
|
+
max_tokens: 1024,
|
328
|
+
messages: [{role: "user", content: "Hello, Claude"}],
|
329
|
+
model: :"claude-3-7-sonnet-latest"
|
330
|
+
)
|
331
|
+
|
332
|
+
# You can also splat a full Params class:
|
333
|
+
params = Anthropic::MessageCreateParams.new(
|
334
|
+
max_tokens: 1024,
|
335
|
+
messages: [Anthropic::MessageParam.new(role: "user", content: "Hello, Claude")],
|
336
|
+
model: :"claude-3-7-sonnet-latest"
|
337
|
+
)
|
338
|
+
anthropic.messages.create(**params)
|
339
|
+
```
|
340
|
+
|
341
|
+
### Enums
|
342
|
+
|
343
|
+
Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:
|
344
|
+
|
345
|
+
```ruby
|
346
|
+
# :"image/jpeg"
|
347
|
+
puts(Anthropic::Base64ImageSource::MediaType::IMAGE_JPEG)
|
348
|
+
|
349
|
+
# Revealed type: `T.all(Anthropic::Base64ImageSource::MediaType, Symbol)`
|
350
|
+
T.reveal_type(Anthropic::Base64ImageSource::MediaType::IMAGE_JPEG)
|
351
|
+
```
|
352
|
+
|
353
|
+
Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
|
354
|
+
|
355
|
+
```ruby
|
356
|
+
Anthropic::Base64ImageSource.new(
|
357
|
+
media_type: Anthropic::Base64ImageSource::MediaType::IMAGE_JPEG,
|
358
|
+
# …
|
359
|
+
)
|
360
|
+
|
361
|
+
Anthropic::Base64ImageSource.new(
|
362
|
+
media_type: :"image/jpeg",
|
363
|
+
# …
|
364
|
+
)
|
365
|
+
```
|
326
366
|
|
327
367
|
## Versioning
|
328
368
|
|
@@ -332,7 +372,12 @@ This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` typ
|
|
332
372
|
|
333
373
|
## Requirements
|
334
374
|
|
335
|
-
Ruby 3.
|
375
|
+
Ruby 3.2.0 or higher.
|
376
|
+
|
377
|
+
## Contributing
|
378
|
+
|
379
|
+
See [the contributing documentation](https://github.com/anthropics/anthropic-sdk-ruby/tree/main/CONTRIBUTING.md).
|
336
380
|
|
337
381
|
## Acknowledgements
|
382
|
+
|
338
383
|
Thank you [@alexrudall](https://github.com/alexrudall) for giving feedback, donating the `anthropic` Ruby Gem name, and paving the way by building the first Anthropic Ruby SDK.
|
data/lib/anthropic/client.rb
CHANGED
@@ -62,7 +62,8 @@ module Anthropic
|
|
62
62
|
#
|
63
63
|
# @param auth_token [String, nil] Defaults to `ENV["ANTHROPIC_AUTH_TOKEN"]`
|
64
64
|
#
|
65
|
-
# @param base_url [String, nil] Override the default base URL for the API, e.g.,
|
65
|
+
# @param base_url [String, nil] Override the default base URL for the API, e.g.,
|
66
|
+
# `"https://api.example.com/v2/"`. Defaults to `ENV["ANTHROPIC_BASE_URL"]`
|
66
67
|
#
|
67
68
|
# @param max_retries [Integer] Max number of retries to attempt after a failed retryable request.
|
68
69
|
#
|
@@ -74,11 +75,11 @@ module Anthropic
|
|
74
75
|
def initialize(
|
75
76
|
api_key: ENV["ANTHROPIC_API_KEY"],
|
76
77
|
auth_token: ENV["ANTHROPIC_AUTH_TOKEN"],
|
77
|
-
base_url:
|
78
|
-
max_retries: DEFAULT_MAX_RETRIES,
|
79
|
-
timeout: DEFAULT_TIMEOUT_IN_SECONDS,
|
80
|
-
initial_retry_delay: DEFAULT_INITIAL_RETRY_DELAY,
|
81
|
-
max_retry_delay: DEFAULT_MAX_RETRY_DELAY
|
78
|
+
base_url: ENV["ANTHROPIC_BASE_URL"],
|
79
|
+
max_retries: self.class::DEFAULT_MAX_RETRIES,
|
80
|
+
timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS,
|
81
|
+
initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY,
|
82
|
+
max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY
|
82
83
|
)
|
83
84
|
base_url ||= "https://api.anthropic.com"
|
84
85
|
|
data/lib/anthropic/errors.rb
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
module Anthropic
|
4
4
|
module Errors
|
5
5
|
class Error < StandardError
|
6
|
-
# @!
|
7
|
-
#
|
8
|
-
#
|
6
|
+
# @!attribute cause
|
7
|
+
#
|
8
|
+
# @return [StandardError, nil]
|
9
9
|
end
|
10
10
|
|
11
11
|
class ConversionError < Anthropic::Errors::Error
|
@@ -40,13 +40,13 @@ module Anthropic
|
|
40
40
|
end
|
41
41
|
|
42
42
|
class APIConnectionError < Anthropic::Errors::APIError
|
43
|
-
# @!
|
44
|
-
#
|
45
|
-
#
|
43
|
+
# @!attribute status
|
44
|
+
#
|
45
|
+
# @return [nil]
|
46
46
|
|
47
|
-
# @!
|
48
|
-
#
|
49
|
-
#
|
47
|
+
# @!attribute body
|
48
|
+
#
|
49
|
+
# @return [nil]
|
50
50
|
|
51
51
|
# @api private
|
52
52
|
#
|
@@ -99,7 +99,7 @@ module Anthropic
|
|
99
99
|
# @param response [nil]
|
100
100
|
# @param message [String, nil]
|
101
101
|
#
|
102
|
-
# @return [
|
102
|
+
# @return [self]
|
103
103
|
def self.for(url:, status:, body:, request:, response:, message: nil)
|
104
104
|
kwargs = {
|
105
105
|
url: url,
|