#google #aiplatform

google-aiplatform1

一个与Aiplatform(协议v1)交互的完整库

1个稳定版本

5.0.5+20240715 2024年7月25日

#2824Web编程

Download history 114/week @ 2024-07-21 14/week @ 2024-07-28

128 每月下载量

MIT 许可证

8.5MB
98K SLoC

google-aiplatform1 库允许访问Google Aiplatform服务的所有功能。

本文档是根据Aiplatform crate版本5.0.5+20240715生成的,其中20240715mako代码生成器v5.0.5构建的aiplatform:v1模式的精确版本。

关于Aiplatform v1 API的其余内容可以在官方文档网站找到。

功能

轻松从中心 枢纽 处理以下 资源 ...

本库结构

API结构如下主要项目

  • 枢纽
  • 资源
    • 你可以应用 活动 的主要类型
    • 属性和 部分 的集合
    • 部分
      • 属性的集合
      • 活动 中 never 直接使用
  • 活动
    • 应用于 资源 的操作

所有 结构 都标有适用的特性行为,以进一步分类它们并简化浏览。

一般来说,你可以像这样调用 活动

let r = hub.resource().activity(...).doit().await

或者具体 ...

let r = hub.projects().locations_data_labeling_jobs_operations_wait(...).doit().await
let r = hub.projects().locations_data_labeling_jobs_operations_get(...).doit().await
let r = hub.projects().locations_data_labeling_jobs_delete(...).doit().await
let r = hub.projects().locations_notebook_execution_jobs_operations_wait(...).doit().await
let r = hub.projects().locations_notebook_execution_jobs_operations_get(...).doit().await
let r = hub.projects().locations_notebook_execution_jobs_create(...).doit().await
let r = hub.projects().locations_notebook_execution_jobs_delete(...).doit().await
let r = hub.projects().locations_training_pipelines_operations_wait(...).doit().await
let r = hub.projects().locations_training_pipelines_operations_get(...).doit().await
let r = hub.projects().locations_training_pipelines_delete(...).doit().await
let r = hub.projects().locations_indexes_operations_get(...).doit().await
let r = hub.projects().locations_indexes_operations_wait(...).doit().await
let r = hub.projects().locations_indexes_delete(...).doit().await
let r = hub.projects().locations_indexes_patch(...).doit().await
let r = hub.projects().locations_indexes_create(...).doit().await
let r = hub.projects().locations_studies_trials_operations_get(...).doit().await
let r = hub.projects().locations_studies_trials_operations_wait(...).doit().await
let r = hub.projects().locations_studies_trials_check_trial_early_stopping_state(...).doit().await
let r = hub.projects().locations_studies_trials_suggest(...).doit().await
let r = hub.projects().locations_studies_operations_wait(...).doit().await
let r = hub.projects().locations_studies_operations_get(...).doit().await
let r = hub.projects().locations_migratable_resources_operations_wait(...).doit().await
let r = hub.projects().locations_migratable_resources_operations_get(...).doit().await
let r = hub.projects().locations_migratable_resources_batch_migrate(...).doit().await
let r = hub.projects().locations_nas_jobs_delete(...).doit().await
let r = hub.projects().locations_schedules_operations_get(...).doit().await
let r = hub.projects().locations_schedules_operations_wait(...).doit().await
let r = hub.projects().locations_schedules_delete(...).doit().await
let r = hub.projects().locations_tensorboards_operations_wait(...).doit().await
let r = hub.projects().locations_tensorboards_operations_get(...).doit().await
let r = hub.projects().locations_tensorboards_experiments_runs_time_series_operations_wait(...).doit().await
let r = hub.projects().locations_tensorboards_experiments_runs_time_series_operations_get(...).doit().await
let r = hub.projects().locations_tensorboards_experiments_runs_time_series_delete(...).doit().await
let r = hub.projects().locations_tensorboards_experiments_runs_operations_get(...).doit().await
let r = hub.projects().locations_tensorboards_experiments_runs_operations_wait(...).doit().await
let r = hub.projects().locations_tensorboards_experiments_runs_delete(...).doit().await
let r = hub.projects().locations_tensorboards_experiments_operations_get(...).doit().await
let r = hub.projects().locations_tensorboards_experiments_operations_wait(...).doit().await
let r = hub.projects().locations_tensorboards_experiments_delete(...).doit().await
let r = hub.projects().locations_tensorboards_delete(...).doit().await
let r = hub.projects().locations_tensorboards_create(...).doit().await
let r = hub.projects().locations_tensorboards_patch(...).doit().await
let r = hub.projects().locations_feature_groups_operations_wait(...).doit().await
let r = hub.projects().locations_feature_groups_operations_get(...).doit().await
let r = hub.projects().locations_feature_groups_features_operations_wait(...).doit().await
let r = hub.projects().locations_feature_groups_features_operations_get(...).doit().await
let r = hub.projects().locations_feature_groups_features_patch(...).doit().await
let r = hub.projects().locations_feature_groups_features_create(...).doit().await
let r = hub.projects().locations_feature_groups_features_delete(...).doit().await
let r = hub.projects().locations_feature_groups_delete(...).doit().await
let r = hub.projects().locations_feature_groups_patch(...).doit().await
let r = hub.projects().locations_feature_groups_create(...).doit().await
let r = hub.projects().locations_feature_online_stores_feature_views_operations_get(...).doit().await
let r = hub.projects().locations_feature_online_stores_feature_views_operations_wait(...).doit().await
let r = hub.projects().locations_feature_online_stores_feature_views_patch(...).doit().await
let r = hub.projects().locations_feature_online_stores_feature_views_create(...).doit().await
let r = hub.projects().locations_feature_online_stores_feature_views_delete(...).doit().await
let r = hub.projects().locations_feature_online_stores_operations_get(...).doit().await
let r = hub.projects().locations_feature_online_stores_operations_wait(...).doit().await
let r = hub.projects().locations_feature_online_stores_patch(...).doit().await
let r = hub.projects().locations_feature_online_stores_create(...).doit().await
let r = hub.projects().locations_feature_online_stores_delete(...).doit().await
let r = hub.projects().locations_index_endpoints_operations_get(...).doit().await
let r = hub.projects().locations_index_endpoints_operations_wait(...).doit().await
let r = hub.projects().locations_index_endpoints_mutate_deployed_index(...).doit().await
let r = hub.projects().locations_index_endpoints_undeploy_index(...).doit().await
let r = hub.projects().locations_index_endpoints_deploy_index(...).doit().await
let r = hub.projects().locations_index_endpoints_delete(...).doit().await
let r = hub.projects().locations_index_endpoints_create(...).doit().await
let r = hub.projects().locations_endpoints_operations_get(...).doit().await
let r = hub.projects().locations_endpoints_operations_wait(...).doit().await
let r = hub.projects().locations_endpoints_undeploy_model(...).doit().await
let r = hub.projects().locations_endpoints_deploy_model(...).doit().await
let r = hub.projects().locations_endpoints_delete(...).doit().await
let r = hub.projects().locations_endpoints_mutate_deployed_model(...).doit().await
let r = hub.projects().locations_endpoints_create(...).doit().await
let r = hub.projects().locations_specialist_pools_operations_get(...).doit().await
let r = hub.projects().locations_specialist_pools_operations_wait(...).doit().await
let r = hub.projects().locations_specialist_pools_patch(...).doit().await
let r = hub.projects().locations_specialist_pools_delete(...).doit().await
let r = hub.projects().locations_specialist_pools_create(...).doit().await
let r = hub.projects().locations_custom_jobs_operations_get(...).doit().await
let r = hub.projects().locations_custom_jobs_operations_wait(...).doit().await
let r = hub.projects().locations_custom_jobs_delete(...).doit().await
let r = hub.projects().locations_model_deployment_monitoring_jobs_operations_get(...).doit().await
let r = hub.projects().locations_model_deployment_monitoring_jobs_operations_wait(...).doit().await
let r = hub.projects().locations_model_deployment_monitoring_jobs_patch(...).doit().await
let r = hub.projects().locations_model_deployment_monitoring_jobs_delete(...).doit().await
let r = hub.projects().locations_datasets_data_items_operations_wait(...).doit().await
let r = hub.projects().locations_datasets_data_items_operations_get(...).doit().await
let r = hub.projects().locations_datasets_data_items_annotations_operations_get(...).doit().await
let r = hub.projects().locations_datasets_data_items_annotations_operations_wait(...).doit().await
let r = hub.projects().locations_datasets_annotation_specs_operations_wait(...).doit().await
let r = hub.projects().locations_datasets_annotation_specs_operations_get(...).doit().await
let r = hub.projects().locations_datasets_dataset_versions_delete(...).doit().await
let r = hub.projects().locations_datasets_dataset_versions_create(...).doit().await
let r = hub.projects().locations_datasets_dataset_versions_restore(...).doit().await
let r = hub.projects().locations_datasets_saved_queries_operations_wait(...).doit().await
let r = hub.projects().locations_datasets_saved_queries_operations_get(...).doit().await
let r = hub.projects().locations_datasets_saved_queries_delete(...).doit().await
let r = hub.projects().locations_datasets_operations_wait(...).doit().await
let r = hub.projects().locations_datasets_operations_get(...).doit().await
let r = hub.projects().locations_datasets_delete(...).doit().await
let r = hub.projects().locations_datasets_export(...).doit().await
let r = hub.projects().locations_datasets_import(...).doit().await
let r = hub.projects().locations_datasets_create(...).doit().await
let r = hub.projects().locations_featurestores_operations_wait(...).doit().await
let r = hub.projects().locations_featurestores_operations_get(...).doit().await
let r = hub.projects().locations_featurestores_entity_types_operations_get(...).doit().await
let r = hub.projects().locations_featurestores_entity_types_operations_wait(...).doit().await
let r = hub.projects().locations_featurestores_entity_types_features_operations_get(...).doit().await
let r = hub.projects().locations_featurestores_entity_types_features_operations_wait(...).doit().await
let r = hub.projects().locations_featurestores_entity_types_features_delete(...).doit().await
let r = hub.projects().locations_featurestores_entity_types_features_create(...).doit().await
let r = hub.projects().locations_featurestores_entity_types_features_batch_create(...).doit().await
let r = hub.projects().locations_featurestores_entity_types_delete(...).doit().await
let r = hub.projects().locations_featurestores_entity_types_export_feature_values(...).doit().await
let r = hub.projects().locations_featurestores_entity_types_create(...).doit().await
let r = hub.projects().locations_featurestores_entity_types_delete_feature_values(...).doit().await
let r = hub.projects().locations_featurestores_entity_types_import_feature_values(...).doit().await
let r = hub.projects().locations_featurestores_patch(...).doit().await
let r = hub.projects().locations_featurestores_create(...).doit().await
let r = hub.projects().locations_featurestores_delete(...).doit().await
let r = hub.projects().locations_featurestores_batch_read_feature_values(...).doit().await
let r = hub.projects().locations_notebook_runtimes_operations_wait(...).doit().await
let r = hub.projects().locations_notebook_runtimes_operations_get(...).doit().await
let r = hub.projects().locations_notebook_runtimes_upgrade(...).doit().await
let r = hub.projects().locations_notebook_runtimes_delete(...).doit().await
let r = hub.projects().locations_notebook_runtimes_start(...).doit().await
let r = hub.projects().locations_notebook_runtimes_assign(...).doit().await
let r = hub.projects().locations_metadata_stores_executions_operations_wait(...).doit().await
let r = hub.projects().locations_metadata_stores_executions_operations_get(...).doit().await
let r = hub.projects().locations_metadata_stores_executions_purge(...).doit().await
let r = hub.projects().locations_metadata_stores_executions_delete(...).doit().await
let r = hub.projects().locations_metadata_stores_contexts_operations_get(...).doit().await
let r = hub.projects().locations_metadata_stores_contexts_operations_wait(...).doit().await
let r = hub.projects().locations_metadata_stores_contexts_delete(...).doit().await
let r = hub.projects().locations_metadata_stores_contexts_purge(...).doit().await
let r = hub.projects().locations_metadata_stores_artifacts_operations_wait(...).doit().await
let r = hub.projects().locations_metadata_stores_artifacts_operations_get(...).doit().await
let r = hub.projects().locations_metadata_stores_artifacts_delete(...).doit().await
let r = hub.projects().locations_metadata_stores_artifacts_purge(...).doit().await
let r = hub.projects().locations_metadata_stores_operations_get(...).doit().await
let r = hub.projects().locations_metadata_stores_operations_wait(...).doit().await
let r = hub.projects().locations_metadata_stores_delete(...).doit().await
let r = hub.projects().locations_metadata_stores_create(...).doit().await
let r = hub.projects().locations_operations_wait(...).doit().await
let r = hub.projects().locations_operations_get(...).doit().await
let r = hub.projects().locations_hyperparameter_tuning_jobs_operations_get(...).doit().await
let r = hub.projects().locations_hyperparameter_tuning_jobs_operations_wait(...).doit().await
let r = hub.projects().locations_hyperparameter_tuning_jobs_delete(...).doit().await
let r = hub.projects().locations_persistent_resources_operations_get(...).doit().await
let r = hub.projects().locations_persistent_resources_operations_wait(...).doit().await
let r = hub.projects().locations_persistent_resources_patch(...).doit().await
let r = hub.projects().locations_persistent_resources_reboot(...).doit().await
let r = hub.projects().locations_persistent_resources_delete(...).doit().await
let r = hub.projects().locations_persistent_resources_create(...).doit().await
let r = hub.projects().locations_models_evaluations_operations_wait(...).doit().await
let r = hub.projects().locations_models_evaluations_operations_get(...).doit().await
let r = hub.projects().locations_models_operations_wait(...).doit().await
let r = hub.projects().locations_models_operations_get(...).doit().await
let r = hub.projects().locations_models_delete(...).doit().await
let r = hub.projects().locations_models_update_explanation_dataset(...).doit().await
let r = hub.projects().locations_models_copy(...).doit().await
let r = hub.projects().locations_models_upload(...).doit().await
let r = hub.projects().locations_models_export(...).doit().await
let r = hub.projects().locations_models_delete_version(...).doit().await
let r = hub.projects().locations_notebook_runtime_templates_operations_get(...).doit().await
let r = hub.projects().locations_notebook_runtime_templates_operations_wait(...).doit().await
let r = hub.projects().locations_notebook_runtime_templates_create(...).doit().await
let r = hub.projects().locations_notebook_runtime_templates_delete(...).doit().await
let r = hub.projects().locations_batch_prediction_jobs_delete(...).doit().await
let r = hub.projects().locations_tuning_jobs_operations_get(...).doit().await
let r = hub.projects().locations_deployment_resource_pools_operations_get(...).doit().await
let r = hub.projects().locations_deployment_resource_pools_operations_wait(...).doit().await
let r = hub.projects().locations_deployment_resource_pools_patch(...).doit().await
let r = hub.projects().locations_deployment_resource_pools_create(...).doit().await
let r = hub.projects().locations_deployment_resource_pools_delete(...).doit().await
let r = hub.projects().locations_pipeline_jobs_operations_get(...).doit().await
let r = hub.projects().locations_pipeline_jobs_operations_wait(...).doit().await
let r = hub.projects().locations_pipeline_jobs_delete(...).doit().await
let r = hub.projects().locations_pipeline_jobs_batch_delete(...).doit().await
let r = hub.projects().locations_pipeline_jobs_batch_cancel(...).doit().await

