google-cloud-ai_platform-v1 0.39.0 → 0.40.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/ai_platform/v1/bindings_override.rb +399 -0
  3. data/lib/google/cloud/ai_platform/v1/dataset_service/client.rb +39 -18
  4. data/lib/google/cloud/ai_platform/v1/dataset_service/operations.rb +13 -5
  5. data/lib/google/cloud/ai_platform/v1/dataset_service/rest/client.rb +2188 -0
  6. data/lib/google/cloud/ai_platform/v1/dataset_service/rest/operations.rb +3901 -0
  7. data/lib/google/cloud/ai_platform/v1/dataset_service/rest/service_stub.rb +1136 -0
  8. data/lib/google/cloud/ai_platform/v1/dataset_service/rest.rb +54 -0
  9. data/lib/google/cloud/ai_platform/v1/dataset_service.rb +6 -0
  10. data/lib/google/cloud/ai_platform/v1/deployment_resource_pool_service/client.rb +13 -5
  11. data/lib/google/cloud/ai_platform/v1/deployment_resource_pool_service/operations.rb +13 -5
  12. data/lib/google/cloud/ai_platform/v1/deployment_resource_pool_service/rest/client.rb +851 -0
  13. data/lib/google/cloud/ai_platform/v1/deployment_resource_pool_service/rest/operations.rb +3901 -0
  14. data/lib/google/cloud/ai_platform/v1/deployment_resource_pool_service/rest/service_stub.rb +365 -0
  15. data/lib/google/cloud/ai_platform/v1/deployment_resource_pool_service/rest.rb +54 -0
  16. data/lib/google/cloud/ai_platform/v1/deployment_resource_pool_service.rb +6 -0
  17. data/lib/google/cloud/ai_platform/v1/endpoint_service/client.rb +19 -8
  18. data/lib/google/cloud/ai_platform/v1/endpoint_service/operations.rb +13 -5
  19. data/lib/google/cloud/ai_platform/v1/endpoint_service/rest/client.rb +1215 -0
  20. data/lib/google/cloud/ai_platform/v1/endpoint_service/rest/operations.rb +3901 -0
  21. data/lib/google/cloud/ai_platform/v1/endpoint_service/rest/service_stub.rb +546 -0
  22. data/lib/google/cloud/ai_platform/v1/endpoint_service/rest.rb +54 -0
  23. data/lib/google/cloud/ai_platform/v1/endpoint_service.rb +6 -0
  24. data/lib/google/cloud/ai_platform/v1/feature_online_store_admin_service/client.rb +29 -13
  25. data/lib/google/cloud/ai_platform/v1/feature_online_store_admin_service/operations.rb +13 -5
  26. data/lib/google/cloud/ai_platform/v1/feature_online_store_admin_service/rest/client.rb +1732 -0
  27. data/lib/google/cloud/ai_platform/v1/feature_online_store_admin_service/rest/operations.rb +3901 -0
  28. data/lib/google/cloud/ai_platform/v1/feature_online_store_admin_service/rest/service_stub.rb +841 -0
  29. data/lib/google/cloud/ai_platform/v1/feature_online_store_admin_service/rest.rb +55 -0
  30. data/lib/google/cloud/ai_platform/v1/feature_online_store_admin_service.rb +6 -0
  31. data/lib/google/cloud/ai_platform/v1/feature_online_store_service/client.rb +7 -2
  32. data/lib/google/cloud/ai_platform/v1/feature_online_store_service/rest/client.rb +534 -0
  33. data/lib/google/cloud/ai_platform/v1/feature_online_store_service/rest/service_stub.rb +189 -0
  34. data/lib/google/cloud/ai_platform/v1/feature_online_store_service/rest.rb +53 -0
  35. data/lib/google/cloud/ai_platform/v1/feature_online_store_service.rb +6 -0
  36. data/lib/google/cloud/ai_platform/v1/feature_registry_service/client.rb +24 -11
  37. data/lib/google/cloud/ai_platform/v1/feature_registry_service/operations.rb +13 -5
  38. data/lib/google/cloud/ai_platform/v1/feature_registry_service/rest/client.rb +1450 -0
  39. data/lib/google/cloud/ai_platform/v1/feature_registry_service/rest/operations.rb +3901 -0
  40. data/lib/google/cloud/ai_platform/v1/feature_registry_service/rest/service_stub.rb +663 -0
  41. data/lib/google/cloud/ai_platform/v1/feature_registry_service/rest.rb +55 -0
  42. data/lib/google/cloud/ai_platform/v1/feature_registry_service.rb +6 -0
  43. data/lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/client.rb +9 -3
  44. data/lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/rest/client.rb +645 -0
  45. data/lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/rest/service_stub.rb +244 -0
  46. data/lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/rest.rb +53 -0
  47. data/lib/google/cloud/ai_platform/v1/featurestore_online_serving_service.rb +6 -0
  48. data/lib/google/cloud/ai_platform/v1/featurestore_service/client.rb +45 -21
  49. data/lib/google/cloud/ai_platform/v1/featurestore_service/operations.rb +13 -5
  50. data/lib/google/cloud/ai_platform/v1/featurestore_service/rest/client.rb +2765 -0
  51. data/lib/google/cloud/ai_platform/v1/featurestore_service/rest/operations.rb +3901 -0
  52. data/lib/google/cloud/ai_platform/v1/featurestore_service/rest/service_stub.rb +1319 -0
  53. data/lib/google/cloud/ai_platform/v1/featurestore_service/rest.rb +54 -0
  54. data/lib/google/cloud/ai_platform/v1/featurestore_service.rb +6 -0
  55. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/client.rb +11 -4
  56. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/rest/client.rb +720 -0
  57. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/rest/service_stub.rb +307 -0
  58. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/rest.rb +53 -0
  59. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service.rb +6 -0
  60. data/lib/google/cloud/ai_platform/v1/index_endpoint_service/client.rb +19 -8
  61. data/lib/google/cloud/ai_platform/v1/index_endpoint_service/operations.rb +13 -5
  62. data/lib/google/cloud/ai_platform/v1/index_endpoint_service/rest/client.rb +1151 -0
  63. data/lib/google/cloud/ai_platform/v1/index_endpoint_service/rest/operations.rb +3901 -0
  64. data/lib/google/cloud/ai_platform/v1/index_endpoint_service/rest/service_stub.rb +546 -0
  65. data/lib/google/cloud/ai_platform/v1/index_endpoint_service/rest.rb +54 -0
  66. data/lib/google/cloud/ai_platform/v1/index_endpoint_service.rb +6 -0
  67. data/lib/google/cloud/ai_platform/v1/index_service/client.rb +17 -7
  68. data/lib/google/cloud/ai_platform/v1/index_service/operations.rb +13 -5
  69. data/lib/google/cloud/ai_platform/v1/index_service/rest/client.rb +1034 -0
  70. data/lib/google/cloud/ai_platform/v1/index_service/rest/operations.rb +3901 -0
  71. data/lib/google/cloud/ai_platform/v1/index_service/rest/service_stub.rb +486 -0
  72. data/lib/google/cloud/ai_platform/v1/index_service/rest.rb +54 -0
  73. data/lib/google/cloud/ai_platform/v1/index_service.rb +6 -0
  74. data/lib/google/cloud/ai_platform/v1/job_service/client.rb +73 -35
  75. data/lib/google/cloud/ai_platform/v1/job_service/operations.rb +13 -5
  76. data/lib/google/cloud/ai_platform/v1/job_service/rest/client.rb +3841 -0
  77. data/lib/google/cloud/ai_platform/v1/job_service/rest/operations.rb +3901 -0
  78. data/lib/google/cloud/ai_platform/v1/job_service/rest/service_stub.rb +2149 -0
  79. data/lib/google/cloud/ai_platform/v1/job_service/rest.rb +54 -0
  80. data/lib/google/cloud/ai_platform/v1/job_service.rb +6 -0
  81. data/lib/google/cloud/ai_platform/v1/llm_utility_service/client.rb +7 -2
  82. data/lib/google/cloud/ai_platform/v1/llm_utility_service/rest/client.rb +533 -0
  83. data/lib/google/cloud/ai_platform/v1/llm_utility_service/rest/service_stub.rb +205 -0
  84. data/lib/google/cloud/ai_platform/v1/llm_utility_service/rest.rb +53 -0
  85. data/lib/google/cloud/ai_platform/v1/llm_utility_service.rb +6 -0
  86. data/lib/google/cloud/ai_platform/v1/match_service/client.rb +7 -2
  87. data/lib/google/cloud/ai_platform/v1/match_service/rest/client.rb +541 -0
  88. data/lib/google/cloud/ai_platform/v1/match_service/rest/service_stub.rb +189 -0
  89. data/lib/google/cloud/ai_platform/v1/match_service/rest.rb +54 -0
  90. data/lib/google/cloud/ai_platform/v1/match_service.rb +6 -0
  91. data/lib/google/cloud/ai_platform/v1/metadata_service/client.rb +67 -32
  92. data/lib/google/cloud/ai_platform/v1/metadata_service/operations.rb +13 -5
  93. data/lib/google/cloud/ai_platform/v1/metadata_service/rest/client.rb +3634 -0
  94. data/lib/google/cloud/ai_platform/v1/metadata_service/rest/operations.rb +3901 -0
  95. data/lib/google/cloud/ai_platform/v1/metadata_service/rest/service_stub.rb +1972 -0
  96. data/lib/google/cloud/ai_platform/v1/metadata_service/rest.rb +54 -0
  97. data/lib/google/cloud/ai_platform/v1/metadata_service.rb +6 -0
  98. data/lib/google/cloud/ai_platform/v1/migration_service/client.rb +7 -2
  99. data/lib/google/cloud/ai_platform/v1/migration_service/operations.rb +13 -5
  100. data/lib/google/cloud/ai_platform/v1/migration_service/rest/client.rb +574 -0
  101. data/lib/google/cloud/ai_platform/v1/migration_service/rest/operations.rb +3901 -0
  102. data/lib/google/cloud/ai_platform/v1/migration_service/rest/service_stub.rb +189 -0
  103. data/lib/google/cloud/ai_platform/v1/migration_service/rest.rb +55 -0
  104. data/lib/google/cloud/ai_platform/v1/migration_service.rb +6 -0
  105. data/lib/google/cloud/ai_platform/v1/model_garden_service/client.rb +5 -1
  106. data/lib/google/cloud/ai_platform/v1/model_garden_service/rest/client.rb +438 -0
  107. data/lib/google/cloud/ai_platform/v1/model_garden_service/rest/service_stub.rb +128 -0
  108. data/lib/google/cloud/ai_platform/v1/model_garden_service/rest.rb +53 -0
  109. data/lib/google/cloud/ai_platform/v1/model_garden_service.rb +6 -0
  110. data/lib/google/cloud/ai_platform/v1/model_service/client.rb +39 -18
  111. data/lib/google/cloud/ai_platform/v1/model_service/operations.rb +13 -5
  112. data/lib/google/cloud/ai_platform/v1/model_service/rest/client.rb +2213 -0
  113. data/lib/google/cloud/ai_platform/v1/model_service/rest/operations.rb +3901 -0
  114. data/lib/google/cloud/ai_platform/v1/model_service/rest/service_stub.rb +1140 -0
  115. data/lib/google/cloud/ai_platform/v1/model_service/rest.rb +54 -0
  116. data/lib/google/cloud/ai_platform/v1/model_service.rb +6 -0
  117. data/lib/google/cloud/ai_platform/v1/notebook_service/client.rb +23 -10
  118. data/lib/google/cloud/ai_platform/v1/notebook_service/operations.rb +13 -5
  119. data/lib/google/cloud/ai_platform/v1/notebook_service/rest/client.rb +1410 -0
  120. data/lib/google/cloud/ai_platform/v1/notebook_service/rest/operations.rb +3901 -0
  121. data/lib/google/cloud/ai_platform/v1/notebook_service/rest/service_stub.rb +663 -0
  122. data/lib/google/cloud/ai_platform/v1/notebook_service/rest.rb +54 -0
  123. data/lib/google/cloud/ai_platform/v1/notebook_service.rb +6 -0
  124. data/lib/google/cloud/ai_platform/v1/persistent_resource_service/client.rb +15 -6
  125. data/lib/google/cloud/ai_platform/v1/persistent_resource_service/operations.rb +13 -5
  126. data/lib/google/cloud/ai_platform/v1/persistent_resource_service/rest/client.rb +942 -0
  127. data/lib/google/cloud/ai_platform/v1/persistent_resource_service/rest/operations.rb +3901 -0
  128. data/lib/google/cloud/ai_platform/v1/persistent_resource_service/rest/service_stub.rb +426 -0
  129. data/lib/google/cloud/ai_platform/v1/persistent_resource_service/rest.rb +54 -0
  130. data/lib/google/cloud/ai_platform/v1/persistent_resource_service.rb +6 -0
  131. data/lib/google/cloud/ai_platform/v1/pipeline_service/client.rb +27 -12
  132. data/lib/google/cloud/ai_platform/v1/pipeline_service/operations.rb +13 -5
  133. data/lib/google/cloud/ai_platform/v1/pipeline_service/rest/client.rb +1600 -0
  134. data/lib/google/cloud/ai_platform/v1/pipeline_service/rest/operations.rb +3901 -0
  135. data/lib/google/cloud/ai_platform/v1/pipeline_service/rest/service_stub.rb +783 -0
  136. data/lib/google/cloud/ai_platform/v1/pipeline_service/rest.rb +56 -0
  137. data/lib/google/cloud/ai_platform/v1/pipeline_service.rb +6 -0
  138. data/lib/google/cloud/ai_platform/v1/prediction_service/client.rb +29 -13
  139. data/lib/google/cloud/ai_platform/v1/prediction_service/rest/client.rb +1297 -0
  140. data/lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb +642 -0
  141. data/lib/google/cloud/ai_platform/v1/prediction_service/rest.rb +53 -0
  142. data/lib/google/cloud/ai_platform/v1/prediction_service.rb +6 -0
  143. data/lib/google/cloud/ai_platform/v1/rest.rb +63 -0
  144. data/lib/google/cloud/ai_platform/v1/schedule_service/client.rb +17 -7
  145. data/lib/google/cloud/ai_platform/v1/schedule_service/operations.rb +13 -5
  146. data/lib/google/cloud/ai_platform/v1/schedule_service/rest/client.rb +1076 -0
  147. data/lib/google/cloud/ai_platform/v1/schedule_service/rest/operations.rb +3901 -0
  148. data/lib/google/cloud/ai_platform/v1/schedule_service/rest/service_stub.rb +486 -0
  149. data/lib/google/cloud/ai_platform/v1/schedule_service/rest.rb +55 -0
  150. data/lib/google/cloud/ai_platform/v1/schedule_service.rb +6 -0
  151. data/lib/google/cloud/ai_platform/v1/specialist_pool_service/client.rb +13 -5
  152. data/lib/google/cloud/ai_platform/v1/specialist_pool_service/operations.rb +13 -5
  153. data/lib/google/cloud/ai_platform/v1/specialist_pool_service/rest/client.rb +847 -0
  154. data/lib/google/cloud/ai_platform/v1/specialist_pool_service/rest/operations.rb +3901 -0
  155. data/lib/google/cloud/ai_platform/v1/specialist_pool_service/rest/service_stub.rb +366 -0
  156. data/lib/google/cloud/ai_platform/v1/specialist_pool_service/rest.rb +59 -0
  157. data/lib/google/cloud/ai_platform/v1/specialist_pool_service.rb +6 -0
  158. data/lib/google/cloud/ai_platform/v1/tensorboard_service/client.rb +63 -30
  159. data/lib/google/cloud/ai_platform/v1/tensorboard_service/operations.rb +13 -5
  160. data/lib/google/cloud/ai_platform/v1/tensorboard_service/rest/client.rb +3274 -0
  161. data/lib/google/cloud/ai_platform/v1/tensorboard_service/rest/operations.rb +3901 -0
  162. data/lib/google/cloud/ai_platform/v1/tensorboard_service/rest/service_stub.rb +1847 -0
  163. data/lib/google/cloud/ai_platform/v1/tensorboard_service/rest.rb +54 -0
  164. data/lib/google/cloud/ai_platform/v1/tensorboard_service.rb +6 -0
  165. data/lib/google/cloud/ai_platform/v1/version.rb +1 -1
  166. data/lib/google/cloud/ai_platform/v1/vizier_service/client.rb +33 -15
  167. data/lib/google/cloud/ai_platform/v1/vizier_service/operations.rb +13 -5
  168. data/lib/google/cloud/ai_platform/v1/vizier_service/rest/client.rb +1788 -0
  169. data/lib/google/cloud/ai_platform/v1/vizier_service/rest/operations.rb +3901 -0
  170. data/lib/google/cloud/ai_platform/v1/vizier_service/rest/service_stub.rb +963 -0
  171. data/lib/google/cloud/ai_platform/v1/vizier_service/rest.rb +58 -0
  172. data/lib/google/cloud/ai_platform/v1/vizier_service.rb +6 -0
  173. data/lib/google/cloud/ai_platform/v1.rb +6 -1
  174. data/lib/google/cloud/aiplatform/v1/accelerator_type_pb.rb +1 -1
  175. data/lib/google/cloud/aiplatform/v1/content_pb.rb +2 -1
  176. data/lib/google/cloud/aiplatform/v1/endpoint_pb.rb +3 -1
  177. data/lib/google/cloud/aiplatform/v1/index_service_pb.rb +1 -1
  178. data/lib/google/cloud/aiplatform/v1/notebook_runtime_pb.rb +1 -1
  179. data/lib/google/cloud/aiplatform/v1/publisher_model_pb.rb +1 -1
  180. data/proto_docs/google/cloud/aiplatform/v1/accelerator_type.rb +3 -0
  181. data/proto_docs/google/cloud/aiplatform/v1/content.rb +17 -0
  182. data/proto_docs/google/cloud/aiplatform/v1/endpoint.rb +7 -0
  183. data/proto_docs/google/cloud/aiplatform/v1/feature_registry_service.rb +1 -1
  184. data/proto_docs/google/cloud/aiplatform/v1/index_service.rb +3 -0
  185. data/proto_docs/google/cloud/aiplatform/v1/notebook_runtime.rb +2 -2
  186. data/proto_docs/google/cloud/aiplatform/v1/publisher_model.rb +4 -0
  187. data/proto_docs/google/cloud/aiplatform/v1/tuning_job.rb +8 -7
  188. metadata +101 -2
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/rest"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/ai_platform/v1/version"
24
+ require "google/cloud/ai_platform/v1/bindings_override"
25
+
26
+ require "google/cloud/ai_platform/v1/job_service/credentials"
27
+ require "google/cloud/ai_platform/v1/job_service/paths"
28
+ require "google/cloud/ai_platform/v1/job_service/rest/operations"
29
+ require "google/cloud/ai_platform/v1/job_service/rest/client"
30
+
31
+ module Google
32
+ module Cloud
33
+ module AIPlatform
34
+ module V1
35
+ ##
36
+ # A service for creating and managing Vertex AI's jobs.
37
+ #
38
+ # To load this service and instantiate a REST client:
39
+ #
40
+ # require "google/cloud/ai_platform/v1/job_service/rest"
41
+ # client = ::Google::Cloud::AIPlatform::V1::JobService::Rest::Client.new
42
+ #
43
+ module JobService
44
+ # Client for the REST transport
45
+ module Rest
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
54
+ require "google/cloud/ai_platform/v1/job_service/rest/helpers" if ::File.file? helper_path
@@ -26,6 +26,7 @@ require "google/cloud/ai_platform/v1/job_service/credentials"
26
26
  require "google/cloud/ai_platform/v1/job_service/paths"
