anthropic 1.80.0 → 1.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.md +1 -1
- data/lib/anthropic/client.rb +4 -0
- data/lib/anthropic/helpers/aws/client.rb +20 -3
- data/lib/anthropic/helpers/bedrock/client.rb +6 -0
- data/lib/anthropic/helpers/bedrock/mantle_client.rb +41 -2
- data/lib/anthropic/helpers/google_cloud/client.rb +113 -31
- data/lib/anthropic/helpers/vertex/client.rb +7 -0
- data/lib/anthropic/internal/report_page_cursor.rb +98 -0
- data/lib/anthropic/internal/stream.rb +6 -13
- data/lib/anthropic/internal/tracing.rb +7 -4
- data/lib/anthropic/models/beta/beta_cache_miss_messages_changed.rb +8 -0
- data/lib/anthropic/models/beta/beta_cache_miss_model_changed.rb +7 -0
- data/lib/anthropic/models/beta/beta_cache_miss_previous_message_not_found.rb +9 -0
- data/lib/anthropic/models/beta/beta_cache_miss_reason.rb +22 -0
- data/lib/anthropic/models/beta/beta_cache_miss_system_changed.rb +7 -0
- data/lib/anthropic/models/beta/beta_cache_miss_tools_changed.rb +7 -0
- data/lib/anthropic/models/beta/beta_cache_miss_unavailable.rb +11 -0
- data/lib/anthropic/models/beta/beta_deleted_user_profile.rb +29 -0
- data/lib/anthropic/models/beta/beta_fallback_param.rb +74 -10
- data/lib/anthropic/models/beta/beta_managed_agents_deleted_vault.rb +2 -2
- data/lib/anthropic/models/beta/beta_managed_agents_memory_store.rb +28 -19
- data/lib/anthropic/models/beta/beta_managed_agents_vault.rb +2 -2
- data/lib/anthropic/models/beta/beta_user_profile.rb +31 -28
- data/lib/anthropic/models/beta/beta_user_profile_enrollment_url.rb +1 -1
- data/lib/anthropic/models/beta/memory_store_archive_params.rb +5 -4
- data/lib/anthropic/models/beta/memory_store_create_params.rb +20 -11
- data/lib/anthropic/models/beta/memory_store_delete_params.rb +5 -4
- data/lib/anthropic/models/beta/memory_store_list_params.rb +7 -9
- data/lib/anthropic/models/beta/memory_store_retrieve_params.rb +2 -3
- data/lib/anthropic/models/beta/memory_store_update_params.rb +19 -14
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_content_sha256_precondition.rb +6 -6
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_deleted_memory.rb +13 -6
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_error.rb +1 -1
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory.rb +38 -26
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_list_item.rb +17 -10
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_path_conflict_error.rb +3 -2
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_prefix.rb +7 -6
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version.rb +40 -26
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version_operation.rb +4 -2
- data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_view.rb +5 -5
- data/lib/anthropic/models/beta/memory_stores/memory_create_params.rb +18 -15
- data/lib/anthropic/models/beta/memory_stores/memory_list_params.rb +27 -19
- data/lib/anthropic/models/beta/memory_stores/memory_retrieve_params.rb +6 -6
- data/lib/anthropic/models/beta/memory_stores/memory_update_params.rb +19 -18
- data/lib/anthropic/models/beta/memory_stores/memory_version_list_params.rb +13 -10
- data/lib/anthropic/models/beta/memory_stores/memory_version_retrieve_params.rb +6 -6
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +1 -1
- data/lib/anthropic/models/beta/message_create_params.rb +1 -1
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +3 -3
- data/lib/anthropic/models/beta/organization/beta_organization_rate_limit.rb +2 -1
- data/lib/anthropic/models/beta/organization/beta_plugin.rb +34 -9
- data/lib/anthropic/models/beta/organization/plugin_marketplace_validate_repository_params.rb +9 -4
- data/lib/anthropic/models/beta/organization/plugins/beta_plugin_version.rb +13 -7
- data/lib/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit.rb +1 -1
- data/lib/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_type.rb +29 -0
- data/lib/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_update_value.rb +35 -0
- data/lib/anthropic/models/beta/organization/workspaces/rate_limit_update_params.rb +45 -0
- data/lib/anthropic/models/beta/user_profile_create_enrollment_url_params.rb +2 -3
- data/lib/anthropic/models/beta/user_profile_create_params.rb +12 -11
- data/lib/anthropic/models/beta/user_profile_delete_params.rb +48 -0
- data/lib/anthropic/models/beta/user_profile_list_params.rb +2 -3
- data/lib/anthropic/models/beta/user_profile_retrieve_params.rb +2 -3
- data/lib/anthropic/models/beta/user_profile_update_params.rb +11 -11
- data/lib/anthropic/models/beta/user_profiles/action_url_create_params.rb +58 -0
- data/lib/anthropic/models/beta/user_profiles/beta_user_profile_action_url.rb +44 -0
- data/lib/anthropic/models/beta/user_profiles/beta_user_profile_enroll_end_user_action.rb +21 -0
- data/lib/anthropic/models/beta/vault_list_params.rb +6 -4
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_credential.rb +7 -3
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_credential_networking_params.rb +1 -1
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_credential_validation.rb +3 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_credential_validation_status.rb +2 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_deleted_credential.rb +2 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_auth_response.rb +1 -1
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_create_params.rb +7 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_update_params.rb +4 -4
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_injection_location_update_params.rb +8 -1
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_limited_credential_networking_params.rb +7 -5
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_limited_credential_networking_response.rb +6 -4
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_auth_response.rb +7 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_create_params.rb +10 -4
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_params.rb +15 -5
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_response.rb +2 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_update_params.rb +14 -5
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_update_params.rb +14 -4
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_probe.rb +4 -3
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_static_bearer_create_params.rb +7 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_static_bearer_update_params.rb +2 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_basic_param.rb +7 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_basic_update_param.rb +10 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_post_param.rb +2 -2
- data/lib/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_post_update_param.rb +10 -2
- data/lib/anthropic/models/beta/vaults/credential_create_params.rb +8 -4
- data/lib/anthropic/models/beta/vaults/credential_list_params.rb +6 -4
- data/lib/anthropic/models/beta/vaults/credential_update_params.rb +14 -10
- data/lib/anthropic/models/cache_miss_messages_changed.rb +8 -0
- data/lib/anthropic/models/cache_miss_model_changed.rb +7 -0
- data/lib/anthropic/models/cache_miss_previous_message_not_found.rb +9 -0
- data/lib/anthropic/models/cache_miss_reason.rb +22 -0
- data/lib/anthropic/models/cache_miss_system_changed.rb +7 -0
- data/lib/anthropic/models/cache_miss_tools_changed.rb +7 -0
- data/lib/anthropic/models/cache_miss_unavailable.rb +11 -0
- data/lib/anthropic/models/deleted_user_profile.rb +25 -0
- data/lib/anthropic/models/message_count_tokens_params.rb +1 -1
- data/lib/anthropic/models/message_create_params.rb +1 -1
- data/lib/anthropic/models/messages/batch_create_params.rb +3 -3
- data/lib/anthropic/models/organization/organization_rate_limit.rb +2 -1
- data/lib/anthropic/models/organization/workspaces/rate_limit_update_params.rb +43 -0
- data/lib/anthropic/models/organization/workspaces/workspace_rate_limit.rb +1 -1
- data/lib/anthropic/models/organization/workspaces/workspace_rate_limit_type.rb +29 -0
- data/lib/anthropic/models/organization/workspaces/workspace_rate_limit_update_value.rb +35 -0
- data/lib/anthropic/models/user_profile.rb +108 -0
- data/lib/anthropic/models/user_profile_access_type.rb +23 -0
- data/lib/anthropic/models/user_profile_create_params.rb +74 -0
- data/lib/anthropic/models/user_profile_cyber_program.rb +52 -0
- data/lib/anthropic/models/user_profile_cyber_requirements.rb +35 -0
- data/lib/anthropic/models/user_profile_cyber_tier.rb +38 -0
- data/lib/anthropic/models/user_profile_delete_params.rb +38 -0
- data/lib/anthropic/models/user_profile_efs_feature.rb +38 -0
- data/lib/anthropic/models/user_profile_efs_program.rb +40 -0
- data/lib/anthropic/models/user_profile_external_user_account_status.rb +27 -0
- data/lib/anthropic/models/user_profile_external_user_details.rb +78 -0
- data/lib/anthropic/models/user_profile_external_user_details_params.rb +79 -0
- data/lib/anthropic/models/user_profile_external_user_entity_type.rb +19 -0
- data/lib/anthropic/models/user_profile_list_order.rb +19 -0
- data/lib/anthropic/models/user_profile_list_order_by.rb +20 -0
- data/lib/anthropic/models/user_profile_list_params.rb +67 -0
- data/lib/anthropic/models/user_profile_program_status.rb +23 -0
- data/lib/anthropic/models/user_profile_programs.rb +41 -0
- data/lib/anthropic/models/user_profile_retrieve_params.rb +38 -0
- data/lib/anthropic/models/user_profile_update_params.rb +78 -0
- data/lib/anthropic/models/user_profiles/action_url_create_params.rb +48 -0
- data/lib/anthropic/models/user_profiles/user_profile_action_url.rb +43 -0
- data/lib/anthropic/models/user_profiles/user_profile_enroll_end_user_action.rb +21 -0
- data/lib/anthropic/models.rb +44 -0
- data/lib/anthropic/resources/beta/memory_stores/memories.rb +17 -17
- data/lib/anthropic/resources/beta/memory_stores/memory_versions.rb +6 -6
- data/lib/anthropic/resources/beta/memory_stores.rb +19 -19
- data/lib/anthropic/resources/beta/messages.rb +63 -111
- data/lib/anthropic/resources/beta/organization/analytics/cost_report.rb +2 -2
- data/lib/anthropic/resources/beta/organization/analytics/usage_report.rb +2 -2
- data/lib/anthropic/resources/beta/organization/analytics/user_cost_report.rb +2 -2
- data/lib/anthropic/resources/beta/organization/analytics/user_usage_report.rb +2 -2
- data/lib/anthropic/resources/beta/organization/workspaces/rate_limits.rb +53 -0
- data/lib/anthropic/resources/beta/user_profiles/action_urls.rb +54 -0
- data/lib/anthropic/resources/beta/user_profiles.rb +41 -5
- data/lib/anthropic/resources/beta/vaults/credentials.rb +9 -9
- data/lib/anthropic/resources/beta/vaults.rb +7 -7
- data/lib/anthropic/resources/messages.rb +58 -92
- data/lib/anthropic/resources/organization/workspaces/rate_limits.rb +49 -0
- data/lib/anthropic/resources/user_profiles/action_urls.rb +50 -0
- data/lib/anthropic/resources/user_profiles.rb +196 -0
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +39 -0
- data/rbi/anthropic/client.rbi +3 -0
- data/rbi/anthropic/helpers/aws/client.rbi +13 -0
- data/rbi/anthropic/helpers/bedrock/client.rbi +4 -0
- data/rbi/anthropic/helpers/bedrock/mantle_client.rbi +9 -0
- data/rbi/anthropic/helpers/google_cloud/client.rbi +19 -2
- data/rbi/anthropic/helpers/vertex/client.rbi +4 -0
- data/rbi/anthropic/internal/report_page_cursor.rbi +28 -0
- data/rbi/anthropic/internal/tracing.rbi +9 -4
- data/rbi/anthropic/models/beta/beta_cache_miss_messages_changed.rbi +7 -0
- data/rbi/anthropic/models/beta/beta_cache_miss_model_changed.rbi +6 -0
- data/rbi/anthropic/models/beta/beta_cache_miss_previous_message_not_found.rbi +8 -0
- data/rbi/anthropic/models/beta/beta_cache_miss_system_changed.rbi +6 -0
- data/rbi/anthropic/models/beta/beta_cache_miss_tools_changed.rbi +6 -0
- data/rbi/anthropic/models/beta/beta_cache_miss_unavailable.rbi +10 -0
- data/rbi/anthropic/models/beta/beta_deleted_user_profile.rbi +40 -0
- data/rbi/anthropic/models/beta/beta_fallback_param.rbi +116 -9
- data/rbi/anthropic/models/beta/beta_managed_agents_deleted_vault.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_managed_agents_memory_store.rbi +44 -26
- data/rbi/anthropic/models/beta/beta_managed_agents_vault.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_user_profile.rbi +50 -43
- data/rbi/anthropic/models/beta/beta_user_profile_enrollment_url.rbi +1 -1
- data/rbi/anthropic/models/beta/memory_store_archive_params.rbi +8 -6
- data/rbi/anthropic/models/beta/memory_store_create_params.rbi +34 -16
- data/rbi/anthropic/models/beta/memory_store_delete_params.rbi +8 -6
- data/rbi/anthropic/models/beta/memory_store_list_params.rbi +8 -12
- data/rbi/anthropic/models/beta/memory_store_retrieve_params.rbi +2 -4
- data/rbi/anthropic/models/beta/memory_store_update_params.rbi +30 -20
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_content_sha256_precondition.rbi +6 -6
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_deleted_memory.rbi +13 -6
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory.rbi +54 -36
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_list_item.rbi +25 -18
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_path_conflict_error.rbi +3 -2
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_prefix.rbi +7 -6
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version.rbi +60 -38
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version_operation.rbi +4 -2
- data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_view.rbi +5 -5
- data/rbi/anthropic/models/beta/memory_stores/memory_create_params.rbi +30 -24
- data/rbi/anthropic/models/beta/memory_stores/memory_list_params.rbi +44 -28
- data/rbi/anthropic/models/beta/memory_stores/memory_retrieve_params.rbi +10 -10
- data/rbi/anthropic/models/beta/memory_stores/memory_update_params.rbi +32 -30
- data/rbi/anthropic/models/beta/memory_stores/memory_version_list_params.rbi +22 -16
- data/rbi/anthropic/models/beta/memory_stores/memory_version_retrieve_params.rbi +10 -10
- data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +2 -2
- data/rbi/anthropic/models/beta/message_create_params.rbi +2 -2
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +6 -6
- data/rbi/anthropic/models/beta/organization/beta_organization_rate_limit.rbi +4 -2
- data/rbi/anthropic/models/beta/organization/beta_plugin.rbi +49 -11
- data/rbi/anthropic/models/beta/organization/plugin_marketplace_validate_repository_params.rbi +18 -8
- data/rbi/anthropic/models/beta/organization/plugins/beta_plugin_version.rbi +20 -8
- data/rbi/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_type.rbi +81 -0
- data/rbi/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_update_value.rbi +62 -0
- data/rbi/anthropic/models/beta/organization/workspaces/rate_limit_update_params.rbi +80 -0
- data/rbi/anthropic/models/beta/user_profile_create_enrollment_url_params.rbi +2 -4
- data/rbi/anthropic/models/beta/user_profile_create_params.rbi +22 -20
- data/rbi/anthropic/models/beta/user_profile_delete_params.rbi +91 -0
- data/rbi/anthropic/models/beta/user_profile_list_params.rbi +2 -4
- data/rbi/anthropic/models/beta/user_profile_retrieve_params.rbi +2 -4
- data/rbi/anthropic/models/beta/user_profile_update_params.rbi +20 -20
- data/rbi/anthropic/models/beta/user_profiles/action_url_create_params.rbi +116 -0
- data/rbi/anthropic/models/beta/user_profiles/beta_user_profile_action_url.rbi +55 -0
- data/rbi/anthropic/models/beta/user_profiles/beta_user_profile_enroll_end_user_action.rbi +31 -0
- data/rbi/anthropic/models/beta/vault_list_params.rbi +8 -4
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_credential.rbi +4 -3
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_credential_networking_params.rbi +6 -4
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_credential_validation.rbi +4 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_credential_validation_status.rbi +2 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_deleted_credential.rbi +2 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_auth_response.rbi +5 -3
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_create_params.rbi +4 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_update_params.rbi +4 -4
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_injection_location_update_params.rbi +8 -1
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_limited_credential_networking_params.rbi +12 -8
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_limited_credential_networking_response.rbi +10 -6
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_auth_response.rbi +4 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_create_params.rbi +8 -4
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_params.rbi +10 -5
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_response.rbi +2 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_update_params.rbi +11 -5
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_update_params.rbi +16 -4
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_probe.rbi +6 -4
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_static_bearer_create_params.rbi +4 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_static_bearer_update_params.rbi +2 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_basic_param.rbi +4 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_basic_update_param.rbi +10 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_post_param.rbi +2 -2
- data/rbi/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_post_update_param.rbi +10 -2
- data/rbi/anthropic/models/beta/vaults/credential_create_params.rbi +8 -4
- data/rbi/anthropic/models/beta/vaults/credential_list_params.rbi +8 -4
- data/rbi/anthropic/models/beta/vaults/credential_update_params.rbi +17 -11
- data/rbi/anthropic/models/cache_miss_messages_changed.rbi +7 -0
- data/rbi/anthropic/models/cache_miss_model_changed.rbi +6 -0
- data/rbi/anthropic/models/cache_miss_previous_message_not_found.rbi +8 -0
- data/rbi/anthropic/models/cache_miss_system_changed.rbi +6 -0
- data/rbi/anthropic/models/cache_miss_tools_changed.rbi +6 -0
- data/rbi/anthropic/models/cache_miss_unavailable.rbi +10 -0
- data/rbi/anthropic/models/deleted_user_profile.rbi +33 -0
- data/rbi/anthropic/models/message_count_tokens_params.rbi +2 -2
- data/rbi/anthropic/models/message_create_params.rbi +2 -2
- data/rbi/anthropic/models/messages/batch_create_params.rbi +6 -6
- data/rbi/anthropic/models/organization/organization_rate_limit.rbi +4 -2
- data/rbi/anthropic/models/organization/workspaces/rate_limit_update_params.rbi +78 -0
- data/rbi/anthropic/models/organization/workspaces/workspace_rate_limit_type.rbi +81 -0
- data/rbi/anthropic/models/organization/workspaces/workspace_rate_limit_update_value.rbi +62 -0
- data/rbi/anthropic/models/user_profile.rbi +152 -0
- data/rbi/anthropic/models/user_profile_access_type.rbi +34 -0
- data/rbi/anthropic/models/user_profile_create_params.rbi +135 -0
- data/rbi/anthropic/models/user_profile_cyber_program.rbi +95 -0
- data/rbi/anthropic/models/user_profile_cyber_requirements.rbi +52 -0
- data/rbi/anthropic/models/user_profile_cyber_tier.rbi +69 -0
- data/rbi/anthropic/models/user_profile_delete_params.rbi +67 -0
- data/rbi/anthropic/models/user_profile_efs_feature.rbi +69 -0
- data/rbi/anthropic/models/user_profile_efs_program.rbi +66 -0
- data/rbi/anthropic/models/user_profile_external_user_account_status.rbi +52 -0
- data/rbi/anthropic/models/user_profile_external_user_details.rbi +125 -0
- data/rbi/anthropic/models/user_profile_external_user_details_params.rbi +131 -0
- data/rbi/anthropic/models/user_profile_external_user_entity_type.rbi +46 -0
- data/rbi/anthropic/models/user_profile_list_order.rbi +28 -0
- data/rbi/anthropic/models/user_profile_list_order_by.rbi +30 -0
- data/rbi/anthropic/models/user_profile_list_params.rbi +110 -0
- data/rbi/anthropic/models/user_profile_program_status.rbi +34 -0
- data/rbi/anthropic/models/user_profile_programs.rbi +77 -0
- data/rbi/anthropic/models/user_profile_retrieve_params.rbi +67 -0
- data/rbi/anthropic/models/user_profile_update_params.rbi +130 -0
- data/rbi/anthropic/models/user_profiles/action_url_create_params.rbi +86 -0
- data/rbi/anthropic/models/user_profiles/user_profile_action_url.rbi +55 -0
- data/rbi/anthropic/models/user_profiles/user_profile_enroll_end_user_action.rbi +32 -0
- data/rbi/anthropic/models.rbi +48 -0
- data/rbi/anthropic/resources/beta/memory_stores/memories.rbi +65 -51
- data/rbi/anthropic/resources/beta/memory_stores/memory_versions.rbi +19 -16
- data/rbi/anthropic/resources/beta/memory_stores.rbi +53 -38
- data/rbi/anthropic/resources/beta/messages/batches.rbi +3 -4
- data/rbi/anthropic/resources/beta/messages.rbi +192 -198
- data/rbi/anthropic/resources/beta/organization/analytics/cost_report.rbi +1 -1
- data/rbi/anthropic/resources/beta/organization/analytics/usage_report.rbi +1 -1
- data/rbi/anthropic/resources/beta/organization/analytics/user_cost_report.rbi +1 -1
- data/rbi/anthropic/resources/beta/organization/analytics/user_usage_report.rbi +1 -1
- data/rbi/anthropic/resources/beta/organization/plugin_marketplaces.rbi +9 -4
- data/rbi/anthropic/resources/beta/organization/workspaces/rate_limits.rbi +35 -0
- data/rbi/anthropic/resources/beta/user_profiles/action_urls.rbi +46 -0
- data/rbi/anthropic/resources/beta/user_profiles.rbi +51 -28
- data/rbi/anthropic/resources/beta/vaults/credentials.rbi +13 -11
- data/rbi/anthropic/resources/beta/vaults.rbi +10 -7
- data/rbi/anthropic/resources/messages/batches.rbi +3 -4
- data/rbi/anthropic/resources/messages.rbi +122 -132
- data/rbi/anthropic/resources/organization/workspaces/rate_limits.rbi +33 -0
- data/rbi/anthropic/resources/user_profiles/action_urls.rbi +40 -0
- data/rbi/anthropic/resources/user_profiles.rbi +184 -0
- data/sig/anthropic/client.rbs +2 -0
- data/sig/anthropic/helpers/bedrock/client.rbs +2 -0
- data/sig/anthropic/helpers/google_cloud/client.rbs +10 -1
- data/sig/anthropic/helpers/vertex/client.rbs +2 -0
- data/sig/anthropic/internal/report_page_cursor.rbs +17 -0
- data/sig/anthropic/internal/tracing.rbs +7 -4
- data/sig/anthropic/models/beta/beta_deleted_user_profile.rbs +20 -0
- data/sig/anthropic/models/beta/beta_user_profile.rbs +8 -8
- data/sig/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_type.rbs +36 -0
- data/sig/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_update_value.rbs +31 -0
- data/sig/anthropic/models/beta/organization/workspaces/rate_limit_update_params.rbs +42 -0
- data/sig/anthropic/models/beta/user_profile_delete_params.rbs +44 -0
- data/sig/anthropic/models/beta/user_profiles/action_url_create_params.rbs +51 -0
- data/sig/anthropic/models/beta/user_profiles/beta_user_profile_action_url.rbs +30 -0
- data/sig/anthropic/models/beta/user_profiles/beta_user_profile_enroll_end_user_action.rbs +18 -0
- data/sig/anthropic/models/beta/vaults/beta_managed_agents_credential_validation_status.rbs +2 -2
- data/sig/anthropic/models/deleted_user_profile.rbs +15 -0
- data/sig/anthropic/models/organization/workspaces/rate_limit_update_params.rbs +40 -0
- data/sig/anthropic/models/organization/workspaces/workspace_rate_limit_type.rbs +36 -0
- data/sig/anthropic/models/organization/workspaces/workspace_rate_limit_update_value.rbs +31 -0
- data/sig/anthropic/models/user_profile.rbs +60 -0
- data/sig/anthropic/models/user_profile_access_type.rbs +17 -0
- data/sig/anthropic/models/user_profile_create_params.rbs +58 -0
- data/sig/anthropic/models/user_profile_cyber_program.rbs +30 -0
- data/sig/anthropic/models/user_profile_cyber_requirements.rbs +16 -0
- data/sig/anthropic/models/user_profile_cyber_tier.rbs +29 -0
- data/sig/anthropic/models/user_profile_delete_params.rbs +30 -0
- data/sig/anthropic/models/user_profile_efs_feature.rbs +29 -0
- data/sig/anthropic/models/user_profile_efs_program.rbs +25 -0
- data/sig/anthropic/models/user_profile_external_user_account_status.rbs +21 -0
- data/sig/anthropic/models/user_profile_external_user_details.rbs +50 -0
- data/sig/anthropic/models/user_profile_external_user_details_params.rbs +52 -0
- data/sig/anthropic/models/user_profile_external_user_entity_type.rbs +17 -0
- data/sig/anthropic/models/user_profile_list_order.rbs +17 -0
- data/sig/anthropic/models/user_profile_list_order_by.rbs +17 -0
- data/sig/anthropic/models/user_profile_list_params.rbs +60 -0
- data/sig/anthropic/models/user_profile_program_status.rbs +20 -0
- data/sig/anthropic/models/user_profile_programs.rbs +25 -0
- data/sig/anthropic/models/user_profile_retrieve_params.rbs +30 -0
- data/sig/anthropic/models/user_profile_update_params.rbs +59 -0
- data/sig/anthropic/models/user_profiles/action_url_create_params.rbs +40 -0
- data/sig/anthropic/models/user_profiles/user_profile_action_url.rbs +30 -0
- data/sig/anthropic/models/user_profiles/user_profile_enroll_end_user_action.rbs +17 -0
- data/sig/anthropic/models.rbs +44 -0
- data/sig/anthropic/resources/beta/messages.rbs +24 -24
- data/sig/anthropic/resources/beta/organization/analytics/cost_report.rbs +1 -1
- data/sig/anthropic/resources/beta/organization/analytics/usage_report.rbs +1 -1
- data/sig/anthropic/resources/beta/organization/analytics/user_cost_report.rbs +1 -1
- data/sig/anthropic/resources/beta/organization/analytics/user_usage_report.rbs +1 -1
- data/sig/anthropic/resources/beta/organization/workspaces/rate_limits.rbs +7 -0
- data/sig/anthropic/resources/beta/user_profiles/action_urls.rbs +19 -0
- data/sig/anthropic/resources/beta/user_profiles.rbs +9 -0
- data/sig/anthropic/resources/messages.rbs +19 -19
- data/sig/anthropic/resources/organization/workspaces/rate_limits.rbs +7 -0
- data/sig/anthropic/resources/user_profiles/action_urls.rbs +16 -0
- data/sig/anthropic/resources/user_profiles.rbs +49 -0
- metadata +119 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 154fbf0eeb1ef7997d8bc33f44e588fbe3fb3327aed6be57fba6d6459703d580
|
|
4
|
+
data.tar.gz: 974d03138f614db3ecc816de5c3d25e4862951faf84b0679ee8058758a89789e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e8701990520600baf05a9a240c836ba0245272b08a4df77a52d13da4d6c29cfaf4c884671ec3d2e8cec60a067ab5a859feff5630dbe1d3b796372bf691402408
|
|
7
|
+
data.tar.gz: bdad1379435404bc3ad2ab1534024c9a7baaa3bfbce296080e51fec7a31c9f1a95650f86c3e42ff94eb9b1dcd30c3f412bca8718148cbbd50b05b33c05624392
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.81.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.80.0...v1.81.0) (2026-10-20)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **api:** add data_refreshed_at and has_more to analytics report pages
|
|
8
|
+
* **api:** add workspace rate-limit updates to the Admin API
|
|
9
|
+
* **api:** make User Profiles generally available
|
|
10
|
+
* **client:** yield server-sent events with unrecognized event names
|
|
11
|
+
* **google-cloud:** use the v1 endpoints and add the organization endpoint
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **client:** `messages.stream` and `beta.messages.stream` now take the same parameters as `stream_raw`; their Sorbet and RBS signatures take one params hash
|
|
17
|
+
* **types:** type the keyword parameters of messages.stream and beta.messages.stream
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
|
|
22
|
+
* **ci:** publish gems from a fixed Ubuntu 24.04 runner
|
|
23
|
+
* **ci:** set up Ruby 3.2 with a newer setup-ruby in the build and dependency version jobs
|
|
24
|
+
* **ci:** skip the changelog check on draft pull requests
|
|
25
|
+
* **docs:** add credential expiry descriptions to the Managed Agents API reference
|
|
26
|
+
* **docs:** add Messages API request descriptions
|
|
27
|
+
* **docs:** correct plugin manifest_version and reach descriptions
|
|
28
|
+
* **docs:** improve Managed Agents memory store descriptions
|
|
29
|
+
* **docs:** improve Managed Agents vault and credential descriptions
|
|
30
|
+
* **tests:** cover per-request timeouts and later union variants
|
|
31
|
+
* **tests:** make the tracing tests independent of test order
|
|
32
|
+
* **tests:** send events that the stream yields in the tracing test
|
|
33
|
+
|
|
3
34
|
## [1.80.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.79.0...v1.80.0) (2026-10-15)
|
|
4
35
|
|
|
5
36
|
### Features
|
data/README.md
CHANGED
data/lib/anthropic/client.rb
CHANGED
|
@@ -82,6 +82,9 @@ module Anthropic
|
|
|
82
82
|
# @return [Anthropic::Resources::Skills]
|
|
83
83
|
attr_reader :skills
|
|
84
84
|
|
|
85
|
+
# @return [Anthropic::Resources::UserProfiles]
|
|
86
|
+
attr_reader :user_profiles
|
|
87
|
+
|
|
85
88
|
# @return [Anthropic::Resources::Organization]
|
|
86
89
|
attr_reader :organization
|
|
87
90
|
|
|
@@ -342,6 +345,7 @@ module Anthropic
|
|
|
342
345
|
@models = Anthropic::Resources::Models.new(client: self)
|
|
343
346
|
@files = Anthropic::Resources::Files.new(client: self)
|
|
344
347
|
@skills = Anthropic::Resources::Skills.new(client: self)
|
|
348
|
+
@user_profiles = Anthropic::Resources::UserProfiles.new(client: self)
|
|
345
349
|
@organization = Anthropic::Resources::Organization.new(client: self)
|
|
346
350
|
@beta = Anthropic::Resources::Beta.new(client: self)
|
|
347
351
|
end
|
|
@@ -91,9 +91,9 @@ module Anthropic
|
|
|
91
91
|
|
|
92
92
|
# In API-key mode the gateway key rides the base client's `api_key`
|
|
93
93
|
# slot; {#resolve_default_credentials?} keeps first-party credential
|
|
94
|
-
# auto-discovery out of the picture when it is absent.
|
|
95
|
-
#
|
|
96
|
-
#
|
|
94
|
+
# auto-discovery out of the picture when it is absent. Every resource
|
|
95
|
+
# the parent wires up stays available; {#build_request} rejects the
|
|
96
|
+
# one route the gateway does not serve.
|
|
97
97
|
super(
|
|
98
98
|
api_key: effective_api_key,
|
|
99
99
|
base_url: resolved_base_url,
|
|
@@ -105,6 +105,23 @@ module Anthropic
|
|
|
105
105
|
)
|
|
106
106
|
end
|
|
107
107
|
|
|
108
|
+
# @api private
|
|
109
|
+
#
|
|
110
|
+
# Fails fast on user profile action URLs, which the gateway does not serve.
|
|
111
|
+
#
|
|
112
|
+
# @param req [Hash{Symbol=>Object}]
|
|
113
|
+
# @param opts [Hash{Symbol=>Object}]
|
|
114
|
+
# @return [Hash{Symbol=>Object}]
|
|
115
|
+
private def build_request(req, opts)
|
|
116
|
+
# Id-parameterized routes pass `path` as an Array whose first element
|
|
117
|
+
# is the format string (e.g. `["v1/user_profiles/%1$s/action_urls", id]`).
|
|
118
|
+
if Array(req[:path]).first.to_s.match?(%r{\Av1/user_profiles/[^/]+/action_urls})
|
|
119
|
+
raise NotImplementedError.new("User profile action URLs are not supported on the AWS gateway.")
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
super
|
|
123
|
+
end
|
|
124
|
+
|
|
108
125
|
# @api private
|
|
109
126
|
#
|
|
110
127
|
# @return [String]
|
|
@@ -169,6 +169,10 @@ module Anthropic
|
|
|
169
169
|
raise NotImplementedError, "Skills are not supported on Bedrock."
|
|
170
170
|
end
|
|
171
171
|
|
|
172
|
+
def user_profiles
|
|
173
|
+
raise NotImplementedError, "User profiles are not supported on Bedrock."
|
|
174
|
+
end
|
|
175
|
+
|
|
172
176
|
# @api private
|
|
173
177
|
#
|
|
174
178
|
# @param req [Hash{Symbol=>Object}] .
|
|
@@ -318,6 +322,8 @@ module Anthropic
|
|
|
318
322
|
message = "Please instead use https://docs.anthropic.com/en/api/claude-on-amazon-bedrock#list-available-models to list available models on Bedrock."
|
|
319
323
|
# rubocop:enable Layout/LineLength
|
|
320
324
|
raise NotImplementedError.new(message)
|
|
325
|
+
in %r{^v1/user_profiles}
|
|
326
|
+
raise NotImplementedError.new("User profiles are not supported on Bedrock.")
|
|
321
327
|
else
|
|
322
328
|
end
|
|
323
329
|
end
|
|
@@ -131,6 +131,13 @@ module Anthropic
|
|
|
131
131
|
"Skills are not supported on Bedrock Mantle. Only Messages (/v1/messages) is supported."
|
|
132
132
|
end
|
|
133
133
|
|
|
134
|
+
# User profiles are not supported on Bedrock Mantle. Only Messages (/v1/messages) is supported.
|
|
135
|
+
def user_profiles
|
|
136
|
+
raise NotImplementedError,
|
|
137
|
+
"User profiles are not supported on Bedrock Mantle. " \
|
|
138
|
+
"Only Messages (/v1/messages) is supported."
|
|
139
|
+
end
|
|
140
|
+
|
|
134
141
|
# @api private
|
|
135
142
|
#
|
|
136
143
|
# @return [Hash{String=>String}]
|
|
@@ -146,10 +153,36 @@ module Anthropic
|
|
|
146
153
|
# @api private
|
|
147
154
|
#
|
|
148
155
|
# @return [#call]
|
|
149
|
-
private def provider_middleware
|
|
156
|
+
private def provider_middleware
|
|
157
|
+
->(req, nxt) { aws_auth_provider(adapt_request(req), nxt) }
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# @api private
|
|
161
|
+
#
|
|
162
|
+
# Mantle drops custom request headers, so Messages and token counting send the user profile ID
|
|
163
|
+
# in the body.
|
|
164
|
+
#
|
|
165
|
+
# @param req [Anthropic::APIRequest]
|
|
166
|
+
# @return [Anthropic::APIRequest]
|
|
167
|
+
private def adapt_request(req)
|
|
168
|
+
path = req.url.path.to_s
|
|
169
|
+
return req unless req.method == :post && path.end_with?("/v1/messages", "/v1/messages/count_tokens")
|
|
170
|
+
|
|
171
|
+
body = req.body
|
|
172
|
+
profile_headers, headers = req.headers.partition do |name, _|
|
|
173
|
+
name.to_s.casecmp?("anthropic-user-profile-id")
|
|
174
|
+
end
|
|
175
|
+
user_profile_id = profile_headers.last&.last
|
|
176
|
+
return req if user_profile_id.to_s.empty? || !body.is_a?(Hash)
|
|
177
|
+
|
|
178
|
+
unless body.keys.any? { _1.to_s == "user_profile_id" }
|
|
179
|
+
body = {**body, user_profile_id: user_profile_id}
|
|
180
|
+
end
|
|
181
|
+
req.with(headers: headers.to_h, body: body)
|
|
182
|
+
end
|
|
150
183
|
|
|
151
184
|
# Restricted Beta service that only exposes messages. Other beta resources
|
|
152
|
-
# (models, files, skills) are not supported on Bedrock Mantle.
|
|
185
|
+
# (models, files, skills, user profiles) are not supported on Bedrock Mantle.
|
|
153
186
|
class MantleBeta
|
|
154
187
|
# @return [Anthropic::Resources::Beta::Messages]
|
|
155
188
|
attr_reader :messages
|
|
@@ -173,6 +206,12 @@ module Anthropic
|
|
|
173
206
|
raise NotImplementedError,
|
|
174
207
|
"Beta skills are not supported on Bedrock Mantle. Only Messages (/v1/messages) is supported."
|
|
175
208
|
end
|
|
209
|
+
|
|
210
|
+
def user_profiles
|
|
211
|
+
raise NotImplementedError,
|
|
212
|
+
"Beta user profiles are not supported on Bedrock Mantle. " \
|
|
213
|
+
"Only Messages (/v1/messages) is supported."
|
|
214
|
+
end
|
|
176
215
|
end
|
|
177
216
|
end
|
|
178
217
|
end
|
|
@@ -10,17 +10,26 @@ module Anthropic
|
|
|
10
10
|
# `:rawPredict` publisher-model API (publisher model IDs, messages
|
|
11
11
|
# only). This client speaks the full first-party Anthropic API: requests
|
|
12
12
|
# pass through the gateway unchanged — standard `/v1/*` paths, standard
|
|
13
|
-
# model names
|
|
14
|
-
#
|
|
13
|
+
# model names. The deprecated text Completions endpoint is intentionally
|
|
14
|
+
# not exposed, and the gateway does not serve the User Profiles API.
|
|
15
15
|
class Client < Anthropic::Client
|
|
16
16
|
# OAuth2 scope required to call the gateway.
|
|
17
17
|
SCOPE = "https://www.googleapis.com/auth/cloud-platform"
|
|
18
18
|
|
|
19
|
+
LOCATION_URL_TEMPLATE =
|
|
20
|
+
"https://claude.googleapis.com/v1/projects/%<project>s/locations/%<location>s"
|
|
21
|
+
|
|
19
22
|
# Gateway base URL template; override via `base_url` or
|
|
20
23
|
# `ANTHROPIC_GOOGLE_CLOUD_BASE_URL`.
|
|
21
|
-
URL_TEMPLATE =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
URL_TEMPLATE = "#{LOCATION_URL_TEMPLATE}/workspaces/%<workspace_id>s/invoke".freeze
|
|
25
|
+
|
|
26
|
+
# Gateway base URL template for organization-level routes, which are
|
|
27
|
+
# served from a base with no workspace in it.
|
|
28
|
+
ORGANIZATION_URL_TEMPLATE = "#{LOCATION_URL_TEMPLATE}/claudeOrganization/invoke".freeze
|
|
29
|
+
|
|
30
|
+
ORGANIZATION_PATH_PREFIX = "/v1/organizations/"
|
|
31
|
+
|
|
32
|
+
private_constant :LOCATION_URL_TEMPLATE, :ORGANIZATION_PATH_PREFIX
|
|
24
33
|
|
|
25
34
|
# @return [String, nil]
|
|
26
35
|
attr_reader :project
|
|
@@ -53,12 +62,14 @@ module Anthropic
|
|
|
53
62
|
# explicit `nil` falls back to the same defaults.
|
|
54
63
|
#
|
|
55
64
|
# @param workspace_id [String, nil] Defaults to
|
|
56
|
-
# `ENV["ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID"]`. Required
|
|
57
|
-
#
|
|
65
|
+
# `ENV["ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID"]`. Required when the base
|
|
66
|
+
# URL is derived, except for organization-level routes
|
|
67
|
+
# (`/v1/organizations/`), which need no workspace ID.
|
|
58
68
|
#
|
|
59
|
-
# @param base_url [String, nil] Override the gateway base URL
|
|
60
|
-
# `ENV["ANTHROPIC_GOOGLE_CLOUD_BASE_URL"]`, otherwise
|
|
61
|
-
# `project`, `location`, and `workspace_id` via
|
|
69
|
+
# @param base_url [String, nil] Override the gateway base URL for every
|
|
70
|
+
# route. Defaults to `ENV["ANTHROPIC_GOOGLE_CLOUD_BASE_URL"]`, otherwise
|
|
71
|
+
# derived from `project`, `location`, and `workspace_id` via
|
|
72
|
+
# {URL_TEMPLATE}.
|
|
62
73
|
#
|
|
63
74
|
# @param google_credentials [#apply, nil] A `googleauth`-compatible
|
|
64
75
|
# credentials object. Mutually exclusive with `skip_auth`.
|
|
@@ -67,10 +78,9 @@ module Anthropic
|
|
|
67
78
|
# token string. Takes precedence over `google_credentials`. Mutually
|
|
68
79
|
# exclusive with `skip_auth`.
|
|
69
80
|
#
|
|
70
|
-
# @param skip_auth [Boolean] When true, no token is attached
|
|
71
|
-
#
|
|
72
|
-
#
|
|
73
|
-
# exclusive with `token_provider` and `google_credentials`.
|
|
81
|
+
# @param skip_auth [Boolean] When true, no token is attached. For callers
|
|
82
|
+
# fronting with their own authenticated proxy. Mutually exclusive with
|
|
83
|
+
# `token_provider` and `google_credentials`.
|
|
74
84
|
#
|
|
75
85
|
# @param max_retries [Integer] Max number of retries to attempt after a
|
|
76
86
|
# failed retryable request.
|
|
@@ -132,23 +142,23 @@ module Anthropic
|
|
|
132
142
|
# so nil can't reach the derived URL (matches the other SDKs).
|
|
133
143
|
@location = location || ENV["ANTHROPIC_GOOGLE_CLOUD_LOCATION"] || "global"
|
|
134
144
|
|
|
135
|
-
if workspace_id.nil? && !skip_auth
|
|
136
|
-
raise ArgumentError.new(
|
|
137
|
-
"No workspace ID was given. Set the `workspace_id` argument or the " \
|
|
138
|
-
"`ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID` environment variable."
|
|
139
|
-
)
|
|
140
|
-
end
|
|
141
145
|
@workspace_id = workspace_id
|
|
142
146
|
|
|
143
147
|
base_url = nil if base_url.to_s.empty?
|
|
144
|
-
base_url
|
|
148
|
+
unless base_url
|
|
149
|
+
@organization_base_url = URI.parse(derive_base_url(ORGANIZATION_URL_TEMPLATE))
|
|
150
|
+
# Without a workspace ID there is no workspace base to derive, so
|
|
151
|
+
# `base_url` is the organization base.
|
|
152
|
+
base_url = @workspace_id.nil? ? @organization_base_url.to_s : derive_base_url(URL_TEMPLATE)
|
|
153
|
+
end
|
|
145
154
|
|
|
146
155
|
# No first-party credential is ever passed up, and
|
|
147
156
|
# {#resolve_default_credentials?} keeps the parent from discovering
|
|
148
157
|
# one; `base_url` is always resolved by this point, so the parent's
|
|
149
158
|
# `ANTHROPIC_BASE_URL` fallback never applies. The parent wires up
|
|
150
|
-
# every resource; {#completions}
|
|
151
|
-
# not serve
|
|
159
|
+
# every resource; {#completions} and {#user_profiles} withhold the
|
|
160
|
+
# ones the gateway does not serve, and {#build_request} refuses the
|
|
161
|
+
# user profile routes however the resource is reached.
|
|
152
162
|
super(
|
|
153
163
|
base_url: base_url,
|
|
154
164
|
timeout: timeout,
|
|
@@ -176,6 +186,83 @@ module Anthropic
|
|
|
176
186
|
)
|
|
177
187
|
end
|
|
178
188
|
|
|
189
|
+
# User profiles are not supported on the Google Cloud gateway.
|
|
190
|
+
#
|
|
191
|
+
# @raise [NotImplementedError]
|
|
192
|
+
def user_profiles
|
|
193
|
+
raise NotImplementedError.new("User profiles are not supported on the Google Cloud gateway.")
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# @api private
|
|
197
|
+
#
|
|
198
|
+
# @param req [Hash{Symbol=>Object}] .
|
|
199
|
+
#
|
|
200
|
+
# @option req [Symbol] :method
|
|
201
|
+
#
|
|
202
|
+
# @option req [String, Array<String>] :path
|
|
203
|
+
#
|
|
204
|
+
# @option req [Hash{String=>Array<String>, String, nil}, nil] :query
|
|
205
|
+
#
|
|
206
|
+
# @option req [Hash{String=>String, Integer, Array<String, Integer, nil>, nil}, nil] :headers
|
|
207
|
+
#
|
|
208
|
+
# @option req [Object, nil] :body
|
|
209
|
+
#
|
|
210
|
+
# @option req [Symbol, Integer, Array<Symbol, Integer>, Proc, nil] :unwrap
|
|
211
|
+
#
|
|
212
|
+
# @option req [Class<Anthropic::Internal::Type::BasePage>, nil] :page
|
|
213
|
+
#
|
|
214
|
+
# @option req [Class<Anthropic::Internal::Type::BaseStream>, nil] :stream
|
|
215
|
+
#
|
|
216
|
+
# @option req [Anthropic::Internal::Type::Converter, Class, nil] :model
|
|
217
|
+
#
|
|
218
|
+
# @param opts [Hash{Symbol=>Object}] .
|
|
219
|
+
#
|
|
220
|
+
# @option opts [String, nil] :idempotency_key
|
|
221
|
+
#
|
|
222
|
+
# @option opts [Hash{String=>Array<String>, String, nil}, nil] :extra_query
|
|
223
|
+
#
|
|
224
|
+
# @option opts [Hash{String=>String, nil}, nil] :extra_headers
|
|
225
|
+
#
|
|
226
|
+
# @option opts [Object, nil] :extra_body
|
|
227
|
+
#
|
|
228
|
+
# @option opts [Integer, nil] :max_retries
|
|
229
|
+
#
|
|
230
|
+
# @option opts [Float, nil] :timeout
|
|
231
|
+
#
|
|
232
|
+
# @raise [ArgumentError]
|
|
233
|
+
# @raise [NotImplementedError]
|
|
234
|
+
# @return [Hash{Symbol=>Object}]
|
|
235
|
+
private def build_request(req, opts)
|
|
236
|
+
# Id-parameterized routes pass `path` as an Array whose first element
|
|
237
|
+
# is the format string (e.g. `["v1/user_profiles/%1$s", id]`).
|
|
238
|
+
if Array(req[:path]).first.to_s.start_with?("v1/user_profiles")
|
|
239
|
+
raise NotImplementedError.new("User profiles are not supported on the Google Cloud gateway.")
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
request = super
|
|
243
|
+
return request if @organization_base_url.nil?
|
|
244
|
+
|
|
245
|
+
url = request.fetch(:url)
|
|
246
|
+
under_base_url =
|
|
247
|
+
url.path.start_with?("#{base_url.path}/") &&
|
|
248
|
+
Anthropic::Internal::Util.uri_origin(url) == Anthropic::Internal::Util.uri_origin(base_url)
|
|
249
|
+
return request unless under_base_url
|
|
250
|
+
|
|
251
|
+
path = url.path.delete_prefix(base_url.path)
|
|
252
|
+
if path.start_with?(ORGANIZATION_PATH_PREFIX)
|
|
253
|
+
url = url.dup
|
|
254
|
+
url.path = "#{@organization_base_url.path}#{path}"
|
|
255
|
+
{**request, url: url}
|
|
256
|
+
elsif @workspace_id.nil?
|
|
257
|
+
raise ArgumentError.new(
|
|
258
|
+
"No workspace ID was given. Set the `workspace_id` argument or the " \
|
|
259
|
+
"`ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID` environment variable."
|
|
260
|
+
)
|
|
261
|
+
else
|
|
262
|
+
request
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
179
266
|
# @api private
|
|
180
267
|
#
|
|
181
268
|
# Hard guarantee that no first-party `X-Api-Key` / `Authorization`
|
|
@@ -230,9 +317,10 @@ module Anthropic
|
|
|
230
317
|
|
|
231
318
|
# @api private
|
|
232
319
|
#
|
|
320
|
+
# @param template [String]
|
|
233
321
|
# @return [String]
|
|
234
322
|
# @raise [ArgumentError]
|
|
235
|
-
private def derive_base_url
|
|
323
|
+
private def derive_base_url(template)
|
|
236
324
|
if @project.nil?
|
|
237
325
|
raise ArgumentError.new(
|
|
238
326
|
"No project found. Set the `project` argument, set the " \
|
|
@@ -240,13 +328,7 @@ module Anthropic
|
|
|
240
328
|
"application default credentials with a project."
|
|
241
329
|
)
|
|
242
330
|
end
|
|
243
|
-
|
|
244
|
-
raise ArgumentError.new(
|
|
245
|
-
"No workspace ID was given. Set the `workspace_id` argument or the " \
|
|
246
|
-
"`ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID` environment variable."
|
|
247
|
-
)
|
|
248
|
-
end
|
|
249
|
-
format(URL_TEMPLATE, project: @project, location: @location, workspace_id: @workspace_id)
|
|
331
|
+
format(template, project: @project, location: @location, workspace_id: @workspace_id)
|
|
250
332
|
end
|
|
251
333
|
|
|
252
334
|
# @api private
|
|
@@ -141,6 +141,10 @@ module Anthropic
|
|
|
141
141
|
raise NotImplementedError, "Skills are not supported on Vertex."
|
|
142
142
|
end
|
|
143
143
|
|
|
144
|
+
def user_profiles
|
|
145
|
+
raise NotImplementedError, "Managing user profiles is not supported on Vertex."
|
|
146
|
+
end
|
|
147
|
+
|
|
144
148
|
# @api private
|
|
145
149
|
#
|
|
146
150
|
# @param req [Hash{Symbol=>Object}] .
|
|
@@ -185,6 +189,9 @@ module Anthropic
|
|
|
185
189
|
if path.start_with?("v1/messages/batches")
|
|
186
190
|
raise NotImplementedError.new("The Batch API is not supported in the Vertex client yet")
|
|
187
191
|
end
|
|
192
|
+
if path.start_with?("v1/user_profiles")
|
|
193
|
+
raise NotImplementedError.new("Managing user profiles is not supported on Vertex.")
|
|
194
|
+
end
|
|
188
195
|
|
|
189
196
|
super
|
|
190
197
|
end
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Internal
|
|
5
|
+
# @generic Elem
|
|
6
|
+
#
|
|
7
|
+
# @example
|
|
8
|
+
# if report_page_cursor.has_next?
|
|
9
|
+
# report_page_cursor = report_page_cursor.next_page
|
|
10
|
+
# end
|
|
11
|
+
#
|
|
12
|
+
# @example
|
|
13
|
+
# report_page_cursor.auto_paging_each do |usage_report|
|
|
14
|
+
# puts(usage_report)
|
|
15
|
+
# end
|
|
16
|
+
class ReportPageCursor
|
|
17
|
+
include Anthropic::Internal::Type::BasePage
|
|
18
|
+
|
|
19
|
+
# @return [Array<generic<Elem>>, nil]
|
|
20
|
+
attr_accessor :data
|
|
21
|
+
|
|
22
|
+
# @return [String, nil]
|
|
23
|
+
attr_accessor :next_page_
|
|
24
|
+
|
|
25
|
+
# @return [Boolean]
|
|
26
|
+
attr_accessor :has_more
|
|
27
|
+
|
|
28
|
+
# @return [Time, nil]
|
|
29
|
+
attr_accessor :data_refreshed_at
|
|
30
|
+
|
|
31
|
+
# @return [Boolean]
|
|
32
|
+
def next_page?
|
|
33
|
+
return false if has_more == false
|
|
34
|
+
|
|
35
|
+
!next_page_.to_s.empty?
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# @raise [Anthropic::HTTP::Error]
|
|
39
|
+
# @return [self]
|
|
40
|
+
def next_page
|
|
41
|
+
unless next_page?
|
|
42
|
+
message = "No more pages available. Please check #next_page? before calling ##{__method__}"
|
|
43
|
+
raise RuntimeError.new(message)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
req = Anthropic::Internal::Util.deep_merge(@req, {query: {page: next_page_}})
|
|
47
|
+
@client.request(req)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# @param blk [Proc]
|
|
51
|
+
#
|
|
52
|
+
# @yieldparam [generic<Elem>]
|
|
53
|
+
def auto_paging_each(&blk)
|
|
54
|
+
unless block_given?
|
|
55
|
+
raise ArgumentError.new("A block must be given to ##{__method__}")
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
page = self
|
|
59
|
+
loop do
|
|
60
|
+
page.data&.each(&blk)
|
|
61
|
+
|
|
62
|
+
break unless page.next_page?
|
|
63
|
+
page = page.next_page
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# @api private
|
|
68
|
+
#
|
|
69
|
+
# @param client [Anthropic::Internal::Transport::BaseClient]
|
|
70
|
+
# @param req [Hash{Symbol=>Object}]
|
|
71
|
+
# @param headers [Hash{String=>String}]
|
|
72
|
+
# @param page_data [Hash{Symbol=>Object}]
|
|
73
|
+
def initialize(client:, req:, headers:, page_data:)
|
|
74
|
+
super
|
|
75
|
+
|
|
76
|
+
case page_data
|
|
77
|
+
in {data: Array => data}
|
|
78
|
+
@data = data.map { Anthropic::Internal::Type::Converter.coerce(@model, _1) }
|
|
79
|
+
else
|
|
80
|
+
end
|
|
81
|
+
@next_page_ = page_data[:next_page]
|
|
82
|
+
@has_more = page_data[:has_more]
|
|
83
|
+
@data_refreshed_at = page_data[:data_refreshed_at]
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# @api private
|
|
87
|
+
#
|
|
88
|
+
# @return [String]
|
|
89
|
+
def inspect
|
|
90
|
+
# rubocop:disable Layout/LineLength
|
|
91
|
+
model = Anthropic::Internal::Type::Converter.inspect(@model, depth: 1)
|
|
92
|
+
|
|
93
|
+
"#<#{self.class}[#{model}]:0x#{object_id.to_s(16)} next_page_=#{next_page_.inspect} has_more=#{has_more.inspect} data_refreshed_at=#{data_refreshed_at.inspect}>"
|
|
94
|
+
# rubocop:enable Layout/LineLength
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
@@ -16,24 +16,14 @@ module Anthropic
|
|
|
16
16
|
# @return [Enumerable<generic<Elem>>]
|
|
17
17
|
private def iterator
|
|
18
18
|
# rubocop:disable Metrics/BlockLength
|
|
19
|
-
# rubocop:disable Layout/LineLength
|
|
20
19
|
# rubocop:disable Lint/DuplicateBranch
|
|
21
20
|
@iterator ||= Anthropic::Internal::Util.chain_fused(@stream) do |y|
|
|
22
21
|
@stream.each do |msg|
|
|
23
22
|
case msg
|
|
24
|
-
in {event: "completion", data: String => data}
|
|
25
|
-
decoded = JSON.parse(data, symbolize_names: true)
|
|
26
|
-
unwrapped = Anthropic::Internal::Util.dig(decoded, @unwrap)
|
|
27
|
-
y << Anthropic::Internal::Type::Converter.coerce(@model, unwrapped)
|
|
28
|
-
in {
|
|
29
|
-
event: "message_start" | "message_delta" | "message_stop" | "content_block_start" | "content_block_delta" | "content_block_stop" | "message" | "user.message" | "user.interrupt" | "user.tool_confirmation" | "user.custom_tool_result" | "user.tool_result" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "agent.mcp_tool_use" | "agent.mcp_tool_result" | "agent.custom_tool_use" | "agent.thread_context_compacted" | "session.status_running" | "session.status_idle" | "session.status_rescheduled" | "session.status_terminated" | "session.error" | "session.deleted" | "session.updated" | "span.model_request_start" | "span.model_request_end" | "span.outcome_evaluation_start" | "span.outcome_evaluation_ongoing" | "span.outcome_evaluation_end" | "user.define_outcome" | "agent.thread_message_received" | "agent.thread_message_sent" | "agent.session_thread_message_received" | "agent.session_thread_message_sent" | "session.thread_created" | "session.thread_status_created" | "session.thread_status_running" | "session.thread_status_idle" | "session.thread_status_rescheduled" | "session.thread_status_terminated" | "event_start" | "event_delta" | "system.message" | "workflow_run.created" | "workflow_run.status_running" | "workflow_run.status_idle" | "workflow_run.status_ended" | "workflow_run.error" | "workflow_run.phase_started" | "workflow_run.phase_ended",
|
|
30
|
-
data: String => data
|
|
31
|
-
}
|
|
32
|
-
decoded = JSON.parse(data, symbolize_names: true)
|
|
33
|
-
unwrapped = Anthropic::Internal::Util.dig(decoded, @unwrap)
|
|
34
|
-
y << Anthropic::Internal::Type::Converter.coerce(@model, unwrapped)
|
|
35
23
|
in {event: "ping"}
|
|
36
24
|
next
|
|
25
|
+
in {event: nil}
|
|
26
|
+
next
|
|
37
27
|
in {event: "error", data: String => data}
|
|
38
28
|
decoded = Kernel.then do
|
|
39
29
|
JSON.parse(data, symbolize_names: true)
|
|
@@ -49,12 +39,15 @@ module Anthropic
|
|
|
49
39
|
response: @response
|
|
50
40
|
)
|
|
51
41
|
raise err
|
|
42
|
+
in {data: String => data} unless data.chomp.empty?
|
|
43
|
+
decoded = JSON.parse(data, symbolize_names: true)
|
|
44
|
+
unwrapped = Anthropic::Internal::Util.dig(decoded, @unwrap)
|
|
45
|
+
y << Anthropic::Internal::Type::Converter.coerce(@model, unwrapped)
|
|
52
46
|
else
|
|
53
47
|
end
|
|
54
48
|
end
|
|
55
49
|
end
|
|
56
50
|
# rubocop:enable Lint/DuplicateBranch
|
|
57
|
-
# rubocop:enable Layout/LineLength
|
|
58
51
|
# rubocop:enable Metrics/BlockLength
|
|
59
52
|
end
|
|
60
53
|
end
|
|
@@ -111,6 +111,12 @@ module Anthropic
|
|
|
111
111
|
SKILLS_VERSIONS_RETRIEVE = "anthropic.skills.versions.retrieve"
|
|
112
112
|
SKILLS_VERSIONS_LIST = "anthropic.skills.versions.list"
|
|
113
113
|
SKILLS_VERSIONS_DELETE = "anthropic.skills.versions.delete"
|
|
114
|
+
USER_PROFILES_CREATE = "anthropic.user_profiles.create"
|
|
115
|
+
USER_PROFILES_RETRIEVE = "anthropic.user_profiles.retrieve"
|
|
116
|
+
USER_PROFILES_UPDATE = "anthropic.user_profiles.update"
|
|
117
|
+
USER_PROFILES_LIST = "anthropic.user_profiles.list"
|
|
118
|
+
USER_PROFILES_DELETE = "anthropic.user_profiles.delete"
|
|
119
|
+
USER_PROFILES_ACTION_URLS_CREATE = "anthropic.user_profiles.action_urls.create"
|
|
114
120
|
ORGANIZATION_RETRIEVE = "anthropic.organization.retrieve"
|
|
115
121
|
ORGANIZATION_API_KEYS_RETRIEVE = "anthropic.organization.api_keys.retrieve"
|
|
116
122
|
ORGANIZATION_API_KEYS_UPDATE = "anthropic.organization.api_keys.update"
|
|
@@ -157,6 +163,7 @@ module Anthropic
|
|
|
157
163
|
ORGANIZATION_WORKSPACES_UPDATE = "anthropic.organization.workspaces.update"
|
|
158
164
|
ORGANIZATION_WORKSPACES_LIST = "anthropic.organization.workspaces.list"
|
|
159
165
|
ORGANIZATION_WORKSPACES_ARCHIVE = "anthropic.organization.workspaces.archive"
|
|
166
|
+
ORGANIZATION_WORKSPACES_RATE_LIMITS_UPDATE = "anthropic.organization.workspaces.rate_limits.update"
|
|
160
167
|
ORGANIZATION_WORKSPACES_RATE_LIMITS_LIST = "anthropic.organization.workspaces.rate_limits.list"
|
|
161
168
|
ORGANIZATION_WORKSPACES_MEMBERS_RETRIEVE = "anthropic.organization.workspaces.members.retrieve"
|
|
162
169
|
ORGANIZATION_WORKSPACES_MEMBERS_UPDATE = "anthropic.organization.workspaces.members.update"
|
|
@@ -251,10 +258,6 @@ module Anthropic
|
|
|
251
258
|
MEMORY_STORES_MEMORY_VERSIONS_LIST = "anthropic.memory_stores.memory_versions.list"
|
|
252
259
|
MEMORY_STORES_MEMORY_VERSIONS_REDACT = "anthropic.memory_stores.memory_versions.redact"
|
|
253
260
|
SKILLS_VERSIONS_DOWNLOAD = "anthropic.skills.versions.download"
|
|
254
|
-
USER_PROFILES_CREATE = "anthropic.user_profiles.create"
|
|
255
|
-
USER_PROFILES_RETRIEVE = "anthropic.user_profiles.retrieve"
|
|
256
|
-
USER_PROFILES_UPDATE = "anthropic.user_profiles.update"
|
|
257
|
-
USER_PROFILES_LIST = "anthropic.user_profiles.list"
|
|
258
261
|
USER_PROFILES_CREATE_ENROLLMENT_URL = "anthropic.user_profiles.create_enrollment_url"
|
|
259
262
|
DREAMS_CREATE = "anthropic.dreams.create"
|
|
260
263
|
DREAMS_RETRIEVE = "anthropic.dreams.retrieve"
|
|
@@ -17,6 +17,14 @@ module Anthropic
|
|
|
17
17
|
required :type, const: :messages_changed
|
|
18
18
|
|
|
19
19
|
# @!method initialize(cache_missed_input_tokens:, type: :messages_changed)
|
|
20
|
+
# A `cache_miss_reason` for a request whose `messages` differ from the previous
|
|
21
|
+
# request's in an earlier entry, instead of only having entries appended. The
|
|
22
|
+
# `model`, `system`, and `tools` match.
|
|
23
|
+
#
|
|
24
|
+
# See the
|
|
25
|
+
# [cache diagnostics guide](https://platform.claude.com/docs/en/build-with-claude/cache-diagnostics#cache-miss-reason-types)
|
|
26
|
+
# to learn what to change for each reason.
|
|
27
|
+
#
|
|
20
28
|
# Some parameter documentations has been truncated, see
|
|
21
29
|
# {Anthropic::Models::Beta::BetaCacheMissMessagesChanged} for more details.
|
|
22
30
|
#
|
|
@@ -17,6 +17,13 @@ module Anthropic
|
|
|
17
17
|
required :type, const: :model_changed
|
|
18
18
|
|
|
19
19
|
# @!method initialize(cache_missed_input_tokens:, type: :model_changed)
|
|
20
|
+
# A `cache_miss_reason` for a request whose `model` or `speed` differs from the
|
|
21
|
+
# previous request's.
|
|
22
|
+
#
|
|
23
|
+
# See the
|
|
24
|
+
# [cache diagnostics guide](https://platform.claude.com/docs/en/build-with-claude/cache-diagnostics#cache-miss-reason-types)
|
|
25
|
+
# to learn what to change for each reason.
|
|
26
|
+
#
|
|
20
27
|
# Some parameter documentations has been truncated, see
|
|
21
28
|
# {Anthropic::Models::Beta::BetaCacheMissModelChanged} for more details.
|
|
22
29
|
#
|
|
@@ -10,6 +10,15 @@ module Anthropic
|
|
|
10
10
|
required :type, const: :previous_message_not_found
|
|
11
11
|
|
|
12
12
|
# @!method initialize(type: :previous_message_not_found)
|
|
13
|
+
# A `cache_miss_reason` for when the API doesn't have a stored record of the
|
|
14
|
+
# request that `diagnostics.previous_message_id` references.
|
|
15
|
+
#
|
|
16
|
+
# This doesn't mean that this request changed.
|
|
17
|
+
#
|
|
18
|
+
# See the
|
|
19
|
+
# [cache diagnostics guide](https://platform.claude.com/docs/en/build-with-claude/cache-diagnostics#cache-miss-reason-types)
|
|
20
|
+
# to learn what to change for each reason.
|
|
21
|
+
#
|
|
13
22
|
# @param type [Symbol, :previous_message_not_found]
|
|
14
23
|
end
|
|
15
24
|
end
|