resource()activity(...) 调用创建 构建器。第二个与 Activities 相关,支持各种方法来配置即将进行的操作(此处未显示)。它被设计成必须立即指定所有必需的参数(即 (...)),而所有可选的参数都可以 构建 如所需。 doit() 方法执行与服务器的实际通信并返回相应的结果。

用法

设置你的项目

要使用此库,您会将以下行放入您的 Cargo.toml 文件中

[dependencies]
google-aiplatform1 = "*"
serde = "^1.0"
serde_json = "^1.0"

一个完整的例子

extern crate hyper;
extern crate hyper_rustls;
extern crate google_aiplatform1 as aiplatform1;
use aiplatform1::api::GoogleCloudAiplatformV1FeatureView;
use aiplatform1::{Result, Error};
use std::default::Default;
use aiplatform1::{Aiplatform, oauth2, hyper, hyper_rustls, chrono, FieldMask};

// Get an ApplicationSecret instance by some means. It contains the `client_id` and 
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you, 
// unless you replace  `None` with the desired Flow.
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about 
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
        secret,
        oauth2::InstalledFlowReturnMethod::HTTPRedirect,
    ).build().await.unwrap();
let mut hub = Aiplatform::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), auth);
// As the method needs a request, you would usually fill it with the desired information
// into the respective structure. Some of the parts shown here might not be applicable !
// Values shown here are possibly random and not representative !
let mut req = GoogleCloudAiplatformV1FeatureView::default();

// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.projects().locations_feature_online_stores_feature_views_create(req, "parent")
             .run_sync_immediately(true)
             .feature_view_id("voluptua.")
             .doit().await;

match result {
    Err(e) => match e {
        // The Error enum provides details about what exactly happened.
        // You can also just use its `Debug`, `Display` or `Error` traits
         Error::HttpError(_)
        |Error::Io(_)
        |Error::MissingAPIKey
        |Error::MissingToken(_)
        |Error::Cancelled
        |Error::UploadSizeLimitExceeded(_, _)
        |Error::Failure(_)
        |Error::BadRequest(_)
        |Error::FieldClash(_)
        |Error::JsonDecodeError(_, _) => println!("{}", e),
    },
    Ok(res) => println!("Success: {:?}", res),
}

处理错误

系统产生的所有错误都通过Result枚举作为doit()方法的返回值提供,或者作为可能的中继结果传递给Hub Delegate,或者Authenticator Delegate

当委托处理错误或中继值时,它们有机会指示系统重试。这使得系统可能对所有类型的错误都具有弹性。

上传和下载

如果某个方法支持下载,应该读取响应体(这是Result的一部分)来获取媒体。如果此方法还支持Response Result,则默认返回该值。您可以将它视为实际媒体的元数据。要触发媒体下载,您必须通过以下调用设置构建器: .param("alt", "media")