27
27
  require "google/cloud/ai_platform/v1/job_service/operations"
28
28
  require "google/cloud/ai_platform/v1/job_service/client"
29
+ require "google/cloud/ai_platform/v1/job_service/rest"
29
30
 
30
31
  module Google
31
32
  module Cloud
@@ -39,6 +40,11 @@ module Google
39
40
  # require "google/cloud/ai_platform/v1/job_service"
40
41
  # client = ::Google::Cloud::AIPlatform::V1::JobService::Client.new
41
42
  #
43
+ # @example Load this service and instantiate a REST client
44
+ #
45
+ # require "google/cloud/ai_platform/v1/job_service/rest"
46
+ # client = ::Google::Cloud::AIPlatform::V1::JobService::Rest::Client.new
47
+ #
42
48
  module JobService
43
49
  end
44
50
  end
@@ -32,6 +32,9 @@ module Google
32
32
  # Service for LLM related utility functions.
33
33
  #
34
34
  class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
35
38
  # @private
36
39
  DEFAULT_ENDPOINT_TEMPLATE = "aiplatform.$UNIVERSE_DOMAIN$"
37
40
 
@@ -256,10 +259,11 @@ module Google
256
259
  # Customize the options with defaults
257
260
  metadata = @config.rpcs.count_tokens.metadata.to_h
