anthropic-sdk-beta 0.1.0.pre.beta.3
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 +7 -0
- data/README.md +343 -0
- data/lib/anthropic/bedrock/client.rb +261 -0
- data/lib/anthropic/client.rb +107 -0
- data/lib/anthropic/errors.rb +192 -0
- data/lib/anthropic/internal/jsonl_stream.rb +26 -0
- data/lib/anthropic/internal/page.rb +109 -0
- data/lib/anthropic/internal/stream.rb +58 -0
- data/lib/anthropic/internal/transport/base_client.rb +473 -0
- data/lib/anthropic/internal/transport/pooled_net_requester.rb +193 -0
- data/lib/anthropic/internal/type/array_of.rb +128 -0
- data/lib/anthropic/internal/type/base_model.rb +380 -0
- data/lib/anthropic/internal/type/base_page.rb +46 -0
- data/lib/anthropic/internal/type/base_stream.rb +73 -0
- data/lib/anthropic/internal/type/boolean.rb +58 -0
- data/lib/anthropic/internal/type/converter.rb +247 -0
- data/lib/anthropic/internal/type/enum.rb +113 -0
- data/lib/anthropic/internal/type/hash_of.rb +148 -0
- data/lib/anthropic/internal/type/io_like.rb +75 -0
- data/lib/anthropic/internal/type/request_parameters.rb +49 -0
- data/lib/anthropic/internal/type/union.rb +216 -0
- data/lib/anthropic/internal/type/unknown.rb +62 -0
- data/lib/anthropic/internal/util.rb +755 -0
- data/lib/anthropic/internal.rb +8 -0
- data/lib/anthropic/models/anthropic_beta.rb +44 -0
- data/lib/anthropic/models/api_error_object.rb +25 -0
- data/lib/anthropic/models/authentication_error.rb +25 -0
- data/lib/anthropic/models/base64_image_source.rb +47 -0
- data/lib/anthropic/models/base64_pdf_source.rb +31 -0
- data/lib/anthropic/models/beta/beta_base64_image_source.rb +51 -0
- data/lib/anthropic/models/beta/beta_base64_pdf_block.rb +76 -0
- data/lib/anthropic/models/beta/beta_base64_pdf_source.rb +35 -0
- data/lib/anthropic/models/beta/beta_cache_control_ephemeral.rb +23 -0
- data/lib/anthropic/models/beta/beta_citation_char_location.rb +63 -0
- data/lib/anthropic/models/beta/beta_citation_char_location_param.rb +63 -0
- data/lib/anthropic/models/beta/beta_citation_content_block_location.rb +63 -0
- data/lib/anthropic/models/beta/beta_citation_content_block_location_param.rb +63 -0
- data/lib/anthropic/models/beta/beta_citation_page_location.rb +63 -0
- data/lib/anthropic/models/beta/beta_citation_page_location_param.rb +63 -0
- data/lib/anthropic/models/beta/beta_citations_config_param.rb +27 -0
- data/lib/anthropic/models/beta/beta_citations_delta.rb +46 -0
- data/lib/anthropic/models/beta/beta_content_block.rb +27 -0
- data/lib/anthropic/models/beta/beta_content_block_param.rb +33 -0
- data/lib/anthropic/models/beta/beta_content_block_source.rb +45 -0
- data/lib/anthropic/models/beta/beta_content_block_source_content.rb +23 -0
- data/lib/anthropic/models/beta/beta_image_block_param.rb +50 -0
- data/lib/anthropic/models/beta/beta_input_json_delta.rb +29 -0
- data/lib/anthropic/models/beta/beta_message.rb +143 -0
- data/lib/anthropic/models/beta/beta_message_delta_usage.rb +24 -0
- data/lib/anthropic/models/beta/beta_message_param.rb +59 -0
- data/lib/anthropic/models/beta/beta_message_tokens_count.rb +26 -0
- data/lib/anthropic/models/beta/beta_metadata.rb +28 -0
- data/lib/anthropic/models/beta/beta_model_info.rb +49 -0
- data/lib/anthropic/models/beta/beta_plain_text_source.rb +35 -0
- data/lib/anthropic/models/beta/beta_raw_content_block_delta.rb +29 -0
- data/lib/anthropic/models/beta/beta_raw_content_block_delta_event.rb +35 -0
- data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +55 -0
- data/lib/anthropic/models/beta/beta_raw_content_block_stop_event.rb +29 -0
- data/lib/anthropic/models/beta/beta_raw_message_delta_event.rb +71 -0
- data/lib/anthropic/models/beta/beta_raw_message_start_event.rb +29 -0
- data/lib/anthropic/models/beta/beta_raw_message_stop_event.rb +23 -0
- data/lib/anthropic/models/beta/beta_raw_message_stream_event.rb +31 -0
- data/lib/anthropic/models/beta/beta_redacted_thinking_block.rb +29 -0
- data/lib/anthropic/models/beta/beta_redacted_thinking_block_param.rb +29 -0
- data/lib/anthropic/models/beta/beta_signature_delta.rb +29 -0
- data/lib/anthropic/models/beta/beta_stop_reason.rb +24 -0
- data/lib/anthropic/models/beta/beta_text_block.rb +42 -0
- data/lib/anthropic/models/beta/beta_text_block_param.rb +43 -0
- data/lib/anthropic/models/beta/beta_text_citation.rb +25 -0
- data/lib/anthropic/models/beta/beta_text_citation_param.rb +25 -0
- data/lib/anthropic/models/beta/beta_text_delta.rb +29 -0
- data/lib/anthropic/models/beta/beta_thinking_block.rb +35 -0
- data/lib/anthropic/models/beta/beta_thinking_block_param.rb +35 -0
- data/lib/anthropic/models/beta/beta_thinking_config_disabled.rb +23 -0
- data/lib/anthropic/models/beta/beta_thinking_config_enabled.rb +38 -0
- data/lib/anthropic/models/beta/beta_thinking_config_param.rb +32 -0
- data/lib/anthropic/models/beta/beta_thinking_delta.rb +29 -0
- data/lib/anthropic/models/beta/beta_tool.rb +103 -0
- data/lib/anthropic/models/beta/beta_tool_bash_20241022.rb +38 -0
- data/lib/anthropic/models/beta/beta_tool_bash_20250124.rb +38 -0
- data/lib/anthropic/models/beta/beta_tool_choice.rb +33 -0
- data/lib/anthropic/models/beta/beta_tool_choice_any.rb +39 -0
- data/lib/anthropic/models/beta/beta_tool_choice_auto.rb +39 -0
- data/lib/anthropic/models/beta/beta_tool_choice_none.rb +25 -0
- data/lib/anthropic/models/beta/beta_tool_choice_tool.rb +46 -0
- data/lib/anthropic/models/beta/beta_tool_computer_use_20241022.rb +69 -0
- data/lib/anthropic/models/beta/beta_tool_computer_use_20250124.rb +69 -0
- data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +85 -0
- data/lib/anthropic/models/beta/beta_tool_text_editor_20241022.rb +38 -0
- data/lib/anthropic/models/beta/beta_tool_text_editor_20250124.rb +38 -0
- data/lib/anthropic/models/beta/beta_tool_union.rb +31 -0
- data/lib/anthropic/models/beta/beta_tool_use_block.rb +41 -0
- data/lib/anthropic/models/beta/beta_tool_use_block_param.rb +47 -0
- data/lib/anthropic/models/beta/beta_url_image_source.rb +29 -0
- data/lib/anthropic/models/beta/beta_url_pdf_source.rb +29 -0
- data/lib/anthropic/models/beta/beta_usage.rb +45 -0
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +315 -0
- data/lib/anthropic/models/beta/message_create_params.rb +395 -0
- data/lib/anthropic/models/beta/messages/batch_cancel_params.rb +34 -0
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +463 -0
- data/lib/anthropic/models/beta/messages/batch_delete_params.rb +34 -0
- data/lib/anthropic/models/beta/messages/batch_list_params.rb +71 -0
- data/lib/anthropic/models/beta/messages/batch_results_params.rb +34 -0
- data/lib/anthropic/models/beta/messages/batch_retrieve_params.rb +34 -0
- data/lib/anthropic/models/beta/messages/beta_deleted_message_batch.rb +34 -0
- data/lib/anthropic/models/beta/messages/beta_message_batch.rb +140 -0
- data/lib/anthropic/models/beta/messages/beta_message_batch_canceled_result.rb +23 -0
- data/lib/anthropic/models/beta/messages/beta_message_batch_errored_result.rb +29 -0
- data/lib/anthropic/models/beta/messages/beta_message_batch_expired_result.rb +23 -0
- data/lib/anthropic/models/beta/messages/beta_message_batch_individual_response.rb +42 -0
- data/lib/anthropic/models/beta/messages/beta_message_batch_request_counts.rb +60 -0
- data/lib/anthropic/models/beta/messages/beta_message_batch_result.rb +32 -0
- data/lib/anthropic/models/beta/messages/beta_message_batch_succeeded_result.rb +29 -0
- data/lib/anthropic/models/beta/model_list_params.rb +58 -0
- data/lib/anthropic/models/beta/model_retrieve_params.rb +21 -0
- data/lib/anthropic/models/beta_api_error.rb +25 -0
- data/lib/anthropic/models/beta_authentication_error.rb +25 -0
- data/lib/anthropic/models/beta_billing_error.rb +25 -0
- data/lib/anthropic/models/beta_error.rb +33 -0
- data/lib/anthropic/models/beta_error_response.rb +25 -0
- data/lib/anthropic/models/beta_gateway_timeout_error.rb +25 -0
- data/lib/anthropic/models/beta_invalid_request_error.rb +25 -0
- data/lib/anthropic/models/beta_not_found_error.rb +25 -0
- data/lib/anthropic/models/beta_overloaded_error.rb +25 -0
- data/lib/anthropic/models/beta_permission_error.rb +25 -0
- data/lib/anthropic/models/beta_rate_limit_error.rb +25 -0
- data/lib/anthropic/models/billing_error.rb +25 -0
- data/lib/anthropic/models/cache_control_ephemeral.rb +19 -0
- data/lib/anthropic/models/citation_char_location.rb +59 -0
- data/lib/anthropic/models/citation_char_location_param.rb +59 -0
- data/lib/anthropic/models/citation_content_block_location.rb +59 -0
- data/lib/anthropic/models/citation_content_block_location_param.rb +59 -0
- data/lib/anthropic/models/citation_page_location.rb +59 -0
- data/lib/anthropic/models/citation_page_location_param.rb +59 -0
- data/lib/anthropic/models/citations_config_param.rb +23 -0
- data/lib/anthropic/models/citations_delta.rb +42 -0
- data/lib/anthropic/models/completion.rb +63 -0
- data/lib/anthropic/models/completion_create_params.rb +152 -0
- data/lib/anthropic/models/content_block.rb +23 -0
- data/lib/anthropic/models/content_block_param.rb +29 -0
- data/lib/anthropic/models/content_block_source.rb +41 -0
- data/lib/anthropic/models/content_block_source_content.rb +19 -0
- data/lib/anthropic/models/document_block_param.rb +72 -0
- data/lib/anthropic/models/error_object.rb +33 -0
- data/lib/anthropic/models/error_response.rb +25 -0
- data/lib/anthropic/models/gateway_timeout_error.rb +25 -0
- data/lib/anthropic/models/image_block_param.rb +46 -0
- data/lib/anthropic/models/input_json_delta.rb +25 -0
- data/lib/anthropic/models/invalid_request_error.rb +25 -0
- data/lib/anthropic/models/message.rb +138 -0
- data/lib/anthropic/models/message_count_tokens_params.rb +265 -0
- data/lib/anthropic/models/message_count_tokens_tool.rb +19 -0
- data/lib/anthropic/models/message_create_params.rb +380 -0
- data/lib/anthropic/models/message_delta_usage.rb +20 -0
- data/lib/anthropic/models/message_param.rb +55 -0
- data/lib/anthropic/models/message_tokens_count.rb +22 -0
- data/lib/anthropic/models/messages/batch_cancel_params.rb +21 -0
- data/lib/anthropic/models/messages/batch_create_params.rb +449 -0
- data/lib/anthropic/models/messages/batch_delete_params.rb +21 -0
- data/lib/anthropic/models/messages/batch_list_params.rb +58 -0
- data/lib/anthropic/models/messages/batch_results_params.rb +21 -0
- data/lib/anthropic/models/messages/batch_retrieve_params.rb +21 -0
- data/lib/anthropic/models/messages/deleted_message_batch.rb +32 -0
- data/lib/anthropic/models/messages/message_batch.rb +139 -0
- data/lib/anthropic/models/messages/message_batch_canceled_result.rb +23 -0
- data/lib/anthropic/models/messages/message_batch_errored_result.rb +29 -0
- data/lib/anthropic/models/messages/message_batch_expired_result.rb +23 -0
- data/lib/anthropic/models/messages/message_batch_individual_response.rb +42 -0
- data/lib/anthropic/models/messages/message_batch_request_counts.rb +60 -0
- data/lib/anthropic/models/messages/message_batch_result.rb +32 -0
- data/lib/anthropic/models/messages/message_batch_succeeded_result.rb +29 -0
- data/lib/anthropic/models/metadata.rb +24 -0
- data/lib/anthropic/models/model.rb +93 -0
- data/lib/anthropic/models/model_info.rb +45 -0
- data/lib/anthropic/models/model_list_params.rb +56 -0
- data/lib/anthropic/models/model_retrieve_params.rb +19 -0
- data/lib/anthropic/models/not_found_error.rb +25 -0
- data/lib/anthropic/models/overloaded_error.rb +25 -0
- data/lib/anthropic/models/permission_error.rb +25 -0
- data/lib/anthropic/models/plain_text_source.rb +31 -0
- data/lib/anthropic/models/rate_limit_error.rb +25 -0
- data/lib/anthropic/models/raw_content_block_delta.rb +25 -0
- data/lib/anthropic/models/raw_content_block_delta_event.rb +31 -0
- data/lib/anthropic/models/raw_content_block_start_event.rb +50 -0
- data/lib/anthropic/models/raw_content_block_stop_event.rb +25 -0
- data/lib/anthropic/models/raw_message_delta_event.rb +67 -0
- data/lib/anthropic/models/raw_message_start_event.rb +25 -0
- data/lib/anthropic/models/raw_message_stop_event.rb +19 -0
- data/lib/anthropic/models/raw_message_stream_event.rb +27 -0
- data/lib/anthropic/models/redacted_thinking_block.rb +25 -0
- data/lib/anthropic/models/redacted_thinking_block_param.rb +25 -0
- data/lib/anthropic/models/signature_delta.rb +25 -0
- data/lib/anthropic/models/stop_reason.rb +20 -0
- data/lib/anthropic/models/text_block.rb +38 -0
- data/lib/anthropic/models/text_block_param.rb +39 -0
- data/lib/anthropic/models/text_citation.rb +21 -0
- data/lib/anthropic/models/text_citation_param.rb +21 -0
- data/lib/anthropic/models/text_delta.rb +25 -0
- data/lib/anthropic/models/thinking_block.rb +31 -0
- data/lib/anthropic/models/thinking_block_param.rb +31 -0
- data/lib/anthropic/models/thinking_config_disabled.rb +19 -0
- data/lib/anthropic/models/thinking_config_enabled.rb +34 -0
- data/lib/anthropic/models/thinking_config_param.rb +28 -0
- data/lib/anthropic/models/thinking_delta.rb +25 -0
- data/lib/anthropic/models/tool.rb +80 -0
- data/lib/anthropic/models/tool_bash_20250124.rb +34 -0
- data/lib/anthropic/models/tool_choice.rb +29 -0
- data/lib/anthropic/models/tool_choice_any.rb +35 -0
- data/lib/anthropic/models/tool_choice_auto.rb +35 -0
- data/lib/anthropic/models/tool_choice_none.rb +21 -0
- data/lib/anthropic/models/tool_choice_tool.rb +42 -0
- data/lib/anthropic/models/tool_result_block_param.rb +81 -0
- data/lib/anthropic/models/tool_text_editor_20250124.rb +34 -0
- data/lib/anthropic/models/tool_union.rb +19 -0
- data/lib/anthropic/models/tool_use_block.rb +37 -0
- data/lib/anthropic/models/tool_use_block_param.rb +43 -0
- data/lib/anthropic/models/url_image_source.rb +25 -0
- data/lib/anthropic/models/url_pdf_source.rb +25 -0
- data/lib/anthropic/models/usage.rb +41 -0
- data/lib/anthropic/request_options.rb +75 -0
- data/lib/anthropic/resources/beta/messages/batches.rb +198 -0
- data/lib/anthropic/resources/beta/messages.rb +158 -0
- data/lib/anthropic/resources/beta/models.rb +65 -0
- data/lib/anthropic/resources/beta.rb +22 -0
- data/lib/anthropic/resources/completions.rb +100 -0
- data/lib/anthropic/resources/messages/batches.rb +179 -0
- data/lib/anthropic/resources/messages.rb +145 -0
- data/lib/anthropic/resources/models.rb +63 -0
- data/lib/anthropic/version.rb +5 -0
- data/lib/anthropic/vertex/client.rb +210 -0
- data/lib/anthropic.rb +265 -0
- data/manifest.yaml +15 -0
- data/rbi/lib/anthropic/bedrock/client.rbi +80 -0
- data/rbi/lib/anthropic/client.rbi +70 -0
- data/rbi/lib/anthropic/errors.rbi +143 -0
- data/rbi/lib/anthropic/internal/jsonl_stream.rbi +16 -0
- data/rbi/lib/anthropic/internal/page.rbi +26 -0
- data/rbi/lib/anthropic/internal/stream.rbi +16 -0
- data/rbi/lib/anthropic/internal/transport/base_client.rbi +204 -0
- data/rbi/lib/anthropic/internal/transport/pooled_net_requester.rbi +60 -0
- data/rbi/lib/anthropic/internal/type/array_of.rbi +82 -0
- data/rbi/lib/anthropic/internal/type/base_model.rbi +197 -0
- data/rbi/lib/anthropic/internal/type/base_page.rbi +36 -0
- data/rbi/lib/anthropic/internal/type/base_stream.rbi +51 -0
- data/rbi/lib/anthropic/internal/type/boolean.rbi +49 -0
- data/rbi/lib/anthropic/internal/type/converter.rbi +112 -0
- data/rbi/lib/anthropic/internal/type/enum.rbi +63 -0
- data/rbi/lib/anthropic/internal/type/hash_of.rbi +82 -0
- data/rbi/lib/anthropic/internal/type/io_like.rbi +47 -0
- data/rbi/lib/anthropic/internal/type/request_parameters.rbi +21 -0
- data/rbi/lib/anthropic/internal/type/union.rbi +68 -0
- data/rbi/lib/anthropic/internal/type/unknown.rbi +41 -0
- data/rbi/lib/anthropic/internal/util.rbi +282 -0
- data/rbi/lib/anthropic/internal.rbi +12 -0
- data/rbi/lib/anthropic/models/anthropic_beta.rbi +30 -0
- data/rbi/lib/anthropic/models/api_error_object.rbi +19 -0
- data/rbi/lib/anthropic/models/authentication_error.rbi +19 -0
- data/rbi/lib/anthropic/models/base64_image_source.rbi +46 -0
- data/rbi/lib/anthropic/models/base64_pdf_source.rbi +22 -0
- data/rbi/lib/anthropic/models/beta/beta_base64_image_source.rbi +56 -0
- data/rbi/lib/anthropic/models/beta/beta_base64_pdf_block.rbi +104 -0
- data/rbi/lib/anthropic/models/beta/beta_base64_pdf_source.rbi +26 -0
- data/rbi/lib/anthropic/models/beta/beta_cache_control_ephemeral.rbi +20 -0
- data/rbi/lib/anthropic/models/beta/beta_citation_char_location.rbi +65 -0
- data/rbi/lib/anthropic/models/beta/beta_citation_char_location_param.rbi +65 -0
- data/rbi/lib/anthropic/models/beta/beta_citation_content_block_location.rbi +63 -0
- data/rbi/lib/anthropic/models/beta/beta_citation_content_block_location_param.rbi +63 -0
- data/rbi/lib/anthropic/models/beta/beta_citation_page_location.rbi +65 -0
- data/rbi/lib/anthropic/models/beta/beta_citation_page_location_param.rbi +65 -0
- data/rbi/lib/anthropic/models/beta/beta_citations_config_param.rbi +23 -0
- data/rbi/lib/anthropic/models/beta/beta_citations_delta.rbi +66 -0
- data/rbi/lib/anthropic/models/beta/beta_content_block.rbi +21 -0
- data/rbi/lib/anthropic/models/beta/beta_content_block_param.rbi +21 -0
- data/rbi/lib/anthropic/models/beta/beta_content_block_source.rbi +74 -0
- data/rbi/lib/anthropic/models/beta/beta_content_block_source_content.rbi +19 -0
- data/rbi/lib/anthropic/models/beta/beta_image_block_param.rbi +68 -0
- data/rbi/lib/anthropic/models/beta/beta_input_json_delta.rbi +23 -0
- data/rbi/lib/anthropic/models/beta/beta_message.rbi +180 -0
- data/rbi/lib/anthropic/models/beta/beta_message_delta_usage.rbi +21 -0
- data/rbi/lib/anthropic/models/beta/beta_message_param.rbi +126 -0
- data/rbi/lib/anthropic/models/beta/beta_message_tokens_count.rbi +22 -0
- data/rbi/lib/anthropic/models/beta/beta_metadata.rbi +25 -0
- data/rbi/lib/anthropic/models/beta/beta_model_info.rbi +38 -0
- data/rbi/lib/anthropic/models/beta/beta_plain_text_source.rbi +26 -0
- data/rbi/lib/anthropic/models/beta/beta_raw_content_block_delta.rbi +21 -0
- data/rbi/lib/anthropic/models/beta/beta_raw_content_block_delta_event.rbi +65 -0
- data/rbi/lib/anthropic/models/beta/beta_raw_content_block_start_event.rbi +74 -0
- data/rbi/lib/anthropic/models/beta/beta_raw_content_block_stop_event.rbi +23 -0
- data/rbi/lib/anthropic/models/beta/beta_raw_message_delta_event.rbi +96 -0
- data/rbi/lib/anthropic/models/beta/beta_raw_message_start_event.rbi +29 -0
- data/rbi/lib/anthropic/models/beta/beta_raw_message_stop_event.rbi +20 -0
- data/rbi/lib/anthropic/models/beta/beta_raw_message_stream_event.rbi +21 -0
- data/rbi/lib/anthropic/models/beta/beta_redacted_thinking_block.rbi +23 -0
- data/rbi/lib/anthropic/models/beta/beta_redacted_thinking_block_param.rbi +23 -0
- data/rbi/lib/anthropic/models/beta/beta_signature_delta.rbi +23 -0
- data/rbi/lib/anthropic/models/beta/beta_stop_reason.rbi +24 -0
- data/rbi/lib/anthropic/models/beta/beta_text_block.rbi +76 -0
- data/rbi/lib/anthropic/models/beta/beta_text_block_param.rbi +84 -0
- data/rbi/lib/anthropic/models/beta/beta_text_citation.rbi +21 -0
- data/rbi/lib/anthropic/models/beta/beta_text_citation_param.rbi +21 -0
- data/rbi/lib/anthropic/models/beta/beta_text_delta.rbi +23 -0
- data/rbi/lib/anthropic/models/beta/beta_thinking_block.rbi +26 -0
- data/rbi/lib/anthropic/models/beta/beta_thinking_block_param.rbi +26 -0
- data/rbi/lib/anthropic/models/beta/beta_thinking_config_disabled.rbi +20 -0
- data/rbi/lib/anthropic/models/beta/beta_thinking_config_enabled.rbi +32 -0
- data/rbi/lib/anthropic/models/beta/beta_thinking_config_param.rbi +30 -0
- data/rbi/lib/anthropic/models/beta/beta_thinking_delta.rbi +23 -0
- data/rbi/lib/anthropic/models/beta/beta_tool.rbi +112 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_bash_20241022.rbi +49 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_bash_20250124.rbi +49 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_choice.rbi +23 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_choice_any.rbi +31 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_choice_auto.rbi +31 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_choice_none.rbi +21 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_choice_tool.rbi +37 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_computer_use_20241022.rbi +77 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_computer_use_20250124.rbi +77 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_result_block_param.rbi +129 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_text_editor_20241022.rbi +49 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_text_editor_20250124.rbi +49 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_union.rbi +21 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_use_block.rbi +29 -0
- data/rbi/lib/anthropic/models/beta/beta_tool_use_block_param.rbi +60 -0
- data/rbi/lib/anthropic/models/beta/beta_url_image_source.rbi +23 -0
- data/rbi/lib/anthropic/models/beta/beta_url_pdf_source.rbi +23 -0
- data/rbi/lib/anthropic/models/beta/beta_usage.rbi +52 -0
- data/rbi/lib/anthropic/models/beta/message_count_tokens_params.rbi +409 -0
- data/rbi/lib/anthropic/models/beta/message_create_params.rbi +489 -0
- data/rbi/lib/anthropic/models/beta/messages/batch_cancel_params.rbi +41 -0
- data/rbi/lib/anthropic/models/beta/messages/batch_create_params.rbi +572 -0
- data/rbi/lib/anthropic/models/beta/messages/batch_delete_params.rbi +41 -0
- data/rbi/lib/anthropic/models/beta/messages/batch_list_params.rbi +72 -0
- data/rbi/lib/anthropic/models/beta/messages/batch_results_params.rbi +41 -0
- data/rbi/lib/anthropic/models/beta/messages/batch_retrieve_params.rbi +41 -0
- data/rbi/lib/anthropic/models/beta/messages/beta_deleted_message_batch.rbi +27 -0
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch.rbi +148 -0
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch_canceled_result.rbi +20 -0
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch_errored_result.rbi +29 -0
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch_expired_result.rbi +20 -0
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch_individual_response.rbi +68 -0
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch_request_counts.rbi +63 -0
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch_result.rbi +26 -0
- data/rbi/lib/anthropic/models/beta/messages/beta_message_batch_succeeded_result.rbi +29 -0
- data/rbi/lib/anthropic/models/beta/model_list_params.rbi +59 -0
- data/rbi/lib/anthropic/models/beta/model_retrieve_params.rbi +21 -0
- data/rbi/lib/anthropic/models/beta_api_error.rbi +19 -0
- data/rbi/lib/anthropic/models/beta_authentication_error.rbi +19 -0
- data/rbi/lib/anthropic/models/beta_billing_error.rbi +19 -0
- data/rbi/lib/anthropic/models/beta_error.rbi +17 -0
- data/rbi/lib/anthropic/models/beta_error_response.rbi +68 -0
- data/rbi/lib/anthropic/models/beta_gateway_timeout_error.rbi +19 -0
- data/rbi/lib/anthropic/models/beta_invalid_request_error.rbi +19 -0
- data/rbi/lib/anthropic/models/beta_not_found_error.rbi +19 -0
- data/rbi/lib/anthropic/models/beta_overloaded_error.rbi +19 -0
- data/rbi/lib/anthropic/models/beta_permission_error.rbi +19 -0
- data/rbi/lib/anthropic/models/beta_rate_limit_error.rbi +19 -0
- data/rbi/lib/anthropic/models/billing_error.rbi +19 -0
- data/rbi/lib/anthropic/models/cache_control_ephemeral.rbi +16 -0
- data/rbi/lib/anthropic/models/citation_char_location.rbi +61 -0
- data/rbi/lib/anthropic/models/citation_char_location_param.rbi +61 -0
- data/rbi/lib/anthropic/models/citation_content_block_location.rbi +59 -0
- data/rbi/lib/anthropic/models/citation_content_block_location_param.rbi +59 -0
- data/rbi/lib/anthropic/models/citation_page_location.rbi +61 -0
- data/rbi/lib/anthropic/models/citation_page_location_param.rbi +61 -0
- data/rbi/lib/anthropic/models/citations_config_param.rbi +19 -0
- data/rbi/lib/anthropic/models/citations_delta.rbi +62 -0
- data/rbi/lib/anthropic/models/completion.rbi +65 -0
- data/rbi/lib/anthropic/models/completion_create_params.rbi +142 -0
- data/rbi/lib/anthropic/models/content_block.rbi +17 -0
- data/rbi/lib/anthropic/models/content_block_param.rbi +17 -0
- data/rbi/lib/anthropic/models/content_block_source.rbi +56 -0
- data/rbi/lib/anthropic/models/content_block_source_content.rbi +12 -0
- data/rbi/lib/anthropic/models/document_block_param.rbi +97 -0
- data/rbi/lib/anthropic/models/error_object.rbi +17 -0
- data/rbi/lib/anthropic/models/error_response.rbi +68 -0
- data/rbi/lib/anthropic/models/gateway_timeout_error.rbi +19 -0
- data/rbi/lib/anthropic/models/image_block_param.rbi +57 -0
- data/rbi/lib/anthropic/models/input_json_delta.rbi +19 -0
- data/rbi/lib/anthropic/models/invalid_request_error.rbi +19 -0
- data/rbi/lib/anthropic/models/message.rbi +176 -0
- data/rbi/lib/anthropic/models/message_count_tokens_params.rbi +363 -0
- data/rbi/lib/anthropic/models/message_count_tokens_tool.rbi +17 -0
- data/rbi/lib/anthropic/models/message_create_params.rbi +453 -0
- data/rbi/lib/anthropic/models/message_delta_usage.rbi +17 -0
- data/rbi/lib/anthropic/models/message_param.rbi +121 -0
- data/rbi/lib/anthropic/models/message_tokens_count.rbi +18 -0
- data/rbi/lib/anthropic/models/messages/batch_cancel_params.rbi +21 -0
- data/rbi/lib/anthropic/models/messages/batch_create_params.rbi +535 -0
- data/rbi/lib/anthropic/models/messages/batch_delete_params.rbi +21 -0
- data/rbi/lib/anthropic/models/messages/batch_list_params.rbi +59 -0
- data/rbi/lib/anthropic/models/messages/batch_results_params.rbi +21 -0
- data/rbi/lib/anthropic/models/messages/batch_retrieve_params.rbi +21 -0
- data/rbi/lib/anthropic/models/messages/deleted_message_batch.rbi +25 -0
- data/rbi/lib/anthropic/models/messages/message_batch.rbi +143 -0
- data/rbi/lib/anthropic/models/messages/message_batch_canceled_result.rbi +20 -0
- data/rbi/lib/anthropic/models/messages/message_batch_errored_result.rbi +29 -0
- data/rbi/lib/anthropic/models/messages/message_batch_expired_result.rbi +20 -0
- data/rbi/lib/anthropic/models/messages/message_batch_individual_response.rbi +68 -0
- data/rbi/lib/anthropic/models/messages/message_batch_request_counts.rbi +63 -0
- data/rbi/lib/anthropic/models/messages/message_batch_result.rbi +26 -0
- data/rbi/lib/anthropic/models/messages/message_batch_succeeded_result.rbi +29 -0
- data/rbi/lib/anthropic/models/metadata.rbi +21 -0
- data/rbi/lib/anthropic/models/model.rbi +54 -0
- data/rbi/lib/anthropic/models/model_info.rbi +34 -0
- data/rbi/lib/anthropic/models/model_list_params.rbi +57 -0
- data/rbi/lib/anthropic/models/model_retrieve_params.rbi +19 -0
- data/rbi/lib/anthropic/models/not_found_error.rbi +19 -0
- data/rbi/lib/anthropic/models/overloaded_error.rbi +19 -0
- data/rbi/lib/anthropic/models/permission_error.rbi +19 -0
- data/rbi/lib/anthropic/models/plain_text_source.rbi +22 -0
- data/rbi/lib/anthropic/models/rate_limit_error.rbi +19 -0
- data/rbi/lib/anthropic/models/raw_content_block_delta.rbi +17 -0
- data/rbi/lib/anthropic/models/raw_content_block_delta_event.rbi +61 -0
- data/rbi/lib/anthropic/models/raw_content_block_start_event.rbi +70 -0
- data/rbi/lib/anthropic/models/raw_content_block_stop_event.rbi +19 -0
- data/rbi/lib/anthropic/models/raw_message_delta_event.rbi +81 -0
- data/rbi/lib/anthropic/models/raw_message_start_event.rbi +25 -0
- data/rbi/lib/anthropic/models/raw_message_stop_event.rbi +16 -0
- data/rbi/lib/anthropic/models/raw_message_stream_event.rbi +17 -0
- data/rbi/lib/anthropic/models/redacted_thinking_block.rbi +19 -0
- data/rbi/lib/anthropic/models/redacted_thinking_block_param.rbi +19 -0
- data/rbi/lib/anthropic/models/signature_delta.rbi +19 -0
- data/rbi/lib/anthropic/models/stop_reason.rbi +20 -0
- data/rbi/lib/anthropic/models/text_block.rbi +72 -0
- data/rbi/lib/anthropic/models/text_block_param.rbi +80 -0
- data/rbi/lib/anthropic/models/text_citation.rbi +17 -0
- data/rbi/lib/anthropic/models/text_citation_param.rbi +17 -0
- data/rbi/lib/anthropic/models/text_delta.rbi +19 -0
- data/rbi/lib/anthropic/models/thinking_block.rbi +22 -0
- data/rbi/lib/anthropic/models/thinking_block_param.rbi +22 -0
- data/rbi/lib/anthropic/models/thinking_config_disabled.rbi +16 -0
- data/rbi/lib/anthropic/models/thinking_config_enabled.rbi +28 -0
- data/rbi/lib/anthropic/models/thinking_config_param.rbi +21 -0
- data/rbi/lib/anthropic/models/thinking_delta.rbi +19 -0
- data/rbi/lib/anthropic/models/tool.rbi +88 -0
- data/rbi/lib/anthropic/models/tool_bash_20250124.rbi +43 -0
- data/rbi/lib/anthropic/models/tool_choice.rbi +19 -0
- data/rbi/lib/anthropic/models/tool_choice_any.rbi +27 -0
- data/rbi/lib/anthropic/models/tool_choice_auto.rbi +27 -0
- data/rbi/lib/anthropic/models/tool_choice_none.rbi +17 -0
- data/rbi/lib/anthropic/models/tool_choice_tool.rbi +33 -0
- data/rbi/lib/anthropic/models/tool_result_block_param.rbi +102 -0
- data/rbi/lib/anthropic/models/tool_text_editor_20250124.rbi +43 -0
- data/rbi/lib/anthropic/models/tool_union.rbi +17 -0
- data/rbi/lib/anthropic/models/tool_use_block.rbi +25 -0
- data/rbi/lib/anthropic/models/tool_use_block_param.rbi +56 -0
- data/rbi/lib/anthropic/models/url_image_source.rbi +19 -0
- data/rbi/lib/anthropic/models/url_pdf_source.rbi +19 -0
- data/rbi/lib/anthropic/models/usage.rbi +47 -0
- data/rbi/lib/anthropic/request_options.rbi +46 -0
- data/rbi/lib/anthropic/resources/beta/messages/batches.rbi +164 -0
- data/rbi/lib/anthropic/resources/beta/messages.rbi +823 -0
- data/rbi/lib/anthropic/resources/beta/models.rbi +55 -0
- data/rbi/lib/anthropic/resources/beta.rbi +17 -0
- data/rbi/lib/anthropic/resources/completions.rbi +190 -0
- data/rbi/lib/anthropic/resources/messages/batches.rbi +142 -0
- data/rbi/lib/anthropic/resources/messages.rbi +800 -0
- data/rbi/lib/anthropic/resources/models.rbi +53 -0
- data/rbi/lib/anthropic/version.rbi +5 -0
- data/rbi/lib/anthropic/vertex/client.rbi +56 -0
- data/sig/anthropic/bedrock/client.rbs +41 -0
- data/sig/anthropic/client.rbs +39 -0
- data/sig/anthropic/errors.rbs +101 -0
- data/sig/anthropic/internal/jsonl_stream.rbs +9 -0
- data/sig/anthropic/internal/page.rbs +17 -0
- data/sig/anthropic/internal/stream.rbs +9 -0
- data/sig/anthropic/internal/transport/base_client.rbs +110 -0
- data/sig/anthropic/internal/transport/pooled_net_requester.rbs +41 -0
- data/sig/anthropic/internal/type/array_of.rbs +41 -0
- data/sig/anthropic/internal/type/base_model.rbs +82 -0
- data/sig/anthropic/internal/type/base_page.rbs +24 -0
- data/sig/anthropic/internal/type/base_stream.rbs +31 -0
- data/sig/anthropic/internal/type/boolean.rbs +23 -0
- data/sig/anthropic/internal/type/converter.rbs +50 -0
- data/sig/anthropic/internal/type/enum.rbs +27 -0
- data/sig/anthropic/internal/type/hash_of.rbs +41 -0
- data/sig/anthropic/internal/type/io_like.rbs +23 -0
- data/sig/anthropic/internal/type/request_parameters.rbs +15 -0
- data/sig/anthropic/internal/type/union.rbs +45 -0
- data/sig/anthropic/internal/type/unknown.rbs +23 -0
- data/sig/anthropic/internal/util.rbs +154 -0
- data/sig/anthropic/internal.rbs +5 -0
- data/sig/anthropic/models/anthropic_beta.rbs +36 -0
- data/sig/anthropic/models/api_error_object.rbs +15 -0
- data/sig/anthropic/models/authentication_error.rbs +15 -0
- data/sig/anthropic/models/base64_image_source.rbs +40 -0
- data/sig/anthropic/models/base64_pdf_source.rbs +22 -0
- data/sig/anthropic/models/beta/beta_base64_image_source.rbs +44 -0
- data/sig/anthropic/models/beta/beta_base64_pdf_block.rbs +58 -0
- data/sig/anthropic/models/beta/beta_base64_pdf_source.rbs +26 -0
- data/sig/anthropic/models/beta/beta_cache_control_ephemeral.rbs +17 -0
- data/sig/anthropic/models/beta/beta_citation_char_location.rbs +42 -0
- data/sig/anthropic/models/beta/beta_citation_char_location_param.rbs +42 -0
- data/sig/anthropic/models/beta/beta_citation_content_block_location.rbs +42 -0
- data/sig/anthropic/models/beta/beta_citation_content_block_location_param.rbs +42 -0
- data/sig/anthropic/models/beta/beta_citation_page_location.rbs +42 -0
- data/sig/anthropic/models/beta/beta_citation_page_location_param.rbs +42 -0
- data/sig/anthropic/models/beta/beta_citations_config_param.rbs +19 -0
- data/sig/anthropic/models/beta/beta_citations_delta.rbs +37 -0
- data/sig/anthropic/models/beta/beta_content_block.rbs +19 -0
- data/sig/anthropic/models/beta/beta_content_block_param.rbs +22 -0
- data/sig/anthropic/models/beta/beta_content_block_source.rbs +41 -0
- data/sig/anthropic/models/beta/beta_content_block_source_content.rbs +17 -0
- data/sig/anthropic/models/beta/beta_image_block_param.rbs +40 -0
- data/sig/anthropic/models/beta/beta_input_json_delta.rbs +20 -0
- data/sig/anthropic/models/beta/beta_message.rbs +50 -0
- data/sig/anthropic/models/beta/beta_message_delta_usage.rbs +17 -0
- data/sig/anthropic/models/beta/beta_message_param.rbs +51 -0
- data/sig/anthropic/models/beta/beta_message_tokens_count.rbs +17 -0
- data/sig/anthropic/models/beta/beta_metadata.rbs +17 -0
- data/sig/anthropic/models/beta/beta_model_info.rbs +29 -0
- data/sig/anthropic/models/beta/beta_plain_text_source.rbs +26 -0
- data/sig/anthropic/models/beta/beta_raw_content_block_delta.rbs +20 -0
- data/sig/anthropic/models/beta/beta_raw_content_block_delta_event.rbs +30 -0
- data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +42 -0
- data/sig/anthropic/models/beta/beta_raw_content_block_stop_event.rbs +20 -0
- data/sig/anthropic/models/beta/beta_raw_message_delta_event.rbs +49 -0
- data/sig/anthropic/models/beta/beta_raw_message_start_event.rbs +23 -0
- data/sig/anthropic/models/beta/beta_raw_message_stop_event.rbs +17 -0
- data/sig/anthropic/models/beta/beta_raw_message_stream_event.rbs +21 -0
- data/sig/anthropic/models/beta/beta_redacted_thinking_block.rbs +20 -0
- data/sig/anthropic/models/beta/beta_redacted_thinking_block_param.rbs +20 -0
- data/sig/anthropic/models/beta/beta_signature_delta.rbs +19 -0
- data/sig/anthropic/models/beta/beta_stop_reason.rbs +21 -0
- data/sig/anthropic/models/beta/beta_text_block.rbs +30 -0
- data/sig/anthropic/models/beta/beta_text_block_param.rbs +34 -0
- data/sig/anthropic/models/beta/beta_text_citation.rbs +18 -0
- data/sig/anthropic/models/beta/beta_text_citation_param.rbs +18 -0
- data/sig/anthropic/models/beta/beta_text_delta.rbs +19 -0
- data/sig/anthropic/models/beta/beta_thinking_block.rbs +26 -0
- data/sig/anthropic/models/beta/beta_thinking_block_param.rbs +26 -0
- data/sig/anthropic/models/beta/beta_thinking_config_disabled.rbs +17 -0
- data/sig/anthropic/models/beta/beta_thinking_config_enabled.rbs +20 -0
- data/sig/anthropic/models/beta/beta_thinking_config_param.rbs +17 -0
- data/sig/anthropic/models/beta/beta_thinking_delta.rbs +19 -0
- data/sig/anthropic/models/beta/beta_tool.rbs +62 -0
- data/sig/anthropic/models/beta/beta_tool_bash_20241022.rbs +30 -0
- data/sig/anthropic/models/beta/beta_tool_bash_20250124.rbs +30 -0
- data/sig/anthropic/models/beta/beta_tool_choice.rbs +19 -0
- data/sig/anthropic/models/beta/beta_tool_choice_any.rbs +22 -0
- data/sig/anthropic/models/beta/beta_tool_choice_auto.rbs +22 -0
- data/sig/anthropic/models/beta/beta_tool_choice_none.rbs +17 -0
- data/sig/anthropic/models/beta/beta_tool_choice_tool.rbs +28 -0
- data/sig/anthropic/models/beta/beta_tool_computer_use_20241022.rbs +42 -0
- data/sig/anthropic/models/beta/beta_tool_computer_use_20250124.rbs +42 -0
- data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +69 -0
- data/sig/anthropic/models/beta/beta_tool_text_editor_20241022.rbs +30 -0
- data/sig/anthropic/models/beta/beta_tool_text_editor_20250124.rbs +30 -0
- data/sig/anthropic/models/beta/beta_tool_union.rbs +22 -0
- data/sig/anthropic/models/beta/beta_tool_use_block.rbs +29 -0
- data/sig/anthropic/models/beta/beta_tool_use_block_param.rbs +38 -0
- data/sig/anthropic/models/beta/beta_url_image_source.rbs +19 -0
- data/sig/anthropic/models/beta/beta_url_pdf_source.rbs +19 -0
- data/sig/anthropic/models/beta/beta_usage.rbs +34 -0
- data/sig/anthropic/models/beta/message_count_tokens_params.rbs +98 -0
- data/sig/anthropic/models/beta/message_create_params.rbs +119 -0
- data/sig/anthropic/models/beta/messages/batch_cancel_params.rbs +29 -0
- data/sig/anthropic/models/beta/messages/batch_create_params.rbs +161 -0
- data/sig/anthropic/models/beta/messages/batch_delete_params.rbs +29 -0
- data/sig/anthropic/models/beta/messages/batch_list_params.rbs +49 -0
- data/sig/anthropic/models/beta/messages/batch_results_params.rbs +29 -0
- data/sig/anthropic/models/beta/messages/batch_retrieve_params.rbs +29 -0
- data/sig/anthropic/models/beta/messages/beta_deleted_message_batch.rbs +20 -0
- data/sig/anthropic/models/beta/messages/beta_message_batch.rbs +70 -0
- data/sig/anthropic/models/beta/messages/beta_message_batch_canceled_result.rbs +17 -0
- data/sig/anthropic/models/beta/messages/beta_message_batch_errored_result.rbs +23 -0
- data/sig/anthropic/models/beta/messages/beta_message_batch_expired_result.rbs +17 -0
- data/sig/anthropic/models/beta/messages/beta_message_batch_individual_response.rbs +26 -0
- data/sig/anthropic/models/beta/messages/beta_message_batch_request_counts.rbs +38 -0
- data/sig/anthropic/models/beta/messages/beta_message_batch_result.rbs +19 -0
- data/sig/anthropic/models/beta/messages/beta_message_batch_succeeded_result.rbs +23 -0
- data/sig/anthropic/models/beta/model_list_params.rbs +35 -0
- data/sig/anthropic/models/beta/model_retrieve_params.rbs +17 -0
- data/sig/anthropic/models/beta_api_error.rbs +15 -0
- data/sig/anthropic/models/beta_authentication_error.rbs +16 -0
- data/sig/anthropic/models/beta_billing_error.rbs +15 -0
- data/sig/anthropic/models/beta_error.rbs +20 -0
- data/sig/anthropic/models/beta_error_response.rbs +19 -0
- data/sig/anthropic/models/beta_gateway_timeout_error.rbs +15 -0
- data/sig/anthropic/models/beta_invalid_request_error.rbs +16 -0
- data/sig/anthropic/models/beta_not_found_error.rbs +15 -0
- data/sig/anthropic/models/beta_overloaded_error.rbs +15 -0
- data/sig/anthropic/models/beta_permission_error.rbs +15 -0
- data/sig/anthropic/models/beta_rate_limit_error.rbs +15 -0
- data/sig/anthropic/models/billing_error.rbs +15 -0
- data/sig/anthropic/models/cache_control_ephemeral.rbs +13 -0
- data/sig/anthropic/models/citation_char_location.rbs +38 -0
- data/sig/anthropic/models/citation_char_location_param.rbs +38 -0
- data/sig/anthropic/models/citation_content_block_location.rbs +38 -0
- data/sig/anthropic/models/citation_content_block_location_param.rbs +38 -0
- data/sig/anthropic/models/citation_page_location.rbs +38 -0
- data/sig/anthropic/models/citation_page_location_param.rbs +38 -0
- data/sig/anthropic/models/citations_config_param.rbs +15 -0
- data/sig/anthropic/models/citations_delta.rbs +33 -0
- data/sig/anthropic/models/completion.rbs +34 -0
- data/sig/anthropic/models/completion_create_params.rbs +63 -0
- data/sig/anthropic/models/content_block.rbs +15 -0
- data/sig/anthropic/models/content_block_param.rbs +18 -0
- data/sig/anthropic/models/content_block_source.rbs +36 -0
- data/sig/anthropic/models/content_block_source_content.rbs +12 -0
- data/sig/anthropic/models/document_block_param.rbs +54 -0
- data/sig/anthropic/models/error_object.rbs +20 -0
- data/sig/anthropic/models/error_response.rbs +19 -0
- data/sig/anthropic/models/gateway_timeout_error.rbs +15 -0
- data/sig/anthropic/models/image_block_param.rbs +35 -0
- data/sig/anthropic/models/input_json_delta.rbs +15 -0
- data/sig/anthropic/models/invalid_request_error.rbs +16 -0
- data/sig/anthropic/models/message.rbs +46 -0
- data/sig/anthropic/models/message_count_tokens_params.rbs +71 -0
- data/sig/anthropic/models/message_count_tokens_tool.rbs +14 -0
- data/sig/anthropic/models/message_create_params.rbs +107 -0
- data/sig/anthropic/models/message_delta_usage.rbs +13 -0
- data/sig/anthropic/models/message_param.rbs +46 -0
- data/sig/anthropic/models/message_tokens_count.rbs +13 -0
- data/sig/anthropic/models/messages/batch_cancel_params.rbs +17 -0
- data/sig/anthropic/models/messages/batch_create_params.rbs +150 -0
- data/sig/anthropic/models/messages/batch_delete_params.rbs +17 -0
- data/sig/anthropic/models/messages/batch_list_params.rbs +35 -0
- data/sig/anthropic/models/messages/batch_results_params.rbs +17 -0
- data/sig/anthropic/models/messages/batch_retrieve_params.rbs +17 -0
- data/sig/anthropic/models/messages/deleted_message_batch.rbs +17 -0
- data/sig/anthropic/models/messages/message_batch.rbs +70 -0
- data/sig/anthropic/models/messages/message_batch_canceled_result.rbs +17 -0
- data/sig/anthropic/models/messages/message_batch_errored_result.rbs +23 -0
- data/sig/anthropic/models/messages/message_batch_expired_result.rbs +17 -0
- data/sig/anthropic/models/messages/message_batch_individual_response.rbs +26 -0
- data/sig/anthropic/models/messages/message_batch_request_counts.rbs +38 -0
- data/sig/anthropic/models/messages/message_batch_result.rbs +19 -0
- data/sig/anthropic/models/messages/message_batch_succeeded_result.rbs +23 -0
- data/sig/anthropic/models/metadata.rbs +13 -0
- data/sig/anthropic/models/model.rbs +73 -0
- data/sig/anthropic/models/model_info.rbs +25 -0
- data/sig/anthropic/models/model_list_params.rbs +33 -0
- data/sig/anthropic/models/model_retrieve_params.rbs +15 -0
- data/sig/anthropic/models/not_found_error.rbs +15 -0
- data/sig/anthropic/models/overloaded_error.rbs +15 -0
- data/sig/anthropic/models/permission_error.rbs +15 -0
- data/sig/anthropic/models/plain_text_source.rbs +22 -0
- data/sig/anthropic/models/rate_limit_error.rbs +15 -0
- data/sig/anthropic/models/raw_content_block_delta.rbs +16 -0
- data/sig/anthropic/models/raw_content_block_delta_event.rbs +26 -0
- data/sig/anthropic/models/raw_content_block_start_event.rbs +38 -0
- data/sig/anthropic/models/raw_content_block_stop_event.rbs +16 -0
- data/sig/anthropic/models/raw_message_delta_event.rbs +42 -0
- data/sig/anthropic/models/raw_message_start_event.rbs +19 -0
- data/sig/anthropic/models/raw_message_stop_event.rbs +13 -0
- data/sig/anthropic/models/raw_message_stream_event.rbs +17 -0
- data/sig/anthropic/models/redacted_thinking_block.rbs +15 -0
- data/sig/anthropic/models/redacted_thinking_block_param.rbs +16 -0
- data/sig/anthropic/models/signature_delta.rbs +15 -0
- data/sig/anthropic/models/stop_reason.rbs +16 -0
- data/sig/anthropic/models/text_block.rbs +26 -0
- data/sig/anthropic/models/text_block_param.rbs +30 -0
- data/sig/anthropic/models/text_citation.rbs +14 -0
- data/sig/anthropic/models/text_citation_param.rbs +14 -0
- data/sig/anthropic/models/text_delta.rbs +15 -0
- data/sig/anthropic/models/thinking_block.rbs +22 -0
- data/sig/anthropic/models/thinking_block_param.rbs +22 -0
- data/sig/anthropic/models/thinking_config_disabled.rbs +13 -0
- data/sig/anthropic/models/thinking_config_enabled.rbs +15 -0
- data/sig/anthropic/models/thinking_config_param.rbs +13 -0
- data/sig/anthropic/models/thinking_delta.rbs +15 -0
- data/sig/anthropic/models/tool.rbs +44 -0
- data/sig/anthropic/models/tool_bash_20250124.rbs +26 -0
- data/sig/anthropic/models/tool_choice.rbs +15 -0
- data/sig/anthropic/models/tool_choice_any.rbs +17 -0
- data/sig/anthropic/models/tool_choice_auto.rbs +17 -0
- data/sig/anthropic/models/tool_choice_none.rbs +13 -0
- data/sig/anthropic/models/tool_choice_tool.rbs +24 -0
- data/sig/anthropic/models/tool_result_block_param.rbs +64 -0
- data/sig/anthropic/models/tool_text_editor_20250124.rbs +26 -0
- data/sig/anthropic/models/tool_union.rbs +14 -0
- data/sig/anthropic/models/tool_use_block.rbs +25 -0
- data/sig/anthropic/models/tool_use_block_param.rbs +34 -0
- data/sig/anthropic/models/url_image_source.rbs +15 -0
- data/sig/anthropic/models/url_pdf_source.rbs +15 -0
- data/sig/anthropic/models/usage.rbs +30 -0
- data/sig/anthropic/request_options.rbs +34 -0
- data/sig/anthropic/resources/beta/messages/batches.rbs +49 -0
- data/sig/anthropic/resources/beta/messages.rbs +56 -0
- data/sig/anthropic/resources/beta/models.rbs +21 -0
- data/sig/anthropic/resources/beta.rbs +11 -0
- data/sig/anthropic/resources/completions.rbs +31 -0
- data/sig/anthropic/resources/messages/batches.rbs +41 -0
- data/sig/anthropic/resources/messages.rbs +51 -0
- data/sig/anthropic/resources/models.rbs +19 -0
- data/sig/anthropic/version.rbs +3 -0
- data/sig/anthropic/vertex/client.rbs +34 -0
- metadata +746 -0
@@ -0,0 +1,210 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Vertex
|
5
|
+
class Client < Anthropic::Client
|
6
|
+
DEFAULT_VERSION = "vertex-2023-10-16"
|
7
|
+
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :region
|
10
|
+
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :project_id
|
13
|
+
|
14
|
+
# @return [Anthropic::Resources::Messages]
|
15
|
+
attr_reader :messages
|
16
|
+
|
17
|
+
# @return [Anthropic::Resources::Beta]
|
18
|
+
attr_reader :beta
|
19
|
+
|
20
|
+
# Creates and returns a new client for interacting with the GCP Vertex API for Anthropic models.
|
21
|
+
#
|
22
|
+
# GCP credentials are resolved according to Application Default Credentials, described at
|
23
|
+
# https://cloud.google.com/docs/authentication/provide-credentials-adc
|
24
|
+
#
|
25
|
+
# @param region [String, nil] Enforce the GCP Region to use. If unset, the region may be set with the CLOUD_ML_REGION environment variable.
|
26
|
+
#
|
27
|
+
# @param project_id [String, nil] Enforce the GCP Project ID to use. If unset, the project_id may be set with the ANTHROPIC_VERTEX_PROJECT_ID environment variable.
|
28
|
+
#
|
29
|
+
# @param base_url [String, nil] Override the default base URL for the API, e.g., `"https://api.example.com/v2/"`
|
30
|
+
#
|
31
|
+
# @param max_retries [Integer] The maximum number of times to retry a request if it fails
|
32
|
+
#
|
33
|
+
# @param timeout [Float] The number of seconds to wait for a response before timing out
|
34
|
+
#
|
35
|
+
# @param initial_retry_delay [Float] The number of seconds to wait before retrying a request
|
36
|
+
#
|
37
|
+
# @param max_retry_delay [Float] The maximum number of seconds to wait before retrying a request
|
38
|
+
#
|
39
|
+
def initialize(
|
40
|
+
region: ENV["CLOUD_ML_REGION"],
|
41
|
+
project_id: ENV["ANTHROPIC_VERTEX_PROJECT_ID"],
|
42
|
+
base_url: nil,
|
43
|
+
max_retries: DEFAULT_MAX_RETRIES,
|
44
|
+
timeout: DEFAULT_TIMEOUT_IN_SECONDS,
|
45
|
+
initial_retry_delay: DEFAULT_INITIAL_RETRY_DELAY,
|
46
|
+
max_retry_delay: DEFAULT_MAX_RETRY_DELAY
|
47
|
+
)
|
48
|
+
begin
|
49
|
+
require("googleauth")
|
50
|
+
rescue LoadError
|
51
|
+
raise <<~MSG
|
52
|
+
|
53
|
+
In order to access Anthropic models on Vertex you must require the `googleauth` gem.
|
54
|
+
You can install it by adding the following to your Gemfile:
|
55
|
+
|
56
|
+
gem "googleauth"
|
57
|
+
|
58
|
+
and then running `bundle install`.
|
59
|
+
|
60
|
+
Alternatively, if you are not using Bundler, simply run:
|
61
|
+
|
62
|
+
gem install googleauth
|
63
|
+
MSG
|
64
|
+
end
|
65
|
+
|
66
|
+
if region.to_s.empty?
|
67
|
+
raise ArgumentError,
|
68
|
+
"No region was given. The client should be instantiated with the `region` argument or the `CLOUD_ML_REGION` environment variable should be set."
|
69
|
+
end
|
70
|
+
@region = region
|
71
|
+
|
72
|
+
if project_id.to_s.empty?
|
73
|
+
raise ArgumentError,
|
74
|
+
"No project_id was given and it could not be resolved from credentials. The client should be instantiated with the `project_id` argument or the `ANTHROPIC_VERTEX_PROJECT_ID` environment variable should be set."
|
75
|
+
|
76
|
+
end
|
77
|
+
@project_id = project_id
|
78
|
+
|
79
|
+
base_url ||= ENV.fetch("ANTHROPIC_VERTEX_BASE_URL", "https://#{@region}-aiplatform.googleapis.com/v1")
|
80
|
+
|
81
|
+
super(
|
82
|
+
base_url: base_url,
|
83
|
+
timeout: timeout,
|
84
|
+
max_retries: max_retries,
|
85
|
+
initial_retry_delay: initial_retry_delay,
|
86
|
+
max_retry_delay: max_retry_delay,
|
87
|
+
)
|
88
|
+
|
89
|
+
@messages = Anthropic::Resources::Messages.new(client: self)
|
90
|
+
@beta = Anthropic::Resources::Beta.new(client: self)
|
91
|
+
end
|
92
|
+
|
93
|
+
# @private
|
94
|
+
#
|
95
|
+
# @param req [Hash{Symbol=>Object}] .
|
96
|
+
#
|
97
|
+
# @option req [Symbol] :method
|
98
|
+
#
|
99
|
+
# @option req [String, Array<String>] :path
|
100
|
+
#
|
101
|
+
# @option req [Hash{String=>Array<String>, String, nil}, nil] :query
|
102
|
+
#
|
103
|
+
# @option req [Hash{String=>String, nil}, nil] :headers
|
104
|
+
#
|
105
|
+
# @option req [Object, nil] :body
|
106
|
+
#
|
107
|
+
# @option req [Symbol, nil] :unwrap
|
108
|
+
#
|
109
|
+
# @option req [Class, nil] :page
|
110
|
+
#
|
111
|
+
# @option req [Anthropic::Converter, Class, nil] :model
|
112
|
+
#
|
113
|
+
# @param opts [Hash{Symbol=>Object}] .
|
114
|
+
#
|
115
|
+
# @option opts [String, nil] :idempotency_key
|
116
|
+
#
|
117
|
+
# @option opts [Hash{String=>Array<String>, String, nil}, nil] :extra_query
|
118
|
+
#
|
119
|
+
# @option opts [Hash{String=>String, nil}, nil] :extra_headers
|
120
|
+
#
|
121
|
+
# @option opts [Hash{Symbol=>Object}, nil] :extra_body
|
122
|
+
#
|
123
|
+
# @option opts [Integer, nil] :max_retries
|
124
|
+
#
|
125
|
+
# @option opts [Float, nil] :timeout
|
126
|
+
#
|
127
|
+
# @return [Hash{Symbol=>Object}]
|
128
|
+
#
|
129
|
+
private def build_request(req, opts)
|
130
|
+
fit_req_to_vertex_specs!(req)
|
131
|
+
|
132
|
+
request_input = super
|
133
|
+
|
134
|
+
unless request_input[:headers]["Authorization"]
|
135
|
+
authorization = Google::Auth.get_application_default(["https://www.googleapis.com/auth/cloud-platform"])
|
136
|
+
request_input[:headers] = authorization.apply(request_input[:headers])
|
137
|
+
end
|
138
|
+
|
139
|
+
request_input
|
140
|
+
end
|
141
|
+
|
142
|
+
# @private
|
143
|
+
#
|
144
|
+
# Overrides request components for Vertex-specific request-shape requirements.
|
145
|
+
#
|
146
|
+
# @param request_components [Hash{Symbol=>Object}] .
|
147
|
+
#
|
148
|
+
# @option request_components [Symbol] :method
|
149
|
+
#
|
150
|
+
# @option request_components [String, Array<String>] :path
|
151
|
+
#
|
152
|
+
# @option request_components [Hash{String=>Array<String>, String, nil}, nil] :query
|
153
|
+
#
|
154
|
+
# @option request_components [Hash{String=>String, nil}, nil] :headers
|
155
|
+
#
|
156
|
+
# @option request_components [Object, nil] :body
|
157
|
+
#
|
158
|
+
# @option request_components [Symbol, nil] :unwrap
|
159
|
+
#
|
160
|
+
# @option request_components [Class, nil] :page
|
161
|
+
#
|
162
|
+
# @option request_components [Anthropic::Converter, Class, nil] :model
|
163
|
+
#
|
164
|
+
# @return [Hash{Symbol=>Object}]
|
165
|
+
def fit_req_to_vertex_specs!(request_components)
|
166
|
+
if (body = request_components[:body]).is_a?(Hash)
|
167
|
+
body[:anthropic_version] ||= DEFAULT_VERSION
|
168
|
+
|
169
|
+
if (anthropic_beta = body.delete(:"anthropic-beta"))
|
170
|
+
request_components[:headers] ||= {}
|
171
|
+
request_components[:headers]["anthropic-beta"] = anthropic_beta.join(",")
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
if %w[
|
176
|
+
v1/messages
|
177
|
+
v1/messages?beta=true
|
178
|
+
].include?(request_components[:path]) && request_components[:method] == :post
|
179
|
+
|
180
|
+
unless body.is_a?(Hash)
|
181
|
+
raise Anthropic::Error, "Expected json data to be a hash for post /v1/messages"
|
182
|
+
end
|
183
|
+
|
184
|
+
model = body.delete(:model)
|
185
|
+
specifier = body[:stream] ? "streamRawPredict" : "rawPredict"
|
186
|
+
|
187
|
+
request_components[:path] =
|
188
|
+
"projects/#{@project_id}/locations/#{region}/publishers/anthropic/models/#{model}:#{specifier}"
|
189
|
+
|
190
|
+
end
|
191
|
+
|
192
|
+
if %w[
|
193
|
+
v1/messages/count_tokens
|
194
|
+
v1/messages/count_tokens?beta=true
|
195
|
+
].include?(request_components[:path]) &&
|
196
|
+
request_components[:method] == :post
|
197
|
+
request_components[:path] =
|
198
|
+
"projects/#{@project_id}/locations/#{region}/publishers/anthropic/models/count-tokens:rawPredict"
|
199
|
+
|
200
|
+
end
|
201
|
+
|
202
|
+
if request_components[:path].start_with?("v1/messages/batches/")
|
203
|
+
raise AnthropicError("The Batch API is not supported in the Vertex client yet")
|
204
|
+
end
|
205
|
+
|
206
|
+
request_components
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
data/lib/anthropic.rb
ADDED
@@ -0,0 +1,265 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Standard libraries.
|
4
|
+
require "English"
|
5
|
+
require "cgi"
|
6
|
+
require "date"
|
7
|
+
require "erb"
|
8
|
+
require "etc"
|
9
|
+
require "json"
|
10
|
+
require "net/http"
|
11
|
+
require "pathname"
|
12
|
+
require "rbconfig"
|
13
|
+
require "securerandom"
|
14
|
+
require "set"
|
15
|
+
require "stringio"
|
16
|
+
require "time"
|
17
|
+
require "uri"
|
18
|
+
|
19
|
+
# We already ship the preferred sorbet manifests in the package itself.
|
20
|
+
# `tapioca` currently does not offer us a way to opt out of unnecessary compilation.
|
21
|
+
if Object.const_defined?(:Tapioca) && caller.chain([$PROGRAM_NAME]).chain(ARGV).grep(/tapioca/)
|
22
|
+
Warning.warn(
|
23
|
+
<<~WARN
|
24
|
+
\n
|
25
|
+
⚠️ skipped loading of "anthropic" gem under `tapioca`.
|
26
|
+
|
27
|
+
This message is normal and expected if you are running a `tapioca` command, and does not impact `.rbi` generation.
|
28
|
+
\n
|
29
|
+
WARN
|
30
|
+
)
|
31
|
+
return
|
32
|
+
end
|
33
|
+
|
34
|
+
# Gems.
|
35
|
+
require "connection_pool"
|
36
|
+
|
37
|
+
# Package files.
|
38
|
+
require_relative "anthropic/version"
|
39
|
+
require_relative "anthropic/internal/util"
|
40
|
+
require_relative "anthropic/internal/type/converter"
|
41
|
+
require_relative "anthropic/internal/type/unknown"
|
42
|
+
require_relative "anthropic/internal/type/boolean"
|
43
|
+
require_relative "anthropic/internal/type/io_like"
|
44
|
+
require_relative "anthropic/internal/type/enum"
|
45
|
+
require_relative "anthropic/internal/type/union"
|
46
|
+
require_relative "anthropic/internal/type/array_of"
|
47
|
+
require_relative "anthropic/internal/type/hash_of"
|
48
|
+
require_relative "anthropic/internal/type/base_model"
|
49
|
+
require_relative "anthropic/internal/type/base_page"
|
50
|
+
require_relative "anthropic/internal/type/base_stream"
|
51
|
+
require_relative "anthropic/internal/type/request_parameters"
|
52
|
+
require_relative "anthropic/internal"
|
53
|
+
require_relative "anthropic/request_options"
|
54
|
+
require_relative "anthropic/errors"
|
55
|
+
require_relative "anthropic/internal/transport/base_client"
|
56
|
+
require_relative "anthropic/internal/transport/pooled_net_requester"
|
57
|
+
require_relative "anthropic/client"
|
58
|
+
require_relative "anthropic/bedrock/client"
|
59
|
+
require_relative "anthropic/vertex/client"
|
60
|
+
require_relative "anthropic/internal/stream"
|
61
|
+
require_relative "anthropic/internal/jsonl_stream"
|
62
|
+
require_relative "anthropic/internal/page"
|
63
|
+
require_relative "anthropic/models/anthropic_beta"
|
64
|
+
require_relative "anthropic/models/api_error_object"
|
65
|
+
require_relative "anthropic/models/authentication_error"
|
66
|
+
require_relative "anthropic/models/base64_image_source"
|
67
|
+
require_relative "anthropic/models/base64_pdf_source"
|
68
|
+
require_relative "anthropic/models/beta/beta_base64_image_source"
|
69
|
+
require_relative "anthropic/models/beta/beta_base64_pdf_block"
|
70
|
+
require_relative "anthropic/models/beta/beta_base64_pdf_source"
|
71
|
+
require_relative "anthropic/models/beta/beta_cache_control_ephemeral"
|
72
|
+
require_relative "anthropic/models/beta/beta_citation_char_location"
|
73
|
+
require_relative "anthropic/models/beta/beta_citation_char_location_param"
|
74
|
+
require_relative "anthropic/models/beta/beta_citation_content_block_location"
|
75
|
+
require_relative "anthropic/models/beta/beta_citation_content_block_location_param"
|
76
|
+
require_relative "anthropic/models/beta/beta_citation_page_location"
|
77
|
+
require_relative "anthropic/models/beta/beta_citation_page_location_param"
|
78
|
+
require_relative "anthropic/models/beta/beta_citations_config_param"
|
79
|
+
require_relative "anthropic/models/beta/beta_citations_delta"
|
80
|
+
require_relative "anthropic/models/beta/beta_content_block"
|
81
|
+
require_relative "anthropic/models/beta/beta_content_block_param"
|
82
|
+
require_relative "anthropic/models/beta/beta_content_block_source"
|
83
|
+
require_relative "anthropic/models/beta/beta_content_block_source_content"
|
84
|
+
require_relative "anthropic/models/beta/beta_image_block_param"
|
85
|
+
require_relative "anthropic/models/beta/beta_input_json_delta"
|
86
|
+
require_relative "anthropic/models/beta/beta_message"
|
87
|
+
require_relative "anthropic/models/beta/beta_message_delta_usage"
|
88
|
+
require_relative "anthropic/models/beta/beta_message_param"
|
89
|
+
require_relative "anthropic/models/beta/beta_message_tokens_count"
|
90
|
+
require_relative "anthropic/models/beta/beta_metadata"
|
91
|
+
require_relative "anthropic/models/beta/beta_model_info"
|
92
|
+
require_relative "anthropic/models/beta/beta_plain_text_source"
|
93
|
+
require_relative "anthropic/models/beta/beta_raw_content_block_delta"
|
94
|
+
require_relative "anthropic/models/beta/beta_raw_content_block_delta_event"
|
95
|
+
require_relative "anthropic/models/beta/beta_raw_content_block_start_event"
|
96
|
+
require_relative "anthropic/models/beta/beta_raw_content_block_stop_event"
|
97
|
+
require_relative "anthropic/models/beta/beta_raw_message_delta_event"
|
98
|
+
require_relative "anthropic/models/beta/beta_raw_message_start_event"
|
99
|
+
require_relative "anthropic/models/beta/beta_raw_message_stop_event"
|
100
|
+
require_relative "anthropic/models/beta/beta_raw_message_stream_event"
|
101
|
+
require_relative "anthropic/models/beta/beta_redacted_thinking_block"
|
102
|
+
require_relative "anthropic/models/beta/beta_redacted_thinking_block_param"
|
103
|
+
require_relative "anthropic/models/beta/beta_signature_delta"
|
104
|
+
require_relative "anthropic/models/beta/beta_stop_reason"
|
105
|
+
require_relative "anthropic/models/beta/beta_text_block"
|
106
|
+
require_relative "anthropic/models/beta/beta_text_block_param"
|
107
|
+
require_relative "anthropic/models/beta/beta_text_citation"
|
108
|
+
require_relative "anthropic/models/beta/beta_text_citation_param"
|
109
|
+
require_relative "anthropic/models/beta/beta_text_delta"
|
110
|
+
require_relative "anthropic/models/beta/beta_thinking_block"
|
111
|
+
require_relative "anthropic/models/beta/beta_thinking_block_param"
|
112
|
+
require_relative "anthropic/models/beta/beta_thinking_config_disabled"
|
113
|
+
require_relative "anthropic/models/beta/beta_thinking_config_enabled"
|
114
|
+
require_relative "anthropic/models/beta/beta_thinking_config_param"
|
115
|
+
require_relative "anthropic/models/beta/beta_thinking_delta"
|
116
|
+
require_relative "anthropic/models/beta/beta_tool"
|
117
|
+
require_relative "anthropic/models/beta/beta_tool_bash_20241022"
|
118
|
+
require_relative "anthropic/models/beta/beta_tool_bash_20250124"
|
119
|
+
require_relative "anthropic/models/beta/beta_tool_choice"
|
120
|
+
require_relative "anthropic/models/beta/beta_tool_choice_any"
|
121
|
+
require_relative "anthropic/models/beta/beta_tool_choice_auto"
|
122
|
+
require_relative "anthropic/models/beta/beta_tool_choice_none"
|
123
|
+
require_relative "anthropic/models/beta/beta_tool_choice_tool"
|
124
|
+
require_relative "anthropic/models/beta/beta_tool_computer_use_20241022"
|
125
|
+
require_relative "anthropic/models/beta/beta_tool_computer_use_20250124"
|
126
|
+
require_relative "anthropic/models/beta/beta_tool_result_block_param"
|
127
|
+
require_relative "anthropic/models/beta/beta_tool_text_editor_20241022"
|
128
|
+
require_relative "anthropic/models/beta/beta_tool_text_editor_20250124"
|
129
|
+
require_relative "anthropic/models/beta/beta_tool_union"
|
130
|
+
require_relative "anthropic/models/beta/beta_tool_use_block"
|
131
|
+
require_relative "anthropic/models/beta/beta_tool_use_block_param"
|
132
|
+
require_relative "anthropic/models/beta/beta_url_image_source"
|
133
|
+
require_relative "anthropic/models/beta/beta_url_pdf_source"
|
134
|
+
require_relative "anthropic/models/beta/beta_usage"
|
135
|
+
require_relative "anthropic/models/beta/message_count_tokens_params"
|
136
|
+
require_relative "anthropic/models/beta/message_create_params"
|
137
|
+
require_relative "anthropic/models/beta/messages/batch_cancel_params"
|
138
|
+
require_relative "anthropic/models/beta/messages/batch_create_params"
|
139
|
+
require_relative "anthropic/models/beta/messages/batch_delete_params"
|
140
|
+
require_relative "anthropic/models/beta/messages/batch_list_params"
|
141
|
+
require_relative "anthropic/models/beta/messages/batch_results_params"
|
142
|
+
require_relative "anthropic/models/beta/messages/batch_retrieve_params"
|
143
|
+
require_relative "anthropic/models/beta/messages/beta_deleted_message_batch"
|
144
|
+
require_relative "anthropic/models/beta/messages/beta_message_batch"
|
145
|
+
require_relative "anthropic/models/beta/messages/beta_message_batch_canceled_result"
|
146
|
+
require_relative "anthropic/models/beta/messages/beta_message_batch_errored_result"
|
147
|
+
require_relative "anthropic/models/beta/messages/beta_message_batch_expired_result"
|
148
|
+
require_relative "anthropic/models/beta/messages/beta_message_batch_individual_response"
|
149
|
+
require_relative "anthropic/models/beta/messages/beta_message_batch_request_counts"
|
150
|
+
require_relative "anthropic/models/beta/messages/beta_message_batch_result"
|
151
|
+
require_relative "anthropic/models/beta/messages/beta_message_batch_succeeded_result"
|
152
|
+
require_relative "anthropic/models/beta/model_list_params"
|
153
|
+
require_relative "anthropic/models/beta/model_retrieve_params"
|
154
|
+
require_relative "anthropic/models/beta_api_error"
|
155
|
+
require_relative "anthropic/models/beta_authentication_error"
|
156
|
+
require_relative "anthropic/models/beta_billing_error"
|
157
|
+
require_relative "anthropic/models/beta_error"
|
158
|
+
require_relative "anthropic/models/beta_error_response"
|
159
|
+
require_relative "anthropic/models/beta_gateway_timeout_error"
|
160
|
+
require_relative "anthropic/models/beta_invalid_request_error"
|
161
|
+
require_relative "anthropic/models/beta_not_found_error"
|
162
|
+
require_relative "anthropic/models/beta_overloaded_error"
|
163
|
+
require_relative "anthropic/models/beta_permission_error"
|
164
|
+
require_relative "anthropic/models/beta_rate_limit_error"
|
165
|
+
require_relative "anthropic/models/billing_error"
|
166
|
+
require_relative "anthropic/models/cache_control_ephemeral"
|
167
|
+
require_relative "anthropic/models/citation_char_location"
|
168
|
+
require_relative "anthropic/models/citation_char_location_param"
|
169
|
+
require_relative "anthropic/models/citation_content_block_location"
|
170
|
+
require_relative "anthropic/models/citation_content_block_location_param"
|
171
|
+
require_relative "anthropic/models/citation_page_location"
|
172
|
+
require_relative "anthropic/models/citation_page_location_param"
|
173
|
+
require_relative "anthropic/models/citations_config_param"
|
174
|
+
require_relative "anthropic/models/citations_delta"
|
175
|
+
require_relative "anthropic/models/completion"
|
176
|
+
require_relative "anthropic/models/completion_create_params"
|
177
|
+
require_relative "anthropic/models/content_block"
|
178
|
+
require_relative "anthropic/models/content_block_param"
|
179
|
+
require_relative "anthropic/models/content_block_source"
|
180
|
+
require_relative "anthropic/models/content_block_source_content"
|
181
|
+
require_relative "anthropic/models/document_block_param"
|
182
|
+
require_relative "anthropic/models/error_object"
|
183
|
+
require_relative "anthropic/models/error_response"
|
184
|
+
require_relative "anthropic/models/gateway_timeout_error"
|
185
|
+
require_relative "anthropic/models/image_block_param"
|
186
|
+
require_relative "anthropic/models/input_json_delta"
|
187
|
+
require_relative "anthropic/models/invalid_request_error"
|
188
|
+
require_relative "anthropic/models/message"
|
189
|
+
require_relative "anthropic/models/message_count_tokens_params"
|
190
|
+
require_relative "anthropic/models/message_count_tokens_tool"
|
191
|
+
require_relative "anthropic/models/message_create_params"
|
192
|
+
require_relative "anthropic/models/message_delta_usage"
|
193
|
+
require_relative "anthropic/models/message_param"
|
194
|
+
require_relative "anthropic/models/messages/batch_cancel_params"
|
195
|
+
require_relative "anthropic/models/messages/batch_create_params"
|
196
|
+
require_relative "anthropic/models/messages/batch_delete_params"
|
197
|
+
require_relative "anthropic/models/messages/batch_list_params"
|
198
|
+
require_relative "anthropic/models/messages/batch_results_params"
|
199
|
+
require_relative "anthropic/models/messages/batch_retrieve_params"
|
200
|
+
require_relative "anthropic/models/messages/deleted_message_batch"
|
201
|
+
require_relative "anthropic/models/messages/message_batch"
|
202
|
+
require_relative "anthropic/models/messages/message_batch_canceled_result"
|
203
|
+
require_relative "anthropic/models/messages/message_batch_errored_result"
|
204
|
+
require_relative "anthropic/models/messages/message_batch_expired_result"
|
205
|
+
require_relative "anthropic/models/messages/message_batch_individual_response"
|
206
|
+
require_relative "anthropic/models/messages/message_batch_request_counts"
|
207
|
+
require_relative "anthropic/models/messages/message_batch_result"
|
208
|
+
require_relative "anthropic/models/messages/message_batch_succeeded_result"
|
209
|
+
require_relative "anthropic/models/message_tokens_count"
|
210
|
+
require_relative "anthropic/models/metadata"
|
211
|
+
require_relative "anthropic/models/model"
|
212
|
+
require_relative "anthropic/models/model_info"
|
213
|
+
require_relative "anthropic/models/model_list_params"
|
214
|
+
require_relative "anthropic/models/model_retrieve_params"
|
215
|
+
require_relative "anthropic/models/not_found_error"
|
216
|
+
require_relative "anthropic/models/overloaded_error"
|
217
|
+
require_relative "anthropic/models/permission_error"
|
218
|
+
require_relative "anthropic/models/plain_text_source"
|
219
|
+
require_relative "anthropic/models/rate_limit_error"
|
220
|
+
require_relative "anthropic/models/raw_content_block_delta"
|
221
|
+
require_relative "anthropic/models/raw_content_block_delta_event"
|
222
|
+
require_relative "anthropic/models/raw_content_block_start_event"
|
223
|
+
require_relative "anthropic/models/raw_content_block_stop_event"
|
224
|
+
require_relative "anthropic/models/raw_message_delta_event"
|
225
|
+
require_relative "anthropic/models/raw_message_start_event"
|
226
|
+
require_relative "anthropic/models/raw_message_stop_event"
|
227
|
+
require_relative "anthropic/models/raw_message_stream_event"
|
228
|
+
require_relative "anthropic/models/redacted_thinking_block"
|
229
|
+
require_relative "anthropic/models/redacted_thinking_block_param"
|
230
|
+
require_relative "anthropic/models/signature_delta"
|
231
|
+
require_relative "anthropic/models/stop_reason"
|
232
|
+
require_relative "anthropic/models/text_block"
|
233
|
+
require_relative "anthropic/models/text_block_param"
|
234
|
+
require_relative "anthropic/models/text_citation"
|
235
|
+
require_relative "anthropic/models/text_citation_param"
|
236
|
+
require_relative "anthropic/models/text_delta"
|
237
|
+
require_relative "anthropic/models/thinking_block"
|
238
|
+
require_relative "anthropic/models/thinking_block_param"
|
239
|
+
require_relative "anthropic/models/thinking_config_disabled"
|
240
|
+
require_relative "anthropic/models/thinking_config_enabled"
|
241
|
+
require_relative "anthropic/models/thinking_config_param"
|
242
|
+
require_relative "anthropic/models/thinking_delta"
|
243
|
+
require_relative "anthropic/models/tool"
|
244
|
+
require_relative "anthropic/models/tool_bash_20250124"
|
245
|
+
require_relative "anthropic/models/tool_choice"
|
246
|
+
require_relative "anthropic/models/tool_choice_any"
|
247
|
+
require_relative "anthropic/models/tool_choice_auto"
|
248
|
+
require_relative "anthropic/models/tool_choice_none"
|
249
|
+
require_relative "anthropic/models/tool_choice_tool"
|
250
|
+
require_relative "anthropic/models/tool_result_block_param"
|
251
|
+
require_relative "anthropic/models/tool_text_editor_20250124"
|
252
|
+
require_relative "anthropic/models/tool_union"
|
253
|
+
require_relative "anthropic/models/tool_use_block"
|
254
|
+
require_relative "anthropic/models/tool_use_block_param"
|
255
|
+
require_relative "anthropic/models/url_image_source"
|
256
|
+
require_relative "anthropic/models/url_pdf_source"
|
257
|
+
require_relative "anthropic/models/usage"
|
258
|
+
require_relative "anthropic/resources/beta"
|
259
|
+
require_relative "anthropic/resources/beta/messages"
|
260
|
+
require_relative "anthropic/resources/beta/messages/batches"
|
261
|
+
require_relative "anthropic/resources/beta/models"
|
262
|
+
require_relative "anthropic/resources/completions"
|
263
|
+
require_relative "anthropic/resources/messages"
|
264
|
+
require_relative "anthropic/resources/messages/batches"
|
265
|
+
require_relative "anthropic/resources/models"
|
data/manifest.yaml
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Bedrock
|
5
|
+
class Client < Anthropic::Client
|
6
|
+
DEFAULT_VERSION = "bedrock-2023-05-31"
|
7
|
+
|
8
|
+
sig { returns(String) }
|
9
|
+
attr_reader :aws_region
|
10
|
+
|
11
|
+
sig { returns(Anthropic::Resources::Completions) }
|
12
|
+
attr_reader :completions
|
13
|
+
|
14
|
+
sig { returns(Anthropic::Resources::Messages) }
|
15
|
+
attr_reader :messages
|
16
|
+
|
17
|
+
sig { returns(Anthropic::Resources::Beta) }
|
18
|
+
attr_reader :beta
|
19
|
+
|
20
|
+
# @api private
|
21
|
+
sig do
|
22
|
+
override
|
23
|
+
.params(req: Anthropic::Internal::Transport::BaseClient::RequestComponentsShape, opts: Anthropic::Internal::AnyHash)
|
24
|
+
.returns(Anthropic::Internal::Transport::BaseClient::RequestInputShape)
|
25
|
+
end
|
26
|
+
private def build_request(req, opts); end
|
27
|
+
|
28
|
+
sig do
|
29
|
+
params(
|
30
|
+
aws_region: T.nilable(String),
|
31
|
+
aws_access_key: T.nilable(String),
|
32
|
+
aws_secret_key: T.nilable(String),
|
33
|
+
aws_session_token: T.nilable(String),
|
34
|
+
aws_profile: T.nilable(String)
|
35
|
+
).returns(T::Array[T.anything])
|
36
|
+
end
|
37
|
+
private def resolve_region_and_credentials(
|
38
|
+
aws_region:,
|
39
|
+
aws_access_key:,
|
40
|
+
aws_secret_key:,
|
41
|
+
aws_session_token:,
|
42
|
+
aws_profile:
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
sig do
|
47
|
+
params(request_components: Anthropic::Internal::Transport::BaseClient::RequestComponentsShape)
|
48
|
+
.returns(Anthropic::Internal::Transport::BaseClient::RequestComponentsShape)
|
49
|
+
end
|
50
|
+
private def fit_req_to_bedrock_specs!(request_components) end
|
51
|
+
|
52
|
+
sig do
|
53
|
+
params(
|
54
|
+
aws_region: T.nilable(String),
|
55
|
+
base_url: T.nilable(String),
|
56
|
+
max_retries: Integer,
|
57
|
+
timeout: Float,
|
58
|
+
initial_retry_delay: Float,
|
59
|
+
max_retry_delay: Float,
|
60
|
+
aws_access_key: T.nilable(String),
|
61
|
+
aws_secret_key: T.nilable(String),
|
62
|
+
aws_session_token: T.nilable(String),
|
63
|
+
aws_profile: T.nilable(String)
|
64
|
+
).returns(T.attached_class)
|
65
|
+
end
|
66
|
+
def self.new(
|
67
|
+
aws_region: nil,
|
68
|
+
base_url: nil,
|
69
|
+
max_retries: Anthropic::Client::DEFAULT_MAX_RETRIES,
|
70
|
+
timeout: Anthropic::Client::DEFAULT_TIMEOUT_IN_SECONDS,
|
71
|
+
initial_retry_delay: Anthropic::Client::DEFAULT_INITIAL_RETRY_DELAY,
|
72
|
+
max_retry_delay: Anthropic::Client::DEFAULT_MAX_RETRY_DELAY,
|
73
|
+
aws_access_key: nil,
|
74
|
+
aws_secret_key: nil,
|
75
|
+
aws_session_token: nil,
|
76
|
+
aws_profile: nil
|
77
|
+
) end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
class Client < Anthropic::Internal::Transport::BaseClient
|
5
|
+
DEFAULT_MAX_RETRIES = 2
|
6
|
+
|
7
|
+
DEFAULT_TIMEOUT_IN_SECONDS = T.let(600.0, Float)
|
8
|
+
|
9
|
+
DEFAULT_INITIAL_RETRY_DELAY = T.let(0.5, Float)
|
10
|
+
|
11
|
+
DEFAULT_MAX_RETRY_DELAY = T.let(8.0, Float)
|
12
|
+
|
13
|
+
sig { returns(T.nilable(String)) }
|
14
|
+
attr_reader :api_key
|
15
|
+
|
16
|
+
sig { returns(T.nilable(String)) }
|
17
|
+
attr_reader :auth_token
|
18
|
+
|
19
|
+
sig { returns(Anthropic::Resources::Completions) }
|
20
|
+
attr_reader :completions
|
21
|
+
|
22
|
+
sig { returns(Anthropic::Resources::Messages) }
|
23
|
+
attr_reader :messages
|
24
|
+
|
25
|
+
sig { returns(Anthropic::Resources::Models) }
|
26
|
+
attr_reader :models
|
27
|
+
|
28
|
+
sig { returns(Anthropic::Resources::Beta) }
|
29
|
+
attr_reader :beta
|
30
|
+
|
31
|
+
# @api private
|
32
|
+
sig { override.returns(T::Hash[String, String]) }
|
33
|
+
private def auth_headers; end
|
34
|
+
|
35
|
+
# @api private
|
36
|
+
sig { returns(T::Hash[String, String]) }
|
37
|
+
private def api_key_auth; end
|
38
|
+
|
39
|
+
# @api private
|
40
|
+
sig { returns(T::Hash[String, String]) }
|
41
|
+
private def bearer_auth; end
|
42
|
+
|
43
|
+
# Creates and returns a new client for interacting with the API.
|
44
|
+
sig do
|
45
|
+
params(
|
46
|
+
api_key: T.nilable(String),
|
47
|
+
auth_token: T.nilable(String),
|
48
|
+
base_url: T.nilable(String),
|
49
|
+
max_retries: Integer,
|
50
|
+
timeout: Float,
|
51
|
+
initial_retry_delay: Float,
|
52
|
+
max_retry_delay: Float
|
53
|
+
)
|
54
|
+
.returns(T.attached_class)
|
55
|
+
end
|
56
|
+
def self.new(
|
57
|
+
# Defaults to `ENV["ANTHROPIC_API_KEY"]`
|
58
|
+
api_key: ENV["ANTHROPIC_API_KEY"],
|
59
|
+
# Defaults to `ENV["ANTHROPIC_AUTH_TOKEN"]`
|
60
|
+
auth_token: ENV["ANTHROPIC_AUTH_TOKEN"],
|
61
|
+
# Override the default base URL for the API, e.g., `"https://api.example.com/v2/"`
|
62
|
+
base_url: nil,
|
63
|
+
# Max number of retries to attempt after a failed retryable request.
|
64
|
+
max_retries: DEFAULT_MAX_RETRIES,
|
65
|
+
timeout: DEFAULT_TIMEOUT_IN_SECONDS,
|
66
|
+
initial_retry_delay: DEFAULT_INITIAL_RETRY_DELAY,
|
67
|
+
max_retry_delay: DEFAULT_MAX_RETRY_DELAY
|
68
|
+
); end
|
69
|
+
end
|
70
|
+
end
|