支持上传的方法可以使用最多2种不同的协议:简单可恢复。每种协议的独特性通过定制的doit(...)方法表示,分别命名为upload(...)upload_resumable(...)

定制和回调

您可以通过在调用final doit()调用之前向Method Builder提供一个delegate来更改doit()方法的调用方式。相应的函数将被调用以提供进度信息,以及确定系统在失败时是否应该重试。

delegate trait默认实现,允许您以最小的努力进行定制。

服务器请求中的可选部分

此库提供的所有结构都旨在通过json进行encodabledecodable。使用可选来指示部分请求或响应是有效的。大多数可选都是被认为是Parts,可以通过名称识别,这些将被发送到服务器以指示请求的设置部分或响应中期望的部分。

构建器参数

通过使用method builders,您可以通过重复调用其方法来准备一个操作调用。这些将始终接受一个参数,以下陈述对它有效。

参数将始终复制或克隆到构建器中,以使其与其原始的生命周期独立。

Cargo功能

  • utoipa - 添加对 utoipa 的支持,并从所有类型派生 utoipa::ToSchema。您需要将所需类型导入并注册到 #[openapi(schemas(...))],否则生成的 openapi 规范将无效。

许可证

aiplatform1 库由 Sebastian Thiel 创建,并置于 MIT 许可证之下。您可以在存储库的 许可证文件 中阅读全文。

依赖项

~12–23MB
~345K SLoC