google-cloud-ai_platform-v1 0.60.0 → 0.62.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -20
- data/lib/google/cloud/ai_platform/v1/dataset_service/client.rb +43 -20
- data/lib/google/cloud/ai_platform/v1/dataset_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/dataset_service/rest/client.rb +43 -20
- data/lib/google/cloud/ai_platform/v1/dataset_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/dataset_service/rest/service_stub.rb +166 -116
- data/lib/google/cloud/ai_platform/v1/deployment_resource_pool_service/client.rb +34 -7
- data/lib/google/cloud/ai_platform/v1/deployment_resource_pool_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/deployment_resource_pool_service/rest/client.rb +33 -7
- data/lib/google/cloud/ai_platform/v1/deployment_resource_pool_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/deployment_resource_pool_service/rest/service_stub.rb +62 -38
- data/lib/google/cloud/ai_platform/v1/endpoint_service/client.rb +36 -10
- data/lib/google/cloud/ai_platform/v1/endpoint_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/endpoint_service/rest/client.rb +36 -10
- data/lib/google/cloud/ai_platform/v1/endpoint_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/endpoint_service/rest/service_stub.rb +86 -56
- data/lib/google/cloud/ai_platform/v1/evaluation_service/client.rb +29 -2
- data/lib/google/cloud/ai_platform/v1/evaluation_service/rest/client.rb +29 -2
- data/lib/google/cloud/ai_platform/v1/evaluation_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/ai_platform/v1/feature_online_store_admin_service/client.rb +38 -14
- data/lib/google/cloud/ai_platform/v1/feature_online_store_admin_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/feature_online_store_admin_service/rest/client.rb +38 -14
- data/lib/google/cloud/ai_platform/v1/feature_online_store_admin_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/feature_online_store_admin_service/rest/service_stub.rb +118 -80
- data/lib/google/cloud/ai_platform/v1/feature_online_store_service/client.rb +29 -3
- data/lib/google/cloud/ai_platform/v1/feature_online_store_service/rest/client.rb +29 -3
- data/lib/google/cloud/ai_platform/v1/feature_online_store_service/rest/service_stub.rb +30 -14
- data/lib/google/cloud/ai_platform/v1/feature_registry_service/client.rb +38 -12
- data/lib/google/cloud/ai_platform/v1/feature_registry_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/feature_registry_service/rest/client.rb +38 -12
- data/lib/google/cloud/ai_platform/v1/feature_registry_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/feature_registry_service/rest/service_stub.rb +102 -68
- data/lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/client.rb +29 -4
- data/lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/rest/client.rb +29 -3
- data/lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/rest/service_stub.rb +31 -14
- data/lib/google/cloud/ai_platform/v1/featurestore_service/client.rb +45 -22
- data/lib/google/cloud/ai_platform/v1/featurestore_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/featurestore_service/rest/client.rb +45 -22
- data/lib/google/cloud/ai_platform/v1/featurestore_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/featurestore_service/rest/service_stub.rb +182 -128
- data/lib/google/cloud/ai_platform/v1/gen_ai_cache_service/client.rb +872 -0
- data/lib/google/cloud/ai_platform/v1/gen_ai_cache_service/credentials.rb +47 -0
- data/lib/google/cloud/ai_platform/v1/gen_ai_cache_service/paths.rb +88 -0
- data/lib/google/cloud/ai_platform/v1/gen_ai_cache_service/rest/client.rb +820 -0
- data/lib/google/cloud/ai_platform/v1/gen_ai_cache_service/rest/service_stub.rb +388 -0
- data/lib/google/cloud/ai_platform/v1/gen_ai_cache_service/rest.rb +53 -0
- data/lib/google/cloud/ai_platform/v1/gen_ai_cache_service.rb +55 -0
- data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/client.rb +31 -6
- data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/rest/client.rb +31 -6
- data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/ai_platform/v1/index_endpoint_service/client.rb +35 -9
- data/lib/google/cloud/ai_platform/v1/index_endpoint_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/index_endpoint_service/rest/client.rb +35 -9
- data/lib/google/cloud/ai_platform/v1/index_endpoint_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/index_endpoint_service/rest/service_stub.rb +78 -50
- data/lib/google/cloud/ai_platform/v1/index_service/client.rb +33 -8
- data/lib/google/cloud/ai_platform/v1/index_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/index_service/rest/client.rb +33 -8
- data/lib/google/cloud/ai_platform/v1/index_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/index_service/rest/service_stub.rb +70 -44
- data/lib/google/cloud/ai_platform/v1/job_service/client.rb +44 -36
- data/lib/google/cloud/ai_platform/v1/job_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/job_service/rest/client.rb +44 -36
- data/lib/google/cloud/ai_platform/v1/job_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/job_service/rest/service_stub.rb +294 -212
- data/lib/google/cloud/ai_platform/v1/llm_utility_service/client.rb +29 -3
- data/lib/google/cloud/ai_platform/v1/llm_utility_service/rest/client.rb +29 -3
- data/lib/google/cloud/ai_platform/v1/llm_utility_service/rest/service_stub.rb +30 -14
- data/lib/google/cloud/ai_platform/v1/match_service/client.rb +29 -3
- data/lib/google/cloud/ai_platform/v1/match_service/rest/client.rb +29 -3
- data/lib/google/cloud/ai_platform/v1/match_service/rest/service_stub.rb +30 -14
- data/lib/google/cloud/ai_platform/v1/metadata_service/client.rb +42 -33
- data/lib/google/cloud/ai_platform/v1/metadata_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/metadata_service/rest/client.rb +42 -33
- data/lib/google/cloud/ai_platform/v1/metadata_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/metadata_service/rest/service_stub.rb +270 -194
- data/lib/google/cloud/ai_platform/v1/migration_service/client.rb +31 -3
- data/lib/google/cloud/ai_platform/v1/migration_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/migration_service/rest/client.rb +31 -3
- data/lib/google/cloud/ai_platform/v1/migration_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/migration_service/rest/service_stub.rb +30 -14
- data/lib/google/cloud/ai_platform/v1/model_garden_service/client.rb +29 -2
- data/lib/google/cloud/ai_platform/v1/model_garden_service/rest/client.rb +29 -2
- data/lib/google/cloud/ai_platform/v1/model_garden_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/ai_platform/v1/model_service/client.rb +39 -19
- data/lib/google/cloud/ai_platform/v1/model_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/model_service/rest/client.rb +39 -19
- data/lib/google/cloud/ai_platform/v1/model_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/model_service/rest/service_stub.rb +158 -110
- data/lib/google/cloud/ai_platform/v1/notebook_service/client.rb +41 -17
- data/lib/google/cloud/ai_platform/v1/notebook_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/notebook_service/rest/client.rb +41 -17
- data/lib/google/cloud/ai_platform/v1/notebook_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/notebook_service/rest/service_stub.rb +142 -98
- data/lib/google/cloud/ai_platform/v1/persistent_resource_service/client.rb +34 -7
- data/lib/google/cloud/ai_platform/v1/persistent_resource_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/persistent_resource_service/rest/client.rb +34 -7
- data/lib/google/cloud/ai_platform/v1/persistent_resource_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/persistent_resource_service/rest/service_stub.rb +62 -38
- data/lib/google/cloud/ai_platform/v1/pipeline_service/client.rb +35 -13
- data/lib/google/cloud/ai_platform/v1/pipeline_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/pipeline_service/rest/client.rb +35 -13
- data/lib/google/cloud/ai_platform/v1/pipeline_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/pipeline_service/rest/service_stub.rb +110 -74
- data/lib/google/cloud/ai_platform/v1/prediction_service/client.rb +43 -16
- data/lib/google/cloud/ai_platform/v1/prediction_service/paths.rb +19 -0
- data/lib/google/cloud/ai_platform/v1/prediction_service/rest/client.rb +43 -9
- data/lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb +65 -38
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_execution_service/client.rb +593 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_execution_service/credentials.rb +47 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_execution_service/paths.rb +52 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_execution_service/rest/client.rb +564 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_execution_service/rest/service_stub.rb +199 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_execution_service/rest.rb +53 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_execution_service.rb +55 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_service/client.rb +914 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_service/credentials.rb +47 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_service/operations.rb +814 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_service/paths.rb +69 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_service/rest/client.rb +862 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_service/rest/operations.rb +4293 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_service/rest/service_stub.rb +388 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_service/rest.rb +54 -0
- data/lib/google/cloud/ai_platform/v1/reasoning_engine_service.rb +56 -0
- data/lib/google/cloud/ai_platform/v1/rest.rb +3 -0
- data/lib/google/cloud/ai_platform/v1/schedule_service/client.rb +31 -8
- data/lib/google/cloud/ai_platform/v1/schedule_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/schedule_service/rest/client.rb +31 -8
- data/lib/google/cloud/ai_platform/v1/schedule_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/schedule_service/rest/service_stub.rb +70 -44
- data/lib/google/cloud/ai_platform/v1/specialist_pool_service/client.rb +33 -6
- data/lib/google/cloud/ai_platform/v1/specialist_pool_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/specialist_pool_service/rest/client.rb +33 -6
- data/lib/google/cloud/ai_platform/v1/specialist_pool_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/specialist_pool_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/ai_platform/v1/tensorboard_service/client.rb +40 -31
- data/lib/google/cloud/ai_platform/v1/tensorboard_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/tensorboard_service/rest/client.rb +40 -30
- data/lib/google/cloud/ai_platform/v1/tensorboard_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/tensorboard_service/rest/service_stub.rb +247 -176
- data/lib/google/cloud/ai_platform/v1/version.rb +1 -1
- data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/client.rb +36 -11
- data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/rest/client.rb +36 -11
- data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/rest/service_stub.rb +94 -62
- data/lib/google/cloud/ai_platform/v1/vertex_rag_service/client.rb +29 -4
- data/lib/google/cloud/ai_platform/v1/vertex_rag_service/rest/client.rb +29 -4
- data/lib/google/cloud/ai_platform/v1/vertex_rag_service/rest/service_stub.rb +38 -20
- data/lib/google/cloud/ai_platform/v1/vizier_service/client.rb +33 -16
- data/lib/google/cloud/ai_platform/v1/vizier_service/operations.rb +9 -5
- data/lib/google/cloud/ai_platform/v1/vizier_service/rest/client.rb +33 -16
- data/lib/google/cloud/ai_platform/v1/vizier_service/rest/operations.rb +84 -35
- data/lib/google/cloud/ai_platform/v1/vizier_service/rest/service_stub.rb +134 -92
- data/lib/google/cloud/ai_platform/v1.rb +3 -0
- data/lib/google/cloud/aiplatform/v1/accelerator_type_pb.rb +1 -1
- data/lib/google/cloud/aiplatform/v1/cached_content_pb.rb +54 -0
- data/lib/google/cloud/aiplatform/v1/gen_ai_cache_service_pb.rb +57 -0
- data/lib/google/cloud/aiplatform/v1/gen_ai_cache_service_services_pb.rb +54 -0
- data/lib/google/cloud/aiplatform/v1/notebook_runtime_pb.rb +1 -1
- data/lib/google/cloud/aiplatform/v1/prediction_service_pb.rb +1 -1
- data/lib/google/cloud/aiplatform/v1/reasoning_engine_execution_service_pb.rb +52 -0
- data/lib/google/cloud/aiplatform/v1/reasoning_engine_execution_service_services_pb.rb +47 -0
- data/lib/google/cloud/aiplatform/v1/reasoning_engine_pb.rb +51 -0
- data/lib/google/cloud/aiplatform/v1/reasoning_engine_service_pb.rb +62 -0
- data/lib/google/cloud/aiplatform/v1/reasoning_engine_service_services_pb.rb +53 -0
- data/lib/google/cloud/aiplatform/v1/tool_pb.rb +4 -1
- data/proto_docs/google/cloud/aiplatform/v1/accelerator_type.rb +3 -0
- data/proto_docs/google/cloud/aiplatform/v1/cached_content.rb +101 -0
- data/proto_docs/google/cloud/aiplatform/v1/gen_ai_cache_service.rb +108 -0
- data/proto_docs/google/cloud/aiplatform/v1/notebook_runtime.rb +42 -2
- data/proto_docs/google/cloud/aiplatform/v1/prediction_service.rb +11 -0
- data/proto_docs/google/cloud/aiplatform/v1/reasoning_engine.rb +87 -0
- data/proto_docs/google/cloud/aiplatform/v1/reasoning_engine_execution_service.rb +73 -0
- data/proto_docs/google/cloud/aiplatform/v1/reasoning_engine_service.rb +136 -0
- data/proto_docs/google/cloud/aiplatform/v1/tool.rb +15 -0
- data/proto_docs/google/type/latlng.rb +38 -0
- metadata +42 -8
@@ -152,15 +152,27 @@ module Google
|
|
152
152
|
endpoint: @config.endpoint,
|
153
153
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
154
154
|
universe_domain: @config.universe_domain,
|
155
|
-
credentials: credentials
|
155
|
+
credentials: credentials,
|
156
|
+
logger: @config.logger
|
156
157
|
)
|
157
158
|
|
159
|
+
@prediction_service_stub.logger(stub: true)&.info do |entry|
|
160
|
+
entry.set_system_name
|
161
|
+
entry.set_service
|
162
|
+
entry.message = "Created client for #{entry.service}"
|
163
|
+
entry.set_credentials_fields credentials
|
164
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
165
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
166
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
167
|
+
end
|
168
|
+
|
158
169
|
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
159
170
|
config.credentials = credentials
|
160
171
|
config.quota_project = @quota_project_id
|
161
172
|
config.endpoint = @prediction_service_stub.endpoint
|
162
173
|
config.universe_domain = @prediction_service_stub.universe_domain
|
163
174
|
config.bindings_override = @config.bindings_override
|
175
|
+
config.logger = @prediction_service_stub.logger if config.respond_to? :logger=
|
164
176
|
end
|
165
177
|
|
166
178
|
@iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
|
@@ -169,6 +181,7 @@ module Google
|
|
169
181
|
config.endpoint = @prediction_service_stub.endpoint
|
170
182
|
config.universe_domain = @prediction_service_stub.universe_domain
|
171
183
|
config.bindings_override = @config.bindings_override
|
184
|
+
config.logger = @prediction_service_stub.logger if config.respond_to? :logger=
|
172
185
|
end
|
173
186
|
end
|
174
187
|
|
@@ -186,6 +199,15 @@ module Google
|
|
186
199
|
#
|
187
200
|
attr_reader :iam_policy_client
|
188
201
|
|
202
|
+
##
|
203
|
+
# The logger used for request/response debug logging.
|
204
|
+
#
|
205
|
+
# @return [Logger]
|
206
|
+
#
|
207
|
+
def logger
|
208
|
+
@prediction_service_stub.logger
|
209
|
+
end
|
210
|
+
|
189
211
|
# Service calls
|
190
212
|
|
191
213
|
##
|
@@ -279,7 +301,6 @@ module Google
|
|
279
301
|
|
280
302
|
@prediction_service_stub.predict request, options do |result, operation|
|
281
303
|
yield result, operation if block_given?
|
282
|
-
return result
|
283
304
|
end
|
284
305
|
rescue ::Gapic::Rest::Error => e
|
285
306
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -386,7 +407,6 @@ module Google
|
|
386
407
|
|
387
408
|
@prediction_service_stub.raw_predict request, options do |result, operation|
|
388
409
|
yield result, operation if block_given?
|
389
|
-
return result
|
390
410
|
end
|
391
411
|
rescue ::Gapic::Rest::Error => e
|
392
412
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -559,7 +579,6 @@ module Google
|
|
559
579
|
|
560
580
|
@prediction_service_stub.direct_predict request, options do |result, operation|
|
561
581
|
yield result, operation if block_given?
|
562
|
-
return result
|
563
582
|
end
|
564
583
|
rescue ::Gapic::Rest::Error => e
|
565
584
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -651,7 +670,6 @@ module Google
|
|
651
670
|
|
652
671
|
@prediction_service_stub.direct_raw_predict request, options do |result, operation|
|
653
672
|
yield result, operation if block_given?
|
654
|
-
return result
|
655
673
|
end
|
656
674
|
rescue ::Gapic::Rest::Error => e
|
657
675
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -861,7 +879,6 @@ module Google
|
|
861
879
|
|
862
880
|
@prediction_service_stub.explain request, options do |result, operation|
|
863
881
|
yield result, operation if block_given?
|
864
|
-
return result
|
865
882
|
end
|
866
883
|
rescue ::Gapic::Rest::Error => e
|
867
884
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -880,7 +897,7 @@ module Google
|
|
880
897
|
# @param options [::Gapic::CallOptions, ::Hash]
|
881
898
|
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
882
899
|
#
|
883
|
-
# @overload generate_content(model: nil, contents: nil, system_instruction: nil, tools: nil, tool_config: nil, labels: nil, safety_settings: nil, generation_config: nil)
|
900
|
+
# @overload generate_content(model: nil, contents: nil, system_instruction: nil, cached_content: nil, tools: nil, tool_config: nil, labels: nil, safety_settings: nil, generation_config: nil)
|
884
901
|
# Pass arguments to `generate_content` via keyword arguments. Note that at
|
885
902
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
886
903
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -904,6 +921,12 @@ module Google
|
|
904
921
|
# Optional. The user provided system instructions for the model.
|
905
922
|
# Note: only text should be used in parts and content in each part will be in
|
906
923
|
# a separate paragraph.
|
924
|
+
# @param cached_content [::String]
|
925
|
+
# Optional. The name of the cached content used as context to serve the
|
926
|
+
# prediction. Note: only used in explicit caching, where users can have
|
927
|
+
# control over caching (e.g. what content to cache) and enjoy guaranteed cost
|
928
|
+
# savings. Format:
|
929
|
+
# `projects/{project}/locations/{location}/cachedContents/{cachedContent}`
|
907
930
|
# @param tools [::Array<::Google::Cloud::AIPlatform::V1::Tool, ::Hash>]
|
908
931
|
# Optional. A list of `Tools` the model may use to generate the next
|
909
932
|
# response.
|
@@ -980,7 +1003,6 @@ module Google
|
|
980
1003
|
|
981
1004
|
@prediction_service_stub.generate_content request, options do |result, operation|
|
982
1005
|
yield result, operation if block_given?
|
983
|
-
return result
|
984
1006
|
end
|
985
1007
|
rescue ::Gapic::Rest::Error => e
|
986
1008
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -999,7 +1021,7 @@ module Google
|
|
999
1021
|
# @param options [::Gapic::CallOptions, ::Hash]
|
1000
1022
|
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1001
1023
|
#
|
1002
|
-
# @overload stream_generate_content(model: nil, contents: nil, system_instruction: nil, tools: nil, tool_config: nil, labels: nil, safety_settings: nil, generation_config: nil)
|
1024
|
+
# @overload stream_generate_content(model: nil, contents: nil, system_instruction: nil, cached_content: nil, tools: nil, tool_config: nil, labels: nil, safety_settings: nil, generation_config: nil)
|
1003
1025
|
# Pass arguments to `stream_generate_content` via keyword arguments. Note that at
|
1004
1026
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
1005
1027
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -1023,6 +1045,12 @@ module Google
|
|
1023
1045
|
# Optional. The user provided system instructions for the model.
|
1024
1046
|
# Note: only text should be used in parts and content in each part will be in
|
1025
1047
|
# a separate paragraph.
|
1048
|
+
# @param cached_content [::String]
|
1049
|
+
# Optional. The name of the cached content used as context to serve the
|
1050
|
+
# prediction. Note: only used in explicit caching, where users can have
|
1051
|
+
# control over caching (e.g. what content to cache) and enjoy guaranteed cost
|
1052
|
+
# savings. Format:
|
1053
|
+
# `projects/{project}/locations/{location}/cachedContents/{cachedContent}`
|
1026
1054
|
# @param tools [::Array<::Google::Cloud::AIPlatform::V1::Tool, ::Hash>]
|
1027
1055
|
# Optional. A list of `Tools` the model may use to generate the next
|
1028
1056
|
# response.
|
@@ -1183,6 +1211,11 @@ module Google
|
|
1183
1211
|
# default endpoint URL. The default value of nil uses the environment
|
1184
1212
|
# universe (usually the default "googleapis.com" universe).
|
1185
1213
|
# @return [::String,nil]
|
1214
|
+
# @!attribute [rw] logger
|
1215
|
+
# A custom logger to use for request/response debug logging, or the value
|
1216
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
1217
|
+
# explicitly disable logging.
|
1218
|
+
# @return [::Logger,:default,nil]
|
1186
1219
|
#
|
1187
1220
|
class Configuration
|
1188
1221
|
extend ::Gapic::Config
|
@@ -1211,6 +1244,7 @@ module Google
|
|
1211
1244
|
# by the host service.
|
1212
1245
|
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
1213
1246
|
config_attr :bindings_override, {}, ::Hash, nil
|
1247
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
1214
1248
|
|
1215
1249
|
# @private
|
1216
1250
|
def initialize parent_config = nil
|
@@ -30,7 +30,8 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
|
33
|
+
# @private
|
34
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
|
34
35
|
# These require statements are intentionally placed here to initialize
|
35
36
|
# the REST modules only when it's required.
|
36
37
|
require "gapic/rest"
|
@@ -40,7 +41,9 @@ module Google
|
|
40
41
|
universe_domain: universe_domain,
|
41
42
|
credentials: credentials,
|
42
43
|
numeric_enums: true,
|
43
|
-
|
44
|
+
service_name: self.class,
|
45
|
+
raise_faraday_errors: false,
|
46
|
+
logger: logger
|
44
47
|
end
|
45
48
|
|
46
49
|
##
|
@@ -61,6 +64,15 @@ module Google
|
|
61
64
|
@client_stub.endpoint
|
62
65
|
end
|
63
66
|
|
67
|
+
##
|
68
|
+
# The logger used for request/response debug logging.
|
69
|
+
#
|
70
|
+
# @return [Logger]
|
71
|
+
#
|
72
|
+
def logger stub: false
|
73
|
+
stub ? @client_stub.stub_logger : @client_stub.logger
|
74
|
+
end
|
75
|
+
|
64
76
|
##
|
65
77
|
# Baseline implementation for the predict REST call
|
66
78
|
#
|
@@ -87,16 +99,18 @@ module Google
|
|
87
99
|
|
88
100
|
response = @client_stub.make_http_request(
|
89
101
|
verb,
|
90
|
-
uri:
|
91
|
-
body:
|
92
|
-
params:
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "predict",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::AIPlatform::V1::PredictResponse.decode_json response.body, ignore_unknown_fields: true
|
97
|
-
|
98
|
-
|
99
|
-
|
110
|
+
catch :response do
|
111
|
+
yield result, operation if block_given?
|
112
|
+
result
|
113
|
+
end
|
100
114
|
end
|
101
115
|
|
102
116
|
##
|
@@ -125,16 +139,18 @@ module Google
|
|
125
139
|
|
126
140
|
response = @client_stub.make_http_request(
|
127
141
|
verb,
|
128
|
-
uri:
|
129
|
-
body:
|
130
|
-
params:
|
142
|
+
uri: uri,
|
143
|
+
body: body || "",
|
144
|
+
params: query_string_params,
|
145
|
+
method_name: "raw_predict",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Api::HttpBody.decode_json response.body, ignore_unknown_fields: true
|
135
|
-
|
136
|
-
|
137
|
-
|
150
|
+
catch :response do
|
151
|
+
yield result, operation if block_given?
|
152
|
+
result
|
153
|
+
end
|
138
154
|
end
|
139
155
|
|
140
156
|
##
|
@@ -163,6 +179,7 @@ module Google
|
|
163
179
|
uri: uri,
|
164
180
|
body: body || "",
|
165
181
|
params: query_string_params,
|
182
|
+
method_name: "stream_raw_predict",
|
166
183
|
options: options,
|
167
184
|
is_server_streaming: true,
|
168
185
|
&block
|
@@ -196,16 +213,18 @@ module Google
|
|
196
213
|
|
197
214
|
response = @client_stub.make_http_request(
|
198
215
|
verb,
|
199
|
-
uri:
|
200
|
-
body:
|
201
|
-
params:
|
216
|
+
uri: uri,
|
217
|
+
body: body || "",
|
218
|
+
params: query_string_params,
|
219
|
+
method_name: "direct_predict",
|
202
220
|
options: options
|
203
221
|
)
|
204
222
|
operation = ::Gapic::Rest::TransportOperation.new response
|
205
223
|
result = ::Google::Cloud::AIPlatform::V1::DirectPredictResponse.decode_json response.body, ignore_unknown_fields: true
|
206
|
-
|
207
|
-
|
208
|
-
|
224
|
+
catch :response do
|
225
|
+
yield result, operation if block_given?
|
226
|
+
result
|
227
|
+
end
|
209
228
|
end
|
210
229
|
|
211
230
|
##
|
@@ -234,16 +253,18 @@ module Google
|
|
234
253
|
|
235
254
|
response = @client_stub.make_http_request(
|
236
255
|
verb,
|
237
|
-
uri:
|
238
|
-
body:
|
239
|
-
params:
|
256
|
+
uri: uri,
|
257
|
+
body: body || "",
|
258
|
+
params: query_string_params,
|
259
|
+
method_name: "direct_raw_predict",
|
240
260
|
options: options
|
241
261
|
)
|
242
262
|
operation = ::Gapic::Rest::TransportOperation.new response
|
243
263
|
result = ::Google::Cloud::AIPlatform::V1::DirectRawPredictResponse.decode_json response.body, ignore_unknown_fields: true
|
244
|
-
|
245
|
-
|
246
|
-
|
264
|
+
catch :response do
|
265
|
+
yield result, operation if block_given?
|
266
|
+
result
|
267
|
+
end
|
247
268
|
end
|
248
269
|
|
249
270
|
##
|
@@ -272,6 +293,7 @@ module Google
|
|
272
293
|
uri: uri,
|
273
294
|
body: body || "",
|
274
295
|
params: query_string_params,
|
296
|
+
method_name: "server_streaming_predict",
|
275
297
|
options: options,
|
276
298
|
is_server_streaming: true,
|
277
299
|
&block
|
@@ -305,16 +327,18 @@ module Google
|
|
305
327
|
|
306
328
|
response = @client_stub.make_http_request(
|
307
329
|
verb,
|
308
|
-
uri:
|
309
|
-
body:
|
310
|
-
params:
|
330
|
+
uri: uri,
|
331
|
+
body: body || "",
|
332
|
+
params: query_string_params,
|
333
|
+
method_name: "explain",
|
311
334
|
options: options
|
312
335
|
)
|
313
336
|
operation = ::Gapic::Rest::TransportOperation.new response
|
314
337
|
result = ::Google::Cloud::AIPlatform::V1::ExplainResponse.decode_json response.body, ignore_unknown_fields: true
|
315
|
-
|
316
|
-
|
317
|
-
|
338
|
+
catch :response do
|
339
|
+
yield result, operation if block_given?
|
340
|
+
result
|
341
|
+
end
|
318
342
|
end
|
319
343
|
|
320
344
|
##
|
@@ -343,16 +367,18 @@ module Google
|
|
343
367
|
|
344
368
|
response = @client_stub.make_http_request(
|
345
369
|
verb,
|
346
|
-
uri:
|
347
|
-
body:
|
348
|
-
params:
|
370
|
+
uri: uri,
|
371
|
+
body: body || "",
|
372
|
+
params: query_string_params,
|
373
|
+
method_name: "generate_content",
|
349
374
|
options: options
|
350
375
|
)
|
351
376
|
operation = ::Gapic::Rest::TransportOperation.new response
|
352
377
|
result = ::Google::Cloud::AIPlatform::V1::GenerateContentResponse.decode_json response.body, ignore_unknown_fields: true
|
353
|
-
|
354
|
-
|
355
|
-
|
378
|
+
catch :response do
|
379
|
+
yield result, operation if block_given?
|
380
|
+
result
|
381
|
+
end
|
356
382
|
end
|
357
383
|
|
358
384
|
##
|
@@ -381,6 +407,7 @@ module Google
|
|
381
407
|
uri: uri,
|
382
408
|
body: body || "",
|
383
409
|
params: query_string_params,
|
410
|
+
method_name: "stream_generate_content",
|
384
411
|
options: options,
|
385
412
|
is_server_streaming: true,
|
386
413
|
&block
|