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,800 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Anthropic
|
4
|
+
module Resources
|
5
|
+
class Messages
|
6
|
+
sig { returns(Anthropic::Resources::Messages::Batches) }
|
7
|
+
attr_reader :batches
|
8
|
+
|
9
|
+
# See {Anthropic::Resources::Messages#stream_raw} for streaming counterpart.
|
10
|
+
#
|
11
|
+
# Send a structured list of input messages with text and/or image content, and the
|
12
|
+
# model will generate the next message in the conversation.
|
13
|
+
#
|
14
|
+
# The Messages API can be used for either single queries or stateless multi-turn
|
15
|
+
# conversations.
|
16
|
+
#
|
17
|
+
# Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
|
18
|
+
sig do
|
19
|
+
params(
|
20
|
+
max_tokens: Integer,
|
21
|
+
messages: T::Array[T.any(Anthropic::Models::MessageParam, Anthropic::Internal::AnyHash)],
|
22
|
+
model: T.any(Anthropic::Models::Model::OrSymbol, String),
|
23
|
+
metadata: T.any(Anthropic::Models::Metadata, Anthropic::Internal::AnyHash),
|
24
|
+
stop_sequences: T::Array[String],
|
25
|
+
system_: T.any(String, T::Array[T.any(Anthropic::Models::TextBlockParam, Anthropic::Internal::AnyHash)]),
|
26
|
+
temperature: Float,
|
27
|
+
thinking: T.any(
|
28
|
+
Anthropic::Models::ThinkingConfigEnabled,
|
29
|
+
Anthropic::Internal::AnyHash,
|
30
|
+
Anthropic::Models::ThinkingConfigDisabled
|
31
|
+
),
|
32
|
+
tool_choice: T.any(
|
33
|
+
Anthropic::Models::ToolChoiceAuto,
|
34
|
+
Anthropic::Internal::AnyHash,
|
35
|
+
Anthropic::Models::ToolChoiceAny,
|
36
|
+
Anthropic::Models::ToolChoiceTool,
|
37
|
+
Anthropic::Models::ToolChoiceNone
|
38
|
+
),
|
39
|
+
tools: T::Array[
|
40
|
+
T.any(
|
41
|
+
Anthropic::Models::Tool,
|
42
|
+
Anthropic::Internal::AnyHash,
|
43
|
+
Anthropic::Models::ToolBash20250124,
|
44
|
+
Anthropic::Models::ToolTextEditor20250124
|
45
|
+
)
|
46
|
+
],
|
47
|
+
top_k: Integer,
|
48
|
+
top_p: Float,
|
49
|
+
stream: T.noreturn,
|
50
|
+
request_options: T.nilable(T.any(Anthropic::RequestOptions, Anthropic::Internal::AnyHash))
|
51
|
+
)
|
52
|
+
.returns(Anthropic::Models::Message)
|
53
|
+
end
|
54
|
+
def create(
|
55
|
+
# The maximum number of tokens to generate before stopping.
|
56
|
+
#
|
57
|
+
# Note that our models may stop _before_ reaching this maximum. This parameter
|
58
|
+
# only specifies the absolute maximum number of tokens to generate.
|
59
|
+
#
|
60
|
+
# Different models have different maximum values for this parameter. See
|
61
|
+
# [models](https://docs.anthropic.com/en/docs/models-overview) for details.
|
62
|
+
max_tokens:,
|
63
|
+
# Input messages.
|
64
|
+
#
|
65
|
+
# Our models are trained to operate on alternating `user` and `assistant`
|
66
|
+
# conversational turns. When creating a new `Message`, you specify the prior
|
67
|
+
# conversational turns with the `messages` parameter, and the model then generates
|
68
|
+
# the next `Message` in the conversation. Consecutive `user` or `assistant` turns
|
69
|
+
# in your request will be combined into a single turn.
|
70
|
+
#
|
71
|
+
# Each input message must be an object with a `role` and `content`. You can
|
72
|
+
# specify a single `user`-role message, or you can include multiple `user` and
|
73
|
+
# `assistant` messages.
|
74
|
+
#
|
75
|
+
# If the final message uses the `assistant` role, the response content will
|
76
|
+
# continue immediately from the content in that message. This can be used to
|
77
|
+
# constrain part of the model's response.
|
78
|
+
#
|
79
|
+
# Example with a single `user` message:
|
80
|
+
#
|
81
|
+
# ```json
|
82
|
+
# [{ "role": "user", "content": "Hello, Claude" }]
|
83
|
+
# ```
|
84
|
+
#
|
85
|
+
# Example with multiple conversational turns:
|
86
|
+
#
|
87
|
+
# ```json
|
88
|
+
# [
|
89
|
+
# { "role": "user", "content": "Hello there." },
|
90
|
+
# { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
|
91
|
+
# { "role": "user", "content": "Can you explain LLMs in plain English?" }
|
92
|
+
# ]
|
93
|
+
# ```
|
94
|
+
#
|
95
|
+
# Example with a partially-filled response from Claude:
|
96
|
+
#
|
97
|
+
# ```json
|
98
|
+
# [
|
99
|
+
# {
|
100
|
+
# "role": "user",
|
101
|
+
# "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
102
|
+
# },
|
103
|
+
# { "role": "assistant", "content": "The best answer is (" }
|
104
|
+
# ]
|
105
|
+
# ```
|
106
|
+
#
|
107
|
+
# Each input message `content` may be either a single `string` or an array of
|
108
|
+
# content blocks, where each block has a specific `type`. Using a `string` for
|
109
|
+
# `content` is shorthand for an array of one content block of type `"text"`. The
|
110
|
+
# following input messages are equivalent:
|
111
|
+
#
|
112
|
+
# ```json
|
113
|
+
# { "role": "user", "content": "Hello, Claude" }
|
114
|
+
# ```
|
115
|
+
#
|
116
|
+
# ```json
|
117
|
+
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
118
|
+
# ```
|
119
|
+
#
|
120
|
+
# Starting with Claude 3 models, you can also send image content blocks:
|
121
|
+
#
|
122
|
+
# ```json
|
123
|
+
# {
|
124
|
+
# "role": "user",
|
125
|
+
# "content": [
|
126
|
+
# {
|
127
|
+
# "type": "image",
|
128
|
+
# "source": {
|
129
|
+
# "type": "base64",
|
130
|
+
# "media_type": "image/jpeg",
|
131
|
+
# "data": "/9j/4AAQSkZJRg..."
|
132
|
+
# }
|
133
|
+
# },
|
134
|
+
# { "type": "text", "text": "What is in this image?" }
|
135
|
+
# ]
|
136
|
+
# }
|
137
|
+
# ```
|
138
|
+
#
|
139
|
+
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
140
|
+
# `image/png`, `image/gif`, and `image/webp` media types.
|
141
|
+
#
|
142
|
+
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
143
|
+
# more input examples.
|
144
|
+
#
|
145
|
+
# Note that if you want to include a
|
146
|
+
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
147
|
+
# the top-level `system` parameter — there is no `"system"` role for input
|
148
|
+
# messages in the Messages API.
|
149
|
+
messages:,
|
150
|
+
# The model that will complete your prompt.\n\nSee
|
151
|
+
# [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
152
|
+
# details and options.
|
153
|
+
model:,
|
154
|
+
# An object describing metadata about the request.
|
155
|
+
metadata: nil,
|
156
|
+
# Custom text sequences that will cause the model to stop generating.
|
157
|
+
#
|
158
|
+
# Our models will normally stop when they have naturally completed their turn,
|
159
|
+
# which will result in a response `stop_reason` of `"end_turn"`.
|
160
|
+
#
|
161
|
+
# If you want the model to stop generating when it encounters custom strings of
|
162
|
+
# text, you can use the `stop_sequences` parameter. If the model encounters one of
|
163
|
+
# the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
|
164
|
+
# and the response `stop_sequence` value will contain the matched stop sequence.
|
165
|
+
stop_sequences: nil,
|
166
|
+
# System prompt.
|
167
|
+
#
|
168
|
+
# A system prompt is a way of providing context and instructions to Claude, such
|
169
|
+
# as specifying a particular goal or role. See our
|
170
|
+
# [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
|
171
|
+
system_: nil,
|
172
|
+
# Amount of randomness injected into the response.
|
173
|
+
#
|
174
|
+
# Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
|
175
|
+
# for analytical / multiple choice, and closer to `1.0` for creative and
|
176
|
+
# generative tasks.
|
177
|
+
#
|
178
|
+
# Note that even with `temperature` of `0.0`, the results will not be fully
|
179
|
+
# deterministic.
|
180
|
+
temperature: nil,
|
181
|
+
# Configuration for enabling Claude's extended thinking.
|
182
|
+
#
|
183
|
+
# When enabled, responses include `thinking` content blocks showing Claude's
|
184
|
+
# thinking process before the final answer. Requires a minimum budget of 1,024
|
185
|
+
# tokens and counts towards your `max_tokens` limit.
|
186
|
+
#
|
187
|
+
# See
|
188
|
+
# [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
189
|
+
# for details.
|
190
|
+
thinking: nil,
|
191
|
+
# How the model should use the provided tools. The model can use a specific tool,
|
192
|
+
# any available tool, decide by itself, or not use tools at all.
|
193
|
+
tool_choice: nil,
|
194
|
+
# Definitions of tools that the model may use.
|
195
|
+
#
|
196
|
+
# If you include `tools` in your API request, the model may return `tool_use`
|
197
|
+
# content blocks that represent the model's use of those tools. You can then run
|
198
|
+
# those tools using the tool input generated by the model and then optionally
|
199
|
+
# return results back to the model using `tool_result` content blocks.
|
200
|
+
#
|
201
|
+
# Each tool definition includes:
|
202
|
+
#
|
203
|
+
# - `name`: Name of the tool.
|
204
|
+
# - `description`: Optional, but strongly-recommended description of the tool.
|
205
|
+
# - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
|
206
|
+
# tool `input` shape that the model will produce in `tool_use` output content
|
207
|
+
# blocks.
|
208
|
+
#
|
209
|
+
# For example, if you defined `tools` as:
|
210
|
+
#
|
211
|
+
# ```json
|
212
|
+
# [
|
213
|
+
# {
|
214
|
+
# "name": "get_stock_price",
|
215
|
+
# "description": "Get the current stock price for a given ticker symbol.",
|
216
|
+
# "input_schema": {
|
217
|
+
# "type": "object",
|
218
|
+
# "properties": {
|
219
|
+
# "ticker": {
|
220
|
+
# "type": "string",
|
221
|
+
# "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
|
222
|
+
# }
|
223
|
+
# },
|
224
|
+
# "required": ["ticker"]
|
225
|
+
# }
|
226
|
+
# }
|
227
|
+
# ]
|
228
|
+
# ```
|
229
|
+
#
|
230
|
+
# And then asked the model "What's the S&P 500 at today?", the model might produce
|
231
|
+
# `tool_use` content blocks in the response like this:
|
232
|
+
#
|
233
|
+
# ```json
|
234
|
+
# [
|
235
|
+
# {
|
236
|
+
# "type": "tool_use",
|
237
|
+
# "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
238
|
+
# "name": "get_stock_price",
|
239
|
+
# "input": { "ticker": "^GSPC" }
|
240
|
+
# }
|
241
|
+
# ]
|
242
|
+
# ```
|
243
|
+
#
|
244
|
+
# You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
|
245
|
+
# input, and return the following back to the model in a subsequent `user`
|
246
|
+
# message:
|
247
|
+
#
|
248
|
+
# ```json
|
249
|
+
# [
|
250
|
+
# {
|
251
|
+
# "type": "tool_result",
|
252
|
+
# "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
253
|
+
# "content": "259.75 USD"
|
254
|
+
# }
|
255
|
+
# ]
|
256
|
+
# ```
|
257
|
+
#
|
258
|
+
# Tools can be used for workflows that include running client-side tools and
|
259
|
+
# functions, or more generally whenever you want the model to produce a particular
|
260
|
+
# JSON structure of output.
|
261
|
+
#
|
262
|
+
# See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
263
|
+
tools: nil,
|
264
|
+
# Only sample from the top K options for each subsequent token.
|
265
|
+
#
|
266
|
+
# Used to remove "long tail" low probability responses.
|
267
|
+
# [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
|
268
|
+
#
|
269
|
+
# Recommended for advanced use cases only. You usually only need to use
|
270
|
+
# `temperature`.
|
271
|
+
top_k: nil,
|
272
|
+
# Use nucleus sampling.
|
273
|
+
#
|
274
|
+
# In nucleus sampling, we compute the cumulative distribution over all the options
|
275
|
+
# for each subsequent token in decreasing probability order and cut it off once it
|
276
|
+
# reaches a particular probability specified by `top_p`. You should either alter
|
277
|
+
# `temperature` or `top_p`, but not both.
|
278
|
+
#
|
279
|
+
# Recommended for advanced use cases only. You usually only need to use
|
280
|
+
# `temperature`.
|
281
|
+
top_p: nil,
|
282
|
+
# There is no need to provide `stream:`. Instead, use `#stream_raw` or `#create`
|
283
|
+
# for streaming and non-streaming use cases, respectively.
|
284
|
+
stream: false,
|
285
|
+
request_options: {}
|
286
|
+
); end
|
287
|
+
# See {Anthropic::Resources::Messages#create} for non-streaming counterpart.
|
288
|
+
#
|
289
|
+
# Send a structured list of input messages with text and/or image content, and the
|
290
|
+
# model will generate the next message in the conversation.
|
291
|
+
#
|
292
|
+
# The Messages API can be used for either single queries or stateless multi-turn
|
293
|
+
# conversations.
|
294
|
+
#
|
295
|
+
# Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
|
296
|
+
sig do
|
297
|
+
params(
|
298
|
+
max_tokens: Integer,
|
299
|
+
messages: T::Array[T.any(Anthropic::Models::MessageParam, Anthropic::Internal::AnyHash)],
|
300
|
+
model: T.any(Anthropic::Models::Model::OrSymbol, String),
|
301
|
+
metadata: T.any(Anthropic::Models::Metadata, Anthropic::Internal::AnyHash),
|
302
|
+
stop_sequences: T::Array[String],
|
303
|
+
system_: T.any(String, T::Array[T.any(Anthropic::Models::TextBlockParam, Anthropic::Internal::AnyHash)]),
|
304
|
+
temperature: Float,
|
305
|
+
thinking: T.any(
|
306
|
+
Anthropic::Models::ThinkingConfigEnabled,
|
307
|
+
Anthropic::Internal::AnyHash,
|
308
|
+
Anthropic::Models::ThinkingConfigDisabled
|
309
|
+
),
|
310
|
+
tool_choice: T.any(
|
311
|
+
Anthropic::Models::ToolChoiceAuto,
|
312
|
+
Anthropic::Internal::AnyHash,
|
313
|
+
Anthropic::Models::ToolChoiceAny,
|
314
|
+
Anthropic::Models::ToolChoiceTool,
|
315
|
+
Anthropic::Models::ToolChoiceNone
|
316
|
+
),
|
317
|
+
tools: T::Array[
|
318
|
+
T.any(
|
319
|
+
Anthropic::Models::Tool,
|
320
|
+
Anthropic::Internal::AnyHash,
|
321
|
+
Anthropic::Models::ToolBash20250124,
|
322
|
+
Anthropic::Models::ToolTextEditor20250124
|
323
|
+
)
|
324
|
+
],
|
325
|
+
top_k: Integer,
|
326
|
+
top_p: Float,
|
327
|
+
stream: T.noreturn,
|
328
|
+
request_options: T.nilable(T.any(Anthropic::RequestOptions, Anthropic::Internal::AnyHash))
|
329
|
+
)
|
330
|
+
.returns(
|
331
|
+
Anthropic::Internal::Stream[
|
332
|
+
T.any(
|
333
|
+
Anthropic::Models::RawMessageStartEvent,
|
334
|
+
Anthropic::Models::RawMessageDeltaEvent,
|
335
|
+
Anthropic::Models::RawMessageStopEvent,
|
336
|
+
Anthropic::Models::RawContentBlockStartEvent,
|
337
|
+
Anthropic::Models::RawContentBlockDeltaEvent,
|
338
|
+
Anthropic::Models::RawContentBlockStopEvent
|
339
|
+
)
|
340
|
+
]
|
341
|
+
)
|
342
|
+
end
|
343
|
+
def stream_raw(
|
344
|
+
# The maximum number of tokens to generate before stopping.
|
345
|
+
#
|
346
|
+
# Note that our models may stop _before_ reaching this maximum. This parameter
|
347
|
+
# only specifies the absolute maximum number of tokens to generate.
|
348
|
+
#
|
349
|
+
# Different models have different maximum values for this parameter. See
|
350
|
+
# [models](https://docs.anthropic.com/en/docs/models-overview) for details.
|
351
|
+
max_tokens:,
|
352
|
+
# Input messages.
|
353
|
+
#
|
354
|
+
# Our models are trained to operate on alternating `user` and `assistant`
|
355
|
+
# conversational turns. When creating a new `Message`, you specify the prior
|
356
|
+
# conversational turns with the `messages` parameter, and the model then generates
|
357
|
+
# the next `Message` in the conversation. Consecutive `user` or `assistant` turns
|
358
|
+
# in your request will be combined into a single turn.
|
359
|
+
#
|
360
|
+
# Each input message must be an object with a `role` and `content`. You can
|
361
|
+
# specify a single `user`-role message, or you can include multiple `user` and
|
362
|
+
# `assistant` messages.
|
363
|
+
#
|
364
|
+
# If the final message uses the `assistant` role, the response content will
|
365
|
+
# continue immediately from the content in that message. This can be used to
|
366
|
+
# constrain part of the model's response.
|
367
|
+
#
|
368
|
+
# Example with a single `user` message:
|
369
|
+
#
|
370
|
+
# ```json
|
371
|
+
# [{ "role": "user", "content": "Hello, Claude" }]
|
372
|
+
# ```
|
373
|
+
#
|
374
|
+
# Example with multiple conversational turns:
|
375
|
+
#
|
376
|
+
# ```json
|
377
|
+
# [
|
378
|
+
# { "role": "user", "content": "Hello there." },
|
379
|
+
# { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
|
380
|
+
# { "role": "user", "content": "Can you explain LLMs in plain English?" }
|
381
|
+
# ]
|
382
|
+
# ```
|
383
|
+
#
|
384
|
+
# Example with a partially-filled response from Claude:
|
385
|
+
#
|
386
|
+
# ```json
|
387
|
+
# [
|
388
|
+
# {
|
389
|
+
# "role": "user",
|
390
|
+
# "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
391
|
+
# },
|
392
|
+
# { "role": "assistant", "content": "The best answer is (" }
|
393
|
+
# ]
|
394
|
+
# ```
|
395
|
+
#
|
396
|
+
# Each input message `content` may be either a single `string` or an array of
|
397
|
+
# content blocks, where each block has a specific `type`. Using a `string` for
|
398
|
+
# `content` is shorthand for an array of one content block of type `"text"`. The
|
399
|
+
# following input messages are equivalent:
|
400
|
+
#
|
401
|
+
# ```json
|
402
|
+
# { "role": "user", "content": "Hello, Claude" }
|
403
|
+
# ```
|
404
|
+
#
|
405
|
+
# ```json
|
406
|
+
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
407
|
+
# ```
|
408
|
+
#
|
409
|
+
# Starting with Claude 3 models, you can also send image content blocks:
|
410
|
+
#
|
411
|
+
# ```json
|
412
|
+
# {
|
413
|
+
# "role": "user",
|
414
|
+
# "content": [
|
415
|
+
# {
|
416
|
+
# "type": "image",
|
417
|
+
# "source": {
|
418
|
+
# "type": "base64",
|
419
|
+
# "media_type": "image/jpeg",
|
420
|
+
# "data": "/9j/4AAQSkZJRg..."
|
421
|
+
# }
|
422
|
+
# },
|
423
|
+
# { "type": "text", "text": "What is in this image?" }
|
424
|
+
# ]
|
425
|
+
# }
|
426
|
+
# ```
|
427
|
+
#
|
428
|
+
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
429
|
+
# `image/png`, `image/gif`, and `image/webp` media types.
|
430
|
+
#
|
431
|
+
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
432
|
+
# more input examples.
|
433
|
+
#
|
434
|
+
# Note that if you want to include a
|
435
|
+
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
436
|
+
# the top-level `system` parameter — there is no `"system"` role for input
|
437
|
+
# messages in the Messages API.
|
438
|
+
messages:,
|
439
|
+
# The model that will complete your prompt.\n\nSee
|
440
|
+
# [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
441
|
+
# details and options.
|
442
|
+
model:,
|
443
|
+
# An object describing metadata about the request.
|
444
|
+
metadata: nil,
|
445
|
+
# Custom text sequences that will cause the model to stop generating.
|
446
|
+
#
|
447
|
+
# Our models will normally stop when they have naturally completed their turn,
|
448
|
+
# which will result in a response `stop_reason` of `"end_turn"`.
|
449
|
+
#
|
450
|
+
# If you want the model to stop generating when it encounters custom strings of
|
451
|
+
# text, you can use the `stop_sequences` parameter. If the model encounters one of
|
452
|
+
# the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
|
453
|
+
# and the response `stop_sequence` value will contain the matched stop sequence.
|
454
|
+
stop_sequences: nil,
|
455
|
+
# System prompt.
|
456
|
+
#
|
457
|
+
# A system prompt is a way of providing context and instructions to Claude, such
|
458
|
+
# as specifying a particular goal or role. See our
|
459
|
+
# [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
|
460
|
+
system_: nil,
|
461
|
+
# Amount of randomness injected into the response.
|
462
|
+
#
|
463
|
+
# Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
|
464
|
+
# for analytical / multiple choice, and closer to `1.0` for creative and
|
465
|
+
# generative tasks.
|
466
|
+
#
|
467
|
+
# Note that even with `temperature` of `0.0`, the results will not be fully
|
468
|
+
# deterministic.
|
469
|
+
temperature: nil,
|
470
|
+
# Configuration for enabling Claude's extended thinking.
|
471
|
+
#
|
472
|
+
# When enabled, responses include `thinking` content blocks showing Claude's
|
473
|
+
# thinking process before the final answer. Requires a minimum budget of 1,024
|
474
|
+
# tokens and counts towards your `max_tokens` limit.
|
475
|
+
#
|
476
|
+
# See
|
477
|
+
# [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
478
|
+
# for details.
|
479
|
+
thinking: nil,
|
480
|
+
# How the model should use the provided tools. The model can use a specific tool,
|
481
|
+
# any available tool, decide by itself, or not use tools at all.
|
482
|
+
tool_choice: nil,
|
483
|
+
# Definitions of tools that the model may use.
|
484
|
+
#
|
485
|
+
# If you include `tools` in your API request, the model may return `tool_use`
|
486
|
+
# content blocks that represent the model's use of those tools. You can then run
|
487
|
+
# those tools using the tool input generated by the model and then optionally
|
488
|
+
# return results back to the model using `tool_result` content blocks.
|
489
|
+
#
|
490
|
+
# Each tool definition includes:
|
491
|
+
#
|
492
|
+
# - `name`: Name of the tool.
|
493
|
+
# - `description`: Optional, but strongly-recommended description of the tool.
|
494
|
+
# - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
|
495
|
+
# tool `input` shape that the model will produce in `tool_use` output content
|
496
|
+
# blocks.
|
497
|
+
#
|
498
|
+
# For example, if you defined `tools` as:
|
499
|
+
#
|
500
|
+
# ```json
|
501
|
+
# [
|
502
|
+
# {
|
503
|
+
# "name": "get_stock_price",
|
504
|
+
# "description": "Get the current stock price for a given ticker symbol.",
|
505
|
+
# "input_schema": {
|
506
|
+
# "type": "object",
|
507
|
+
# "properties": {
|
508
|
+
# "ticker": {
|
509
|
+
# "type": "string",
|
510
|
+
# "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
|
511
|
+
# }
|
512
|
+
# },
|
513
|
+
# "required": ["ticker"]
|
514
|
+
# }
|
515
|
+
# }
|
516
|
+
# ]
|
517
|
+
# ```
|
518
|
+
#
|
519
|
+
# And then asked the model "What's the S&P 500 at today?", the model might produce
|
520
|
+
# `tool_use` content blocks in the response like this:
|
521
|
+
#
|
522
|
+
# ```json
|
523
|
+
# [
|
524
|
+
# {
|
525
|
+
# "type": "tool_use",
|
526
|
+
# "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
527
|
+
# "name": "get_stock_price",
|
528
|
+
# "input": { "ticker": "^GSPC" }
|
529
|
+
# }
|
530
|
+
# ]
|
531
|
+
# ```
|
532
|
+
#
|
533
|
+
# You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
|
534
|
+
# input, and return the following back to the model in a subsequent `user`
|
535
|
+
# message:
|
536
|
+
#
|
537
|
+
# ```json
|
538
|
+
# [
|
539
|
+
# {
|
540
|
+
# "type": "tool_result",
|
541
|
+
# "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
542
|
+
# "content": "259.75 USD"
|
543
|
+
# }
|
544
|
+
# ]
|
545
|
+
# ```
|
546
|
+
#
|
547
|
+
# Tools can be used for workflows that include running client-side tools and
|
548
|
+
# functions, or more generally whenever you want the model to produce a particular
|
549
|
+
# JSON structure of output.
|
550
|
+
#
|
551
|
+
# See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
552
|
+
tools: nil,
|
553
|
+
# Only sample from the top K options for each subsequent token.
|
554
|
+
#
|
555
|
+
# Used to remove "long tail" low probability responses.
|
556
|
+
# [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
|
557
|
+
#
|
558
|
+
# Recommended for advanced use cases only. You usually only need to use
|
559
|
+
# `temperature`.
|
560
|
+
top_k: nil,
|
561
|
+
# Use nucleus sampling.
|
562
|
+
#
|
563
|
+
# In nucleus sampling, we compute the cumulative distribution over all the options
|
564
|
+
# for each subsequent token in decreasing probability order and cut it off once it
|
565
|
+
# reaches a particular probability specified by `top_p`. You should either alter
|
566
|
+
# `temperature` or `top_p`, but not both.
|
567
|
+
#
|
568
|
+
# Recommended for advanced use cases only. You usually only need to use
|
569
|
+
# `temperature`.
|
570
|
+
top_p: nil,
|
571
|
+
# There is no need to provide `stream:`. Instead, use `#stream_raw` or `#create`
|
572
|
+
# for streaming and non-streaming use cases, respectively.
|
573
|
+
stream: true,
|
574
|
+
request_options: {}
|
575
|
+
); end
|
576
|
+
# Count the number of tokens in a Message.
|
577
|
+
#
|
578
|
+
# The Token Count API can be used to count the number of tokens in a Message,
|
579
|
+
# including tools, images, and documents, without creating it.
|
580
|
+
#
|
581
|
+
# Learn more about token counting in our
|
582
|
+
# [user guide](/en/docs/build-with-claude/token-counting)
|
583
|
+
sig do
|
584
|
+
params(
|
585
|
+
messages: T::Array[T.any(Anthropic::Models::MessageParam, Anthropic::Internal::AnyHash)],
|
586
|
+
model: T.any(Anthropic::Models::Model::OrSymbol, String),
|
587
|
+
system_: T.any(String, T::Array[T.any(Anthropic::Models::TextBlockParam, Anthropic::Internal::AnyHash)]),
|
588
|
+
thinking: T.any(
|
589
|
+
Anthropic::Models::ThinkingConfigEnabled,
|
590
|
+
Anthropic::Internal::AnyHash,
|
591
|
+
Anthropic::Models::ThinkingConfigDisabled
|
592
|
+
),
|
593
|
+
tool_choice: T.any(
|
594
|
+
Anthropic::Models::ToolChoiceAuto,
|
595
|
+
Anthropic::Internal::AnyHash,
|
596
|
+
Anthropic::Models::ToolChoiceAny,
|
597
|
+
Anthropic::Models::ToolChoiceTool,
|
598
|
+
Anthropic::Models::ToolChoiceNone
|
599
|
+
),
|
600
|
+
tools: T::Array[
|
601
|
+
T.any(
|
602
|
+
Anthropic::Models::Tool,
|
603
|
+
Anthropic::Internal::AnyHash,
|
604
|
+
Anthropic::Models::ToolBash20250124,
|
605
|
+
Anthropic::Models::ToolTextEditor20250124
|
606
|
+
)
|
607
|
+
],
|
608
|
+
request_options: T.nilable(T.any(Anthropic::RequestOptions, Anthropic::Internal::AnyHash))
|
609
|
+
)
|
610
|
+
.returns(Anthropic::Models::MessageTokensCount)
|
611
|
+
end
|
612
|
+
def count_tokens(
|
613
|
+
# Input messages.
|
614
|
+
#
|
615
|
+
# Our models are trained to operate on alternating `user` and `assistant`
|
616
|
+
# conversational turns. When creating a new `Message`, you specify the prior
|
617
|
+
# conversational turns with the `messages` parameter, and the model then generates
|
618
|
+
# the next `Message` in the conversation. Consecutive `user` or `assistant` turns
|
619
|
+
# in your request will be combined into a single turn.
|
620
|
+
#
|
621
|
+
# Each input message must be an object with a `role` and `content`. You can
|
622
|
+
# specify a single `user`-role message, or you can include multiple `user` and
|
623
|
+
# `assistant` messages.
|
624
|
+
#
|
625
|
+
# If the final message uses the `assistant` role, the response content will
|
626
|
+
# continue immediately from the content in that message. This can be used to
|
627
|
+
# constrain part of the model's response.
|
628
|
+
#
|
629
|
+
# Example with a single `user` message:
|
630
|
+
#
|
631
|
+
# ```json
|
632
|
+
# [{ "role": "user", "content": "Hello, Claude" }]
|
633
|
+
# ```
|
634
|
+
#
|
635
|
+
# Example with multiple conversational turns:
|
636
|
+
#
|
637
|
+
# ```json
|
638
|
+
# [
|
639
|
+
# { "role": "user", "content": "Hello there." },
|
640
|
+
# { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
|
641
|
+
# { "role": "user", "content": "Can you explain LLMs in plain English?" }
|
642
|
+
# ]
|
643
|
+
# ```
|
644
|
+
#
|
645
|
+
# Example with a partially-filled response from Claude:
|
646
|
+
#
|
647
|
+
# ```json
|
648
|
+
# [
|
649
|
+
# {
|
650
|
+
# "role": "user",
|
651
|
+
# "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
652
|
+
# },
|
653
|
+
# { "role": "assistant", "content": "The best answer is (" }
|
654
|
+
# ]
|
655
|
+
# ```
|
656
|
+
#
|
657
|
+
# Each input message `content` may be either a single `string` or an array of
|
658
|
+
# content blocks, where each block has a specific `type`. Using a `string` for
|
659
|
+
# `content` is shorthand for an array of one content block of type `"text"`. The
|
660
|
+
# following input messages are equivalent:
|
661
|
+
#
|
662
|
+
# ```json
|
663
|
+
# { "role": "user", "content": "Hello, Claude" }
|
664
|
+
# ```
|
665
|
+
#
|
666
|
+
# ```json
|
667
|
+
# { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
668
|
+
# ```
|
669
|
+
#
|
670
|
+
# Starting with Claude 3 models, you can also send image content blocks:
|
671
|
+
#
|
672
|
+
# ```json
|
673
|
+
# {
|
674
|
+
# "role": "user",
|
675
|
+
# "content": [
|
676
|
+
# {
|
677
|
+
# "type": "image",
|
678
|
+
# "source": {
|
679
|
+
# "type": "base64",
|
680
|
+
# "media_type": "image/jpeg",
|
681
|
+
# "data": "/9j/4AAQSkZJRg..."
|
682
|
+
# }
|
683
|
+
# },
|
684
|
+
# { "type": "text", "text": "What is in this image?" }
|
685
|
+
# ]
|
686
|
+
# }
|
687
|
+
# ```
|
688
|
+
#
|
689
|
+
# We currently support the `base64` source type for images, and the `image/jpeg`,
|
690
|
+
# `image/png`, `image/gif`, and `image/webp` media types.
|
691
|
+
#
|
692
|
+
# See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
693
|
+
# more input examples.
|
694
|
+
#
|
695
|
+
# Note that if you want to include a
|
696
|
+
# [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
697
|
+
# the top-level `system` parameter — there is no `"system"` role for input
|
698
|
+
# messages in the Messages API.
|
699
|
+
messages:,
|
700
|
+
# The model that will complete your prompt.\n\nSee
|
701
|
+
# [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
702
|
+
# details and options.
|
703
|
+
model:,
|
704
|
+
# System prompt.
|
705
|
+
#
|
706
|
+
# A system prompt is a way of providing context and instructions to Claude, such
|
707
|
+
# as specifying a particular goal or role. See our
|
708
|
+
# [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
|
709
|
+
system_: nil,
|
710
|
+
# Configuration for enabling Claude's extended thinking.
|
711
|
+
#
|
712
|
+
# When enabled, responses include `thinking` content blocks showing Claude's
|
713
|
+
# thinking process before the final answer. Requires a minimum budget of 1,024
|
714
|
+
# tokens and counts towards your `max_tokens` limit.
|
715
|
+
#
|
716
|
+
# See
|
717
|
+
# [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
718
|
+
# for details.
|
719
|
+
thinking: nil,
|
720
|
+
# How the model should use the provided tools. The model can use a specific tool,
|
721
|
+
# any available tool, decide by itself, or not use tools at all.
|
722
|
+
tool_choice: nil,
|
723
|
+
# Definitions of tools that the model may use.
|
724
|
+
#
|
725
|
+
# If you include `tools` in your API request, the model may return `tool_use`
|
726
|
+
# content blocks that represent the model's use of those tools. You can then run
|
727
|
+
# those tools using the tool input generated by the model and then optionally
|
728
|
+
# return results back to the model using `tool_result` content blocks.
|
729
|
+
#
|
730
|
+
# Each tool definition includes:
|
731
|
+
#
|
732
|
+
# - `name`: Name of the tool.
|
733
|
+
# - `description`: Optional, but strongly-recommended description of the tool.
|
734
|
+
# - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
|
735
|
+
# tool `input` shape that the model will produce in `tool_use` output content
|
736
|
+
# blocks.
|
737
|
+
#
|
738
|
+
# For example, if you defined `tools` as:
|
739
|
+
#
|
740
|
+
# ```json
|
741
|
+
# [
|
742
|
+
# {
|
743
|
+
# "name": "get_stock_price",
|
744
|
+
# "description": "Get the current stock price for a given ticker symbol.",
|
745
|
+
# "input_schema": {
|
746
|
+
# "type": "object",
|
747
|
+
# "properties": {
|
748
|
+
# "ticker": {
|
749
|
+
# "type": "string",
|
750
|
+
# "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
|
751
|
+
# }
|
752
|
+
# },
|
753
|
+
# "required": ["ticker"]
|
754
|
+
# }
|
755
|
+
# }
|
756
|
+
# ]
|
757
|
+
# ```
|
758
|
+
#
|
759
|
+
# And then asked the model "What's the S&P 500 at today?", the model might produce
|
760
|
+
# `tool_use` content blocks in the response like this:
|
761
|
+
#
|
762
|
+
# ```json
|
763
|
+
# [
|
764
|
+
# {
|
765
|
+
# "type": "tool_use",
|
766
|
+
# "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
767
|
+
# "name": "get_stock_price",
|
768
|
+
# "input": { "ticker": "^GSPC" }
|
769
|
+
# }
|
770
|
+
# ]
|
771
|
+
# ```
|
772
|
+
#
|
773
|
+
# You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
|
774
|
+
# input, and return the following back to the model in a subsequent `user`
|
775
|
+
# message:
|
776
|
+
#
|
777
|
+
# ```json
|
778
|
+
# [
|
779
|
+
# {
|
780
|
+
# "type": "tool_result",
|
781
|
+
# "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
782
|
+
# "content": "259.75 USD"
|
783
|
+
# }
|
784
|
+
# ]
|
785
|
+
# ```
|
786
|
+
#
|
787
|
+
# Tools can be used for workflows that include running client-side tools and
|
788
|
+
# functions, or more generally whenever you want the model to produce a particular
|
789
|
+
# JSON structure of output.
|
790
|
+
#
|
791
|
+
# See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
792
|
+
tools: nil,
|
793
|
+
request_options: {}
|
794
|
+
); end
|
795
|
+
# @api private
|
796
|
+
sig { params(client: Anthropic::Client).returns(T.attached_class) }
|
797
|
+
def self.new(client:); end
|
798
|
+
end
|
799
|
+
end
|
800
|
+
end
|