258
261
 
259
- # Set x-goog-api-client and x-goog-user-project headers
262
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
260
263
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
261
264
  lib_name: @config.lib_name, lib_version: @config.lib_version,
262
265
  gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
266
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
263
267
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
264
268
 
265
269
  header_params = {}
@@ -346,10 +350,11 @@ module Google
346
350
  # Customize the options with defaults
347
351
  metadata = @config.rpcs.compute_tokens.metadata.to_h
348
352
 
349
- # Set x-goog-api-client and x-goog-user-project headers
353
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
350
354
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
351
355
  lib_name: @config.lib_name, lib_version: @config.lib_version,
352
356
  gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
357
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
353
358
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
354
359
 
355
360
  header_params = {}
@@ -0,0 +1,533 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/aiplatform/v1/llm_utility_service_pb"
21
+ require "google/cloud/ai_platform/v1/llm_utility_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+ require "google/iam/v1/rest"
24
+
25
+ module Google
26
+ module Cloud
27
+ module AIPlatform
28
+ module V1
29
+ module LlmUtilityService
30
+ module Rest
31
+ ##
32
+ # REST client for the LlmUtilityService service.
33
+ #
34
+ # Service for LLM related utility functions.
35
+ #
36
+ class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
40
+ # @private
41
+ DEFAULT_ENDPOINT_TEMPLATE = "aiplatform.$UNIVERSE_DOMAIN$"
42
+
43
+ include Paths
44
+
45
+ # @private
46
+ attr_reader :llm_utility_service_stub
47
+
48
+ ##
49
+ # Configure the LlmUtilityService Client class.
50
+ #
51
+ # See {::Google::Cloud::AIPlatform::V1::LlmUtilityService::Rest::Client::Configuration}
52
+ # for a description of the configuration fields.
53
+ #
54
+ # @example
55
+ #
56
+ # # Modify the configuration for all LlmUtilityService clients
57
+ # ::Google::Cloud::AIPlatform::V1::LlmUtilityService::Rest::Client.configure do |config|
58
+ # config.timeout = 10.0
59
+ # end
60
+ #
61
+ # @yield [config] Configure the Client client.
62
+ # @yieldparam config [Client::Configuration]
63
+ #
64
+ # @return [Client::Configuration]
65
+ #
66
+ def self.configure
67
+ @configure ||= begin
68
+ namespace = ["Google", "Cloud", "AIPlatform", "V1"]
69
+ parent_config = while namespace.any?
70
+ parent_name = namespace.join "::"
71
+ parent_const = const_get parent_name
72
+ break parent_const.configure if parent_const.respond_to? :configure
73
+ namespace.pop
74
+ end
75
+ default_config = Client::Configuration.new parent_config
76
+
77
+ default_config
78
+ end
79
+ yield @configure if block_given?
80
+ @configure
81
+ end
82
+
83
+ ##
84
+ # Configure the LlmUtilityService Client instance.
85
+ #
86
+ # The configuration is set to the derived mode, meaning that values can be changed,
87
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
88
+ # should be made on {Client.configure}.
89
+ #
90
+ # See {::Google::Cloud::AIPlatform::V1::LlmUtilityService::Rest::Client::Configuration}
91
+ # for a description of the configuration fields.
92
+ #
93
+ # @yield [config] Configure the Client client.
94
+ # @yieldparam config [Client::Configuration]
95
+ #
96
+ # @return [Client::Configuration]
97
+ #
98
+ def configure
99
+ yield @config if block_given?
100
+ @config
101
+ end
102
+
103
+ ##
104
+ # The effective universe domain
105
+ #
106
+ # @return [String]
107
+ #
108
+ def universe_domain
109
+ @llm_utility_service_stub.universe_domain
110
+ end
111
+
112
+ ##
113
+ # Create a new LlmUtilityService REST client object.
114
+ #
115
+ # @example
116
+ #
117
+ # # Create a client using the default configuration
118
+ # client = ::Google::Cloud::AIPlatform::V1::LlmUtilityService::Rest::Client.new
119
+ #
120
+ # # Create a client using a custom configuration
121
+ # client = ::Google::Cloud::AIPlatform::V1::LlmUtilityService::Rest::Client.new do |config|
122
+ # config.timeout = 10.0
123
+ # end
124
+ #
125
+ # @yield [config] Configure the LlmUtilityService client.
126
+ # @yieldparam config [Client::Configuration]
127
+ #
128
+ def initialize
129
+ # Create the configuration object
130
+ @config = Configuration.new Client.configure
131
+
132
+ # Yield the configuration if needed
133
+ yield @config if block_given?
134
+
135
+ # Create credentials
136
+ credentials = @config.credentials
137
+ # Use self-signed JWT if the endpoint is unchanged from default,
138
+ # but only if the default endpoint does not have a region prefix.
139
+ enable_self_signed_jwt = @config.endpoint.nil? ||
140
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
141
+ !@config.endpoint.split(".").first.include?("-"))
142
+ credentials ||= Credentials.default scope: @config.scope,
143
+ enable_self_signed_jwt: enable_self_signed_jwt
144
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
145
+ credentials = Credentials.new credentials, scope: @config.scope
146
+ end
147
+
148
+ @quota_project_id = @config.quota_project
149
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
+
151
+ @llm_utility_service_stub = ::Google::Cloud::AIPlatform::V1::LlmUtilityService::Rest::ServiceStub.new(
152
+ endpoint: @config.endpoint,
153
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
154
+ universe_domain: @config.universe_domain,
155
+ credentials: credentials
156
+ )
157
+
158
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
159
+ config.credentials = credentials
160
+ config.quota_project = @quota_project_id
161
+ config.endpoint = @llm_utility_service_stub.endpoint
162
+ config.universe_domain = @llm_utility_service_stub.universe_domain
163
+ config.bindings_override = @config.bindings_override
164
+ end
165
+
166
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
167
+ config.credentials = credentials
168
+ config.quota_project = @quota_project_id
169
+ config.endpoint = @llm_utility_service_stub.endpoint
170
+ config.universe_domain = @llm_utility_service_stub.universe_domain
171
+ config.bindings_override = @config.bindings_override
172
+ end
173
+ end
174
+
175
+ ##
176
+ # Get the associated client for mix-in of the Locations.
177
+ #
178
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
179
+ #
180
+ attr_reader :location_client
181
+
182
+ ##
183
+ # Get the associated client for mix-in of the IAMPolicy.
184
+ #
185
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
186
+ #
187
+ attr_reader :iam_policy_client
188
+
189
+ # Service calls
190
+
191
+ ##
192
+ # Perform a token counting.
193
+ #
194
+ # @overload count_tokens(request, options = nil)
195
+ # Pass arguments to `count_tokens` via a request object, either of type
196
+ # {::Google::Cloud::AIPlatform::V1::CountTokensRequest} or an equivalent Hash.
197
+ #
198
+ # @param request [::Google::Cloud::AIPlatform::V1::CountTokensRequest, ::Hash]
199
+ # A request object representing the call parameters. Required. To specify no
200
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
201
+ # @param options [::Gapic::CallOptions, ::Hash]
202
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
203
+ #
204
+ # @overload count_tokens(endpoint: nil, model: nil, instances: nil, contents: nil)
205
+ # Pass arguments to `count_tokens` via keyword arguments. Note that at
206
+ # least one keyword argument is required. To specify no parameters, or to keep all
207
+ # the default parameter values, pass an empty Hash as a request object (see above).
208
+ #
209
+ # @param endpoint [::String]
210
+ # Required. The name of the Endpoint requested to perform token counting.
211
+ # Format:
212
+ # `projects/{project}/locations/{location}/endpoints/{endpoint}`
213
+ # @param model [::String]
214
+ # Required. The name of the publisher model requested to serve the
215
+ # prediction. Format:
216
+ # `projects/{project}/locations/{location}/publishers/*/models/*`
217
+ # @param instances [::Array<::Google::Protobuf::Value, ::Hash>]
218
+ # Required. The instances that are the input to token counting call.
219
+ # Schema is identical to the prediction schema of the underlying model.
220
+ # @param contents [::Array<::Google::Cloud::AIPlatform::V1::Content, ::Hash>]
221
+ # Required. Input content.
222
+ # @yield [result, operation] Access the result along with the TransportOperation object
223
+ # @yieldparam result [::Google::Cloud::AIPlatform::V1::CountTokensResponse]
224
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
225
+ #
226
+ # @return [::Google::Cloud::AIPlatform::V1::CountTokensResponse]
227
+ #
228
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
229
+ #
230
+ # @example Basic example
231
+ # require "google/cloud/ai_platform/v1"
232
+ #
233
+ # # Create a client object. The client can be reused for multiple calls.
234
+ # client = Google::Cloud::AIPlatform::V1::LlmUtilityService::Rest::Client.new
235
+ #
236
+ # # Create a request. To set request fields, pass in keyword arguments.
237
+ # request = Google::Cloud::AIPlatform::V1::CountTokensRequest.new
238
+ #
239
+ # # Call the count_tokens method.
240
+ # result = client.count_tokens request
241
+ #
242
+ # # The returned object is of type Google::Cloud::AIPlatform::V1::CountTokensResponse.
243
+ # p result
244
+ #
245
+ def count_tokens request, options = nil
246
+ raise ::ArgumentError, "request must be provided" if request.nil?
247
+
248
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::CountTokensRequest
249
+
250
+ # Converts hash and nil to an options object
251
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
252
+
253
+ # Customize the options with defaults
254
+ call_metadata = @config.rpcs.count_tokens.metadata.to_h
255
+
256
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
257
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
258
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
259
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION,
260
+ transports_version_send: [:rest]
261
+
262
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
263
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
264
+
265
+ options.apply_defaults timeout: @config.rpcs.count_tokens.timeout,
266
+ metadata: call_metadata,
267
+ retry_policy: @config.rpcs.count_tokens.retry_policy
268
+
269
+ options.apply_defaults timeout: @config.timeout,
270
+ metadata: @config.metadata,
271
+ retry_policy: @config.retry_policy
272
+
273
+ @llm_utility_service_stub.count_tokens request, options do |result, operation|
274
+ yield result, operation if block_given?
275
+ return result
276
+ end
277
+ rescue ::Gapic::Rest::Error => e
278
+ raise ::Google::Cloud::Error.from_error(e)
279
+ end
280
+
281
+ ##
282
+ # Return a list of tokens based on the input text.
283
+ #
284
+ # @overload compute_tokens(request, options = nil)
285
+ # Pass arguments to `compute_tokens` via a request object, either of type
286
+ # {::Google::Cloud::AIPlatform::V1::ComputeTokensRequest} or an equivalent Hash.
287
+ #
288
+ # @param request [::Google::Cloud::AIPlatform::V1::ComputeTokensRequest, ::Hash]
289
+ # A request object representing the call parameters. Required. To specify no
290
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
291
+ # @param options [::Gapic::CallOptions, ::Hash]
292
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
293
+ #
294
+ # @overload compute_tokens(endpoint: nil, instances: nil)
295
+ # Pass arguments to `compute_tokens` via keyword arguments. Note that at
296
+ # least one keyword argument is required. To specify no parameters, or to keep all
297
+ # the default parameter values, pass an empty Hash as a request object (see above).
298
+ #
299
+ # @param endpoint [::String]
300
+ # Required. The name of the Endpoint requested to get lists of tokens and
301
+ # token ids.
302
+ # @param instances [::Array<::Google::Protobuf::Value, ::Hash>]
303
+ # Required. The instances that are the input to token computing API call.
304
+ # Schema is identical to the prediction schema of the text model, even for
305
+ # the non-text models, like chat models, or Codey models.
306
+ # @yield [result, operation] Access the result along with the TransportOperation object
307
+ # @yieldparam result [::Google::Cloud::AIPlatform::V1::ComputeTokensResponse]
308
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
309
+ #
310
+ # @return [::Google::Cloud::AIPlatform::V1::ComputeTokensResponse]
311
+ #
312
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
313
+ #
314
+ # @example Basic example
315
+ # require "google/cloud/ai_platform/v1"
316
+ #
317
+ # # Create a client object. The client can be reused for multiple calls.
318
+ # client = Google::Cloud::AIPlatform::V1::LlmUtilityService::Rest::Client.new
319
+ #
320
+ # # Create a request. To set request fields, pass in keyword arguments.
321
+ # request = Google::Cloud::AIPlatform::V1::ComputeTokensRequest.new
322
+ #
323
+ # # Call the compute_tokens method.
324
+ # result = client.compute_tokens request
325
+ #
326
+ # # The returned object is of type Google::Cloud::AIPlatform::V1::ComputeTokensResponse.
327
+ # p result
328
+ #
329
+ def compute_tokens request, options = nil
330
+ raise ::ArgumentError, "request must be provided" if request.nil?
331
+
332
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::ComputeTokensRequest
333
+
334
+ # Converts hash and nil to an options object
335
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
336
+
337
+ # Customize the options with defaults
338
+ call_metadata = @config.rpcs.compute_tokens.metadata.to_h
339
+
340
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
341
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
342
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
343
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION,
344
+ transports_version_send: [:rest]
345
+
346
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
347
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
348
+
349
+ options.apply_defaults timeout: @config.rpcs.compute_tokens.timeout,
350
+ metadata: call_metadata,
351
+ retry_policy: @config.rpcs.compute_tokens.retry_policy
352
+
353
+ options.apply_defaults timeout: @config.timeout,
354
+ metadata: @config.metadata,
355
+ retry_policy: @config.retry_policy
356
+
357
+ @llm_utility_service_stub.compute_tokens request, options do |result, operation|
358
+ yield result, operation if block_given?
359
+ return result
360
+ end
361
+ rescue ::Gapic::Rest::Error => e
362
+ raise ::Google::Cloud::Error.from_error(e)
363
+ end
364
+
365
+ ##
366
+ # Configuration class for the LlmUtilityService REST API.
367
+ #
368
+ # This class represents the configuration for LlmUtilityService REST,
369
+ # providing control over timeouts, retry behavior, logging, transport
370
+ # parameters, and other low-level controls. Certain parameters can also be
371
+ # applied individually to specific RPCs. See
372
+ # {::Google::Cloud::AIPlatform::V1::LlmUtilityService::Rest::Client::Configuration::Rpcs}
373
+ # for a list of RPCs that can be configured independently.
374
+ #
375
+ # Configuration can be applied globally to all clients, or to a single client
376
+ # on construction.
377
+ #
378
+ # @example
379
+ #
380
+ # # Modify the global config, setting the timeout for
381
+ # # count_tokens to 20 seconds,
382
+ # # and all remaining timeouts to 10 seconds.
383
+ # ::Google::Cloud::AIPlatform::V1::LlmUtilityService::Rest::Client.configure do |config|
384
+ # config.timeout = 10.0
385
+ # config.rpcs.count_tokens.timeout = 20.0
386
+ # end
387
+ #
388
+ # # Apply the above configuration only to a new client.
389
+ # client = ::Google::Cloud::AIPlatform::V1::LlmUtilityService::Rest::Client.new do |config|
390
+ # config.timeout = 10.0
391
+ # config.rpcs.count_tokens.timeout = 20.0
392
+ # end
393
+ #
394
+ # @!attribute [rw] endpoint
395
+ # A custom service endpoint, as a hostname or hostname:port. The default is
396
+ # nil, indicating to use the default endpoint in the current universe domain.
397
+ # @return [::String,nil]
398
+ # @!attribute [rw] credentials
399
+ # Credentials to send with calls. You may provide any of the following types:
400
+ # * (`String`) The path to a service account key file in JSON format
401
+ # * (`Hash`) A service account key as a Hash
402
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
403
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
404
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
405
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
406
+ # * (`nil`) indicating no credentials
407
+ # @return [::Object]
408
+ # @!attribute [rw] scope
409
+ # The OAuth scopes
410
+ # @return [::Array<::String>]
411
+ # @!attribute [rw] lib_name
412
+ # The library name as recorded in instrumentation and logging
413
+ # @return [::String]
414
+ # @!attribute [rw] lib_version
415
+ # The library version as recorded in instrumentation and logging
416
+ # @return [::String]
417
+ # @!attribute [rw] timeout
418
+ # The call timeout in seconds.
419
+ # @return [::Numeric]
420
+ # @!attribute [rw] metadata
421
+ # Additional headers to be sent with the call.
422
+ # @return [::Hash{::Symbol=>::String}]
423
+ # @!attribute [rw] retry_policy
424
+ # The retry policy. The value is a hash with the following keys:
425
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
426
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
427
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
428
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
429
+ # trigger a retry.
430
+ # @return [::Hash]
431
+ # @!attribute [rw] quota_project
432
+ # A separate project against which to charge quota.
433
+ # @return [::String]
434
+ # @!attribute [rw] universe_domain
435
+ # The universe domain within which to make requests. This determines the
436
+ # default endpoint URL. The default value of nil uses the environment
437
+ # universe (usually the default "googleapis.com" universe).
438
+ # @return [::String,nil]
439
+ #
440
+ class Configuration
441
+ extend ::Gapic::Config
442
+
443
+ # @private
444
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
445
+ DEFAULT_ENDPOINT = "aiplatform.googleapis.com"
446
+
447
+ config_attr :endpoint, nil, ::String, nil
448
+ config_attr :credentials, nil do |value|
449
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
450
+ allowed.any? { |klass| klass === value }
451
+ end
452
+ config_attr :scope, nil, ::String, ::Array, nil
453
+ config_attr :lib_name, nil, ::String, nil
454
+ config_attr :lib_version, nil, ::String, nil
455
+ config_attr :timeout, nil, ::Numeric, nil
456
+ config_attr :metadata, nil, ::Hash, nil
457
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
458
+ config_attr :quota_project, nil, ::String, nil
459
+ config_attr :universe_domain, nil, ::String, nil
460
+
461
+ # @private
462
+ # Overrides for http bindings for the RPCs of this service
463
+ # are only used when this service is used as mixin, and only
464
+ # by the host service.
465
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
466
+ config_attr :bindings_override, {}, ::Hash, nil
467
+
468
+ # @private
469
+ def initialize parent_config = nil
470
+ @parent_config = parent_config unless parent_config.nil?
471
+
472
+ yield self if block_given?
473
+ end
474
+
475
+ ##
476
+ # Configurations for individual RPCs
477
+ # @return [Rpcs]
478
+ #
479
+ def rpcs
480
+ @rpcs ||= begin
481
+ parent_rpcs = nil
482
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
483
+ Rpcs.new parent_rpcs
484
+ end
485
+ end
486
+
487
+ ##
488
+ # Configuration RPC class for the LlmUtilityService API.
489
+ #
490
+ # Includes fields providing the configuration for each RPC in this service.
491
+ # Each configuration object is of type `Gapic::Config::Method` and includes
492
+ # the following configuration fields:
493
+ #
494
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
495
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
496
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
497
+ # include the following keys:
498
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
499
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
500
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
501
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
502
+ # trigger a retry.
503
+ #
504
+ class Rpcs
505
+ ##
506
+ # RPC-specific configuration for `count_tokens`
507
+ # @return [::Gapic::Config::Method]
508
+ #
509
+ attr_reader :count_tokens
510
+ ##
511
+ # RPC-specific configuration for `compute_tokens`
512
+ # @return [::Gapic::Config::Method]
513
+ #
514
+ attr_reader :compute_tokens
515
+
516
+ # @private
517
+ def initialize parent_rpcs = nil
518
+ count_tokens_config = parent_rpcs.count_tokens if parent_rpcs.respond_to? :count_tokens
519
+ @count_tokens = ::Gapic::Config::Method.new count_tokens_config
520
+ compute_tokens_config = parent_rpcs.compute_tokens if parent_rpcs.respond_to? :compute_tokens
521
+ @compute_tokens = ::Gapic::Config::Method.new compute_tokens_config
522
+
523
+ yield self if block_given?
524
+ end
525
+ end
526
+ end
527
+ end
528
+ end
529
+ end
530
+ end
531
+ end
532
+ end
533
+ end