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,247 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Internal
|
5
|
+
module Type
|
6
|
+
# @api private
|
7
|
+
module Converter
|
8
|
+
# rubocop:disable Lint/UnusedMethodArgument
|
9
|
+
|
10
|
+
# @api private
|
11
|
+
#
|
12
|
+
# @param value [Object]
|
13
|
+
#
|
14
|
+
# @param state [Hash{Symbol=>Object}] .
|
15
|
+
#
|
16
|
+
# @option state [Boolean, :strong] :strictness
|
17
|
+
#
|
18
|
+
# @option state [Hash{Symbol=>Object}] :exactness
|
19
|
+
#
|
20
|
+
# @option state [Integer] :branched
|
21
|
+
#
|
22
|
+
# @return [Object]
|
23
|
+
def coerce(value, state:) = (raise NotImplementedError)
|
24
|
+
|
25
|
+
# @api private
|
26
|
+
#
|
27
|
+
# @param value [Object]
|
28
|
+
#
|
29
|
+
# @param state [Hash{Symbol=>Object}] .
|
30
|
+
#
|
31
|
+
# @option state [Boolean] :can_retry
|
32
|
+
#
|
33
|
+
# @return [Object]
|
34
|
+
def dump(value, state:)
|
35
|
+
case value
|
36
|
+
in Array
|
37
|
+
value.map { Anthropic::Internal::Type::Unknown.dump(_1, state: state) }
|
38
|
+
in Hash
|
39
|
+
value.transform_values { Anthropic::Internal::Type::Unknown.dump(_1, state: state) }
|
40
|
+
in Anthropic::Internal::Type::BaseModel
|
41
|
+
value.class.dump(value, state: state)
|
42
|
+
in StringIO
|
43
|
+
value.string
|
44
|
+
in Pathname | IO
|
45
|
+
state[:can_retry] = false if value.is_a?(IO)
|
46
|
+
Anthropic::Internal::Util::SerializationAdapter.new(value)
|
47
|
+
else
|
48
|
+
value
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# rubocop:enable Lint/UnusedMethodArgument
|
53
|
+
|
54
|
+
class << self
|
55
|
+
# @api private
|
56
|
+
#
|
57
|
+
# @param spec [Hash{Symbol=>Object}, Proc, Anthropic::Internal::Type::Converter, Class] .
|
58
|
+
#
|
59
|
+
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
|
60
|
+
#
|
61
|
+
# @option spec [Proc] :enum
|
62
|
+
#
|
63
|
+
# @option spec [Proc] :union
|
64
|
+
#
|
65
|
+
# @option spec [Boolean] :"nil?"
|
66
|
+
#
|
67
|
+
# @return [Proc]
|
68
|
+
def type_info(spec)
|
69
|
+
case spec
|
70
|
+
in Proc
|
71
|
+
spec
|
72
|
+
in Hash
|
73
|
+
type_info(spec.slice(:const, :enum, :union).first&.last)
|
74
|
+
in true | false
|
75
|
+
-> { Anthropic::Internal::Type::Boolean }
|
76
|
+
in Anthropic::Internal::Type::Converter | Class | Symbol
|
77
|
+
-> { spec }
|
78
|
+
in NilClass | Integer | Float
|
79
|
+
-> { spec.class }
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# @api private
|
84
|
+
#
|
85
|
+
# Based on `target`, transform `value` into `target`, to the extent possible:
|
86
|
+
#
|
87
|
+
# 1. if the given `value` conforms to `target` already, return the given `value`
|
88
|
+
# 2. if it's possible and safe to convert the given `value` to `target`, then the
|
89
|
+
# converted value
|
90
|
+
# 3. otherwise, the given `value` unaltered
|
91
|
+
#
|
92
|
+
# The coercion process is subject to improvement between minor release versions.
|
93
|
+
# See https://docs.pydantic.dev/latest/concepts/unions/#smart-mode
|
94
|
+
#
|
95
|
+
# @param target [Anthropic::Internal::Type::Converter, Class]
|
96
|
+
#
|
97
|
+
# @param value [Object]
|
98
|
+
#
|
99
|
+
# @param state [Hash{Symbol=>Object}] The `strictness` is one of `true`, `false`, or `:strong`. This informs the
|
100
|
+
# coercion strategy when we have to decide between multiple possible conversion
|
101
|
+
# targets:
|
102
|
+
#
|
103
|
+
# - `true`: the conversion must be exact, with minimum coercion.
|
104
|
+
# - `false`: the conversion can be approximate, with some coercion.
|
105
|
+
# - `:strong`: the conversion must be exact, with no coercion, and raise an error
|
106
|
+
# if not possible.
|
107
|
+
#
|
108
|
+
# The `exactness` is `Hash` with keys being one of `yes`, `no`, or `maybe`. For
|
109
|
+
# any given conversion attempt, the exactness will be updated based on how closely
|
110
|
+
# the value recursively matches the target type:
|
111
|
+
#
|
112
|
+
# - `yes`: the value can be converted to the target type with minimum coercion.
|
113
|
+
# - `maybe`: the value can be converted to the target type with some reasonable
|
114
|
+
# coercion.
|
115
|
+
# - `no`: the value cannot be converted to the target type.
|
116
|
+
#
|
117
|
+
# See implementation below for more details.
|
118
|
+
#
|
119
|
+
# @option state [Boolean, :strong] :strictness
|
120
|
+
#
|
121
|
+
# @option state [Hash{Symbol=>Object}] :exactness
|
122
|
+
#
|
123
|
+
# @option state [Integer] :branched
|
124
|
+
#
|
125
|
+
# @return [Object]
|
126
|
+
def coerce(
|
127
|
+
target,
|
128
|
+
value,
|
129
|
+
state: {strictness: true, exactness: {yes: 0, no: 0, maybe: 0}, branched: 0}
|
130
|
+
)
|
131
|
+
# rubocop:disable Lint/SuppressedException
|
132
|
+
# rubocop:disable Metrics/BlockNesting
|
133
|
+
strictness, exactness = state.fetch_values(:strictness, :exactness)
|
134
|
+
|
135
|
+
case target
|
136
|
+
in Anthropic::Internal::Type::Converter
|
137
|
+
return target.coerce(value, state: state)
|
138
|
+
in Class
|
139
|
+
if value.is_a?(target)
|
140
|
+
exactness[:yes] += 1
|
141
|
+
return value
|
142
|
+
end
|
143
|
+
|
144
|
+
case target
|
145
|
+
in -> { _1 <= NilClass }
|
146
|
+
exactness[value.nil? ? :yes : :maybe] += 1
|
147
|
+
return nil
|
148
|
+
in -> { _1 <= Integer }
|
149
|
+
if value.is_a?(Integer)
|
150
|
+
exactness[:yes] += 1
|
151
|
+
return value
|
152
|
+
elsif strictness == :strong && Integer(value, exception: false) != value
|
153
|
+
message = "no implicit conversion of #{value.class} into #{target.inspect}"
|
154
|
+
raise value.is_a?(Numeric) ? ArgumentError.new(message) : TypeError.new(message)
|
155
|
+
else
|
156
|
+
Kernel.then do
|
157
|
+
return Integer(value).tap { exactness[:maybe] += 1 }
|
158
|
+
rescue ArgumentError, TypeError
|
159
|
+
end
|
160
|
+
end
|
161
|
+
in -> { _1 <= Float }
|
162
|
+
if value.is_a?(Numeric)
|
163
|
+
exactness[:yes] += 1
|
164
|
+
return Float(value)
|
165
|
+
elsif strictness == :strong
|
166
|
+
message = "no implicit conversion of #{value.class} into #{target.inspect}"
|
167
|
+
raise TypeError.new(message)
|
168
|
+
else
|
169
|
+
Kernel.then do
|
170
|
+
return Float(value).tap { exactness[:maybe] += 1 }
|
171
|
+
rescue ArgumentError, TypeError
|
172
|
+
end
|
173
|
+
end
|
174
|
+
in -> { _1 <= String }
|
175
|
+
case value
|
176
|
+
in String | Symbol | Numeric
|
177
|
+
exactness[value.is_a?(Numeric) ? :maybe : :yes] += 1
|
178
|
+
return value.to_s
|
179
|
+
in StringIO
|
180
|
+
exactness[:yes] += 1
|
181
|
+
return value.string
|
182
|
+
else
|
183
|
+
if strictness == :strong
|
184
|
+
message = "no implicit conversion of #{value.class} into #{target.inspect}"
|
185
|
+
raise TypeError.new(message)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
in -> { _1 <= Date || _1 <= Time }
|
189
|
+
Kernel.then do
|
190
|
+
return target.parse(value).tap { exactness[:yes] += 1 }
|
191
|
+
rescue ArgumentError, TypeError => e
|
192
|
+
raise e if strictness == :strong
|
193
|
+
end
|
194
|
+
in -> { _1 <= StringIO } if value.is_a?(String)
|
195
|
+
exactness[:yes] += 1
|
196
|
+
return StringIO.new(value.b)
|
197
|
+
else
|
198
|
+
end
|
199
|
+
in Symbol
|
200
|
+
case value
|
201
|
+
in Symbol | String
|
202
|
+
if value.to_sym == target
|
203
|
+
exactness[:yes] += 1
|
204
|
+
return target
|
205
|
+
else
|
206
|
+
exactness[:maybe] += 1
|
207
|
+
return value
|
208
|
+
end
|
209
|
+
else
|
210
|
+
if strictness == :strong
|
211
|
+
message = "cannot convert non-matching #{value.class} into #{target.inspect}"
|
212
|
+
raise ArgumentError.new(message)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
else
|
216
|
+
end
|
217
|
+
|
218
|
+
exactness[:no] += 1
|
219
|
+
value
|
220
|
+
# rubocop:enable Metrics/BlockNesting
|
221
|
+
# rubocop:enable Lint/SuppressedException
|
222
|
+
end
|
223
|
+
|
224
|
+
# @api private
|
225
|
+
#
|
226
|
+
# @param target [Anthropic::Internal::Type::Converter, Class]
|
227
|
+
#
|
228
|
+
# @param value [Object]
|
229
|
+
#
|
230
|
+
# @param state [Hash{Symbol=>Object}] .
|
231
|
+
#
|
232
|
+
# @option state [Boolean] :can_retry
|
233
|
+
#
|
234
|
+
# @return [Object]
|
235
|
+
def dump(target, value, state: {can_retry: true})
|
236
|
+
case target
|
237
|
+
in Anthropic::Internal::Type::Converter
|
238
|
+
target.dump(value, state: state)
|
239
|
+
else
|
240
|
+
Anthropic::Internal::Type::Unknown.dump(value, state: state)
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Internal
|
5
|
+
module Type
|
6
|
+
# @api private
|
7
|
+
#
|
8
|
+
# A value from among a specified list of options. OpenAPI enum values map to Ruby
|
9
|
+
# values in the SDK as follows:
|
10
|
+
#
|
11
|
+
# 1. boolean => true | false
|
12
|
+
# 2. integer => Integer
|
13
|
+
# 3. float => Float
|
14
|
+
# 4. string => Symbol
|
15
|
+
#
|
16
|
+
# We can therefore convert string values to Symbols, but can't convert other
|
17
|
+
# values safely.
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
# # `stop_reason` is a `Anthropic::Models::StopReason`
|
21
|
+
# case stop_reason
|
22
|
+
# when Anthropic::Models::StopReason::END_TURN
|
23
|
+
# # ...
|
24
|
+
# when Anthropic::Models::StopReason::MAX_TOKENS
|
25
|
+
# # ...
|
26
|
+
# when Anthropic::Models::StopReason::STOP_SEQUENCE
|
27
|
+
# # ...
|
28
|
+
# else
|
29
|
+
# puts(stop_reason)
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
# case stop_reason
|
34
|
+
# in :end_turn
|
35
|
+
# # ...
|
36
|
+
# in :max_tokens
|
37
|
+
# # ...
|
38
|
+
# in :stop_sequence
|
39
|
+
# # ...
|
40
|
+
# else
|
41
|
+
# puts(stop_reason)
|
42
|
+
# end
|
43
|
+
module Enum
|
44
|
+
include Anthropic::Internal::Type::Converter
|
45
|
+
|
46
|
+
# All of the valid Symbol values for this enum.
|
47
|
+
#
|
48
|
+
# @return [Array<NilClass, Boolean, Integer, Float, Symbol>]
|
49
|
+
def values = (@values ||= constants.map { const_get(_1) })
|
50
|
+
|
51
|
+
# @api private
|
52
|
+
#
|
53
|
+
# Guard against thread safety issues by instantiating `@values`.
|
54
|
+
private def finalize! = values
|
55
|
+
|
56
|
+
# @param other [Object]
|
57
|
+
#
|
58
|
+
# @return [Boolean]
|
59
|
+
def ===(other) = values.include?(other)
|
60
|
+
|
61
|
+
# @param other [Object]
|
62
|
+
#
|
63
|
+
# @return [Boolean]
|
64
|
+
def ==(other)
|
65
|
+
# rubocop:disable Layout/LineLength
|
66
|
+
other.is_a?(Module) && other.singleton_class <= Anthropic::Internal::Type::Enum && other.values.to_set == values.to_set
|
67
|
+
# rubocop:enable Layout/LineLength
|
68
|
+
end
|
69
|
+
|
70
|
+
# @api private
|
71
|
+
#
|
72
|
+
# Unlike with primitives, `Enum` additionally validates that the value is a member
|
73
|
+
# of the enum.
|
74
|
+
#
|
75
|
+
# @param value [String, Symbol, Object]
|
76
|
+
#
|
77
|
+
# @param state [Hash{Symbol=>Object}] .
|
78
|
+
#
|
79
|
+
# @option state [Boolean, :strong] :strictness
|
80
|
+
#
|
81
|
+
# @option state [Hash{Symbol=>Object}] :exactness
|
82
|
+
#
|
83
|
+
# @option state [Integer] :branched
|
84
|
+
#
|
85
|
+
# @return [Symbol, Object]
|
86
|
+
def coerce(value, state:)
|
87
|
+
exactness = state.fetch(:exactness)
|
88
|
+
val = value.is_a?(String) ? value.to_sym : value
|
89
|
+
|
90
|
+
if values.include?(val)
|
91
|
+
exactness[:yes] += 1
|
92
|
+
val
|
93
|
+
else
|
94
|
+
exactness[values.first&.class == val.class ? :maybe : :no] += 1
|
95
|
+
value
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# @!parse
|
100
|
+
# # @api private
|
101
|
+
# #
|
102
|
+
# # @param value [Symbol, Object]
|
103
|
+
# #
|
104
|
+
# # @param state [Hash{Symbol=>Object}] .
|
105
|
+
# #
|
106
|
+
# # @option state [Boolean] :can_retry
|
107
|
+
# #
|
108
|
+
# # @return [Symbol, Object]
|
109
|
+
# def dump(value, state:) = super
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,148 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Internal
|
5
|
+
module Type
|
6
|
+
# @api private
|
7
|
+
#
|
8
|
+
# @abstract
|
9
|
+
#
|
10
|
+
# @generic Elem
|
11
|
+
#
|
12
|
+
# Hash of items of a given type.
|
13
|
+
class HashOf
|
14
|
+
include Anthropic::Internal::Type::Converter
|
15
|
+
|
16
|
+
# @param type_info [Hash{Symbol=>Object}, Proc, Anthropic::Internal::Type::Converter, Class]
|
17
|
+
#
|
18
|
+
# @param spec [Hash{Symbol=>Object}] .
|
19
|
+
#
|
20
|
+
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
|
21
|
+
#
|
22
|
+
# @option spec [Proc] :enum
|
23
|
+
#
|
24
|
+
# @option spec [Proc] :union
|
25
|
+
#
|
26
|
+
# @option spec [Boolean] :"nil?"
|
27
|
+
def self.[](type_info, spec = {}) = new(type_info, spec)
|
28
|
+
|
29
|
+
# @param other [Object]
|
30
|
+
#
|
31
|
+
# @return [Boolean]
|
32
|
+
def ===(other)
|
33
|
+
type = item_type
|
34
|
+
case other
|
35
|
+
in Hash
|
36
|
+
other.all? do |key, val|
|
37
|
+
case [key, val]
|
38
|
+
in [Symbol | String, ^type]
|
39
|
+
true
|
40
|
+
else
|
41
|
+
false
|
42
|
+
end
|
43
|
+
end
|
44
|
+
else
|
45
|
+
false
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# @param other [Object]
|
50
|
+
#
|
51
|
+
# @return [Boolean]
|
52
|
+
def ==(other)
|
53
|
+
# rubocop:disable Layout/LineLength
|
54
|
+
other.is_a?(Anthropic::Internal::Type::HashOf) && other.nilable? == nilable? && other.item_type == item_type
|
55
|
+
# rubocop:enable Layout/LineLength
|
56
|
+
end
|
57
|
+
|
58
|
+
# @api private
|
59
|
+
#
|
60
|
+
# @param value [Hash{Object=>Object}, Object]
|
61
|
+
#
|
62
|
+
# @param state [Hash{Symbol=>Object}] .
|
63
|
+
#
|
64
|
+
# @option state [Boolean, :strong] :strictness
|
65
|
+
#
|
66
|
+
# @option state [Hash{Symbol=>Object}] :exactness
|
67
|
+
#
|
68
|
+
# @option state [Integer] :branched
|
69
|
+
#
|
70
|
+
# @return [Hash{Symbol=>Object}, Object]
|
71
|
+
def coerce(value, state:)
|
72
|
+
exactness = state.fetch(:exactness)
|
73
|
+
|
74
|
+
unless value.is_a?(Hash)
|
75
|
+
exactness[:no] += 1
|
76
|
+
return value
|
77
|
+
end
|
78
|
+
|
79
|
+
target = item_type
|
80
|
+
exactness[:yes] += 1
|
81
|
+
value
|
82
|
+
.to_h do |key, val|
|
83
|
+
k = key.is_a?(String) ? key.to_sym : key
|
84
|
+
v =
|
85
|
+
case [nilable?, val]
|
86
|
+
in [true, nil]
|
87
|
+
exactness[:yes] += 1
|
88
|
+
nil
|
89
|
+
else
|
90
|
+
Anthropic::Internal::Type::Converter.coerce(target, val, state: state)
|
91
|
+
end
|
92
|
+
|
93
|
+
exactness[:no] += 1 unless k.is_a?(Symbol)
|
94
|
+
[k, v]
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# @api private
|
99
|
+
#
|
100
|
+
# @param value [Hash{Object=>Object}, Object]
|
101
|
+
#
|
102
|
+
# @param state [Hash{Symbol=>Object}] .
|
103
|
+
#
|
104
|
+
# @option state [Boolean] :can_retry
|
105
|
+
#
|
106
|
+
# @return [Hash{Symbol=>Object}, Object]
|
107
|
+
def dump(value, state:)
|
108
|
+
target = item_type
|
109
|
+
if value.is_a?(Hash)
|
110
|
+
value.transform_values do
|
111
|
+
Anthropic::Internal::Type::Converter.dump(target, _1, state: state)
|
112
|
+
end
|
113
|
+
else
|
114
|
+
super
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# @api private
|
119
|
+
#
|
120
|
+
# @return [generic<Elem>]
|
121
|
+
protected def item_type = @item_type_fn.call
|
122
|
+
|
123
|
+
# @api private
|
124
|
+
#
|
125
|
+
# @return [Boolean]
|
126
|
+
protected def nilable? = @nilable
|
127
|
+
|
128
|
+
# @api private
|
129
|
+
#
|
130
|
+
# @param type_info [Hash{Symbol=>Object}, Proc, Anthropic::Internal::Type::Converter, Class]
|
131
|
+
#
|
132
|
+
# @param spec [Hash{Symbol=>Object}] .
|
133
|
+
#
|
134
|
+
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
|
135
|
+
#
|
136
|
+
# @option spec [Proc] :enum
|
137
|
+
#
|
138
|
+
# @option spec [Proc] :union
|
139
|
+
#
|
140
|
+
# @option spec [Boolean] :"nil?"
|
141
|
+
def initialize(type_info, spec = {})
|
142
|
+
@item_type_fn = Anthropic::Internal::Type::Converter.type_info(type_info || spec)
|
143
|
+
@nilable = spec[:nil?]
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Internal
|
5
|
+
module Type
|
6
|
+
# @api private
|
7
|
+
#
|
8
|
+
# @abstract
|
9
|
+
#
|
10
|
+
# Either `Pathname` or `StringIO`.
|
11
|
+
class IOLike
|
12
|
+
extend Anthropic::Internal::Type::Converter
|
13
|
+
|
14
|
+
# @param other [Object]
|
15
|
+
#
|
16
|
+
# @return [Boolean]
|
17
|
+
def self.===(other)
|
18
|
+
case other
|
19
|
+
in StringIO | Pathname | IO
|
20
|
+
true
|
21
|
+
else
|
22
|
+
false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# @param other [Object]
|
27
|
+
#
|
28
|
+
# @return [Boolean]
|
29
|
+
def self.==(other) = other.is_a?(Class) && other <= Anthropic::Internal::Type::IOLike
|
30
|
+
|
31
|
+
class << self
|
32
|
+
# @api private
|
33
|
+
#
|
34
|
+
# @param value [StringIO, String, Object]
|
35
|
+
#
|
36
|
+
# @param state [Hash{Symbol=>Object}] .
|
37
|
+
#
|
38
|
+
# @option state [Boolean, :strong] :strictness
|
39
|
+
#
|
40
|
+
# @option state [Hash{Symbol=>Object}] :exactness
|
41
|
+
#
|
42
|
+
# @option state [Integer] :branched
|
43
|
+
#
|
44
|
+
# @return [StringIO, Object]
|
45
|
+
def coerce(value, state:)
|
46
|
+
exactness = state.fetch(:exactness)
|
47
|
+
case value
|
48
|
+
in String
|
49
|
+
exactness[:yes] += 1
|
50
|
+
StringIO.new(value)
|
51
|
+
in StringIO
|
52
|
+
exactness[:yes] += 1
|
53
|
+
value
|
54
|
+
else
|
55
|
+
exactness[:no] += 1
|
56
|
+
value
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# @!parse
|
61
|
+
# # @api private
|
62
|
+
# #
|
63
|
+
# # @param value [Pathname, StringIO, IO, String, Object]
|
64
|
+
# #
|
65
|
+
# # @param state [Hash{Symbol=>Object}] .
|
66
|
+
# #
|
67
|
+
# # @option state [Boolean] :can_retry
|
68
|
+
# #
|
69
|
+
# # @return [Pathname, StringIO, IO, String, Object]
|
70
|
+
# def dump(value, state:) = super
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Internal
|
5
|
+
module Type
|
6
|
+
# @api private
|
7
|
+
module RequestParameters
|
8
|
+
# @!parse
|
9
|
+
# # Options to specify HTTP behaviour for this request.
|
10
|
+
# # @return [Anthropic::RequestOptions, Hash{Symbol=>Object}]
|
11
|
+
# attr_accessor :request_options
|
12
|
+
|
13
|
+
# @param mod [Module]
|
14
|
+
def self.included(mod)
|
15
|
+
return unless mod <= Anthropic::Internal::Type::BaseModel
|
16
|
+
|
17
|
+
mod.extend(Anthropic::Internal::Type::RequestParameters::Converter)
|
18
|
+
mod.optional(:request_options, Anthropic::RequestOptions)
|
19
|
+
end
|
20
|
+
|
21
|
+
# @api private
|
22
|
+
module Converter
|
23
|
+
# @api private
|
24
|
+
#
|
25
|
+
# @param params [Object]
|
26
|
+
#
|
27
|
+
# @return [Array(Object, Hash{Symbol=>Object})]
|
28
|
+
def dump_request(params)
|
29
|
+
state = {can_retry: true}
|
30
|
+
case (dumped = dump(params, state: state))
|
31
|
+
in Hash
|
32
|
+
options = Anthropic::Internal::Util.coerce_hash(dumped[:request_options])
|
33
|
+
request_options =
|
34
|
+
case [options, state.fetch(:can_retry)]
|
35
|
+
in [Hash | nil, false]
|
36
|
+
{**options.to_h, max_retries: 0}
|
37
|
+
else
|
38
|
+
options
|
39
|
+
end
|
40
|
+
[dumped.except(:request_options), request_options]
|
41
|
+
else
|
42
|
+
[dumped, nil]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|