[e3d4e0a] | 1 | <?php
|
---|
| 2 | /*
|
---|
| 3 | * Copyright 2014 Google Inc.
|
---|
| 4 | *
|
---|
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
| 6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
| 7 | * the License at
|
---|
| 8 | *
|
---|
| 9 | * http://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, WITHOUT
|
---|
| 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
| 14 | * License for the specific language governing permissions and limitations under
|
---|
| 15 | * the License.
|
---|
| 16 | */
|
---|
| 17 |
|
---|
| 18 | namespace Google\Service\Aiplatform\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Aiplatform\GoogleApiHttpBody;
|
---|
| 21 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1ComputeTokensRequest;
|
---|
| 22 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1ComputeTokensResponse;
|
---|
| 23 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1CountTokensRequest;
|
---|
| 24 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1CountTokensResponse;
|
---|
| 25 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1DeployModelRequest;
|
---|
| 26 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1DirectPredictRequest;
|
---|
| 27 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1DirectPredictResponse;
|
---|
| 28 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1DirectRawPredictRequest;
|
---|
| 29 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1DirectRawPredictResponse;
|
---|
| 30 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1Endpoint;
|
---|
| 31 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1ExplainRequest;
|
---|
| 32 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1ExplainResponse;
|
---|
| 33 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1FetchPredictOperationRequest;
|
---|
| 34 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1GenerateContentRequest;
|
---|
| 35 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1GenerateContentResponse;
|
---|
| 36 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1ListEndpointsResponse;
|
---|
| 37 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1MutateDeployedModelRequest;
|
---|
| 38 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1PredictLongRunningRequest;
|
---|
| 39 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1PredictRequest;
|
---|
| 40 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1PredictResponse;
|
---|
| 41 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1RawPredictRequest;
|
---|
| 42 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1StreamRawPredictRequest;
|
---|
| 43 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1StreamingPredictRequest;
|
---|
| 44 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1StreamingPredictResponse;
|
---|
| 45 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1UndeployModelRequest;
|
---|
| 46 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1UpdateEndpointLongRunningRequest;
|
---|
| 47 | use Google\Service\Aiplatform\GoogleLongrunningOperation;
|
---|
| 48 |
|
---|
| 49 | /**
|
---|
| 50 | * The "endpoints" collection of methods.
|
---|
| 51 | * Typical usage is:
|
---|
| 52 | * <code>
|
---|
| 53 | * $aiplatformService = new Google\Service\Aiplatform(...);
|
---|
| 54 | * $endpoints = $aiplatformService->projects_locations_endpoints;
|
---|
| 55 | * </code>
|
---|
| 56 | */
|
---|
| 57 | class ProjectsLocationsEndpoints extends \Google\Service\Resource
|
---|
| 58 | {
|
---|
| 59 | /**
|
---|
| 60 | * Return a list of tokens based on the input text. (endpoints.computeTokens)
|
---|
| 61 | *
|
---|
| 62 | * @param string $endpoint Required. The name of the Endpoint requested to get
|
---|
| 63 | * lists of tokens and token ids.
|
---|
| 64 | * @param GoogleCloudAiplatformV1ComputeTokensRequest $postBody
|
---|
| 65 | * @param array $optParams Optional parameters.
|
---|
| 66 | * @return GoogleCloudAiplatformV1ComputeTokensResponse
|
---|
| 67 | * @throws \Google\Service\Exception
|
---|
| 68 | */
|
---|
| 69 | public function computeTokens($endpoint, GoogleCloudAiplatformV1ComputeTokensRequest $postBody, $optParams = [])
|
---|
| 70 | {
|
---|
| 71 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 72 | $params = array_merge($params, $optParams);
|
---|
| 73 | return $this->call('computeTokens', [$params], GoogleCloudAiplatformV1ComputeTokensResponse::class);
|
---|
| 74 | }
|
---|
| 75 | /**
|
---|
| 76 | * Perform a token counting. (endpoints.countTokens)
|
---|
| 77 | *
|
---|
| 78 | * @param string $endpoint Required. The name of the Endpoint requested to
|
---|
| 79 | * perform token counting. Format:
|
---|
| 80 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 81 | * @param GoogleCloudAiplatformV1CountTokensRequest $postBody
|
---|
| 82 | * @param array $optParams Optional parameters.
|
---|
| 83 | * @return GoogleCloudAiplatformV1CountTokensResponse
|
---|
| 84 | * @throws \Google\Service\Exception
|
---|
| 85 | */
|
---|
| 86 | public function countTokens($endpoint, GoogleCloudAiplatformV1CountTokensRequest $postBody, $optParams = [])
|
---|
| 87 | {
|
---|
| 88 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 89 | $params = array_merge($params, $optParams);
|
---|
| 90 | return $this->call('countTokens', [$params], GoogleCloudAiplatformV1CountTokensResponse::class);
|
---|
| 91 | }
|
---|
| 92 | /**
|
---|
| 93 | * Creates an Endpoint. (endpoints.create)
|
---|
| 94 | *
|
---|
| 95 | * @param string $parent Required. The resource name of the Location to create
|
---|
| 96 | * the Endpoint in. Format: `projects/{project}/locations/{location}`
|
---|
| 97 | * @param GoogleCloudAiplatformV1Endpoint $postBody
|
---|
| 98 | * @param array $optParams Optional parameters.
|
---|
| 99 | *
|
---|
| 100 | * @opt_param string endpointId Immutable. The ID to use for endpoint, which
|
---|
| 101 | * will become the final component of the endpoint resource name. If not
|
---|
| 102 | * provided, Vertex AI will generate a value for this ID. If the first character
|
---|
| 103 | * is a letter, this value may be up to 63 characters, and valid characters are
|
---|
| 104 | * `[a-z0-9-]`. The last character must be a letter or number. If the first
|
---|
| 105 | * character is a number, this value may be up to 9 characters, and valid
|
---|
| 106 | * characters are `[0-9]` with no leading zeros. When using HTTP/JSON, this
|
---|
| 107 | * field is populated based on a query string argument, such as
|
---|
| 108 | * `?endpoint_id=12345`. This is the fallback for fields that are not included
|
---|
| 109 | * in either the URI or the body.
|
---|
| 110 | * @return GoogleLongrunningOperation
|
---|
| 111 | * @throws \Google\Service\Exception
|
---|
| 112 | */
|
---|
| 113 | public function create($parent, GoogleCloudAiplatformV1Endpoint $postBody, $optParams = [])
|
---|
| 114 | {
|
---|
| 115 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 116 | $params = array_merge($params, $optParams);
|
---|
| 117 | return $this->call('create', [$params], GoogleLongrunningOperation::class);
|
---|
| 118 | }
|
---|
| 119 | /**
|
---|
| 120 | * Deletes an Endpoint. (endpoints.delete)
|
---|
| 121 | *
|
---|
| 122 | * @param string $name Required. The name of the Endpoint resource to be
|
---|
| 123 | * deleted. Format:
|
---|
| 124 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 125 | * @param array $optParams Optional parameters.
|
---|
| 126 | * @return GoogleLongrunningOperation
|
---|
| 127 | * @throws \Google\Service\Exception
|
---|
| 128 | */
|
---|
| 129 | public function delete($name, $optParams = [])
|
---|
| 130 | {
|
---|
| 131 | $params = ['name' => $name];
|
---|
| 132 | $params = array_merge($params, $optParams);
|
---|
| 133 | return $this->call('delete', [$params], GoogleLongrunningOperation::class);
|
---|
| 134 | }
|
---|
| 135 | /**
|
---|
| 136 | * Deploys a Model into this Endpoint, creating a DeployedModel within it.
|
---|
| 137 | * (endpoints.deployModel)
|
---|
| 138 | *
|
---|
| 139 | * @param string $endpoint Required. The name of the Endpoint resource into
|
---|
| 140 | * which to deploy a Model. Format:
|
---|
| 141 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 142 | * @param GoogleCloudAiplatformV1DeployModelRequest $postBody
|
---|
| 143 | * @param array $optParams Optional parameters.
|
---|
| 144 | * @return GoogleLongrunningOperation
|
---|
| 145 | * @throws \Google\Service\Exception
|
---|
| 146 | */
|
---|
| 147 | public function deployModel($endpoint, GoogleCloudAiplatformV1DeployModelRequest $postBody, $optParams = [])
|
---|
| 148 | {
|
---|
| 149 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 150 | $params = array_merge($params, $optParams);
|
---|
| 151 | return $this->call('deployModel', [$params], GoogleLongrunningOperation::class);
|
---|
| 152 | }
|
---|
| 153 | /**
|
---|
| 154 | * Perform an unary online prediction request to a gRPC model server for Vertex
|
---|
| 155 | * first-party products and frameworks. (endpoints.directPredict)
|
---|
| 156 | *
|
---|
| 157 | * @param string $endpoint Required. The name of the Endpoint requested to serve
|
---|
| 158 | * the prediction. Format:
|
---|
| 159 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 160 | * @param GoogleCloudAiplatformV1DirectPredictRequest $postBody
|
---|
| 161 | * @param array $optParams Optional parameters.
|
---|
| 162 | * @return GoogleCloudAiplatformV1DirectPredictResponse
|
---|
| 163 | * @throws \Google\Service\Exception
|
---|
| 164 | */
|
---|
| 165 | public function directPredict($endpoint, GoogleCloudAiplatformV1DirectPredictRequest $postBody, $optParams = [])
|
---|
| 166 | {
|
---|
| 167 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 168 | $params = array_merge($params, $optParams);
|
---|
| 169 | return $this->call('directPredict', [$params], GoogleCloudAiplatformV1DirectPredictResponse::class);
|
---|
| 170 | }
|
---|
| 171 | /**
|
---|
| 172 | * Perform an unary online prediction request to a gRPC model server for custom
|
---|
| 173 | * containers. (endpoints.directRawPredict)
|
---|
| 174 | *
|
---|
| 175 | * @param string $endpoint Required. The name of the Endpoint requested to serve
|
---|
| 176 | * the prediction. Format:
|
---|
| 177 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 178 | * @param GoogleCloudAiplatformV1DirectRawPredictRequest $postBody
|
---|
| 179 | * @param array $optParams Optional parameters.
|
---|
| 180 | * @return GoogleCloudAiplatformV1DirectRawPredictResponse
|
---|
| 181 | * @throws \Google\Service\Exception
|
---|
| 182 | */
|
---|
| 183 | public function directRawPredict($endpoint, GoogleCloudAiplatformV1DirectRawPredictRequest $postBody, $optParams = [])
|
---|
| 184 | {
|
---|
| 185 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 186 | $params = array_merge($params, $optParams);
|
---|
| 187 | return $this->call('directRawPredict', [$params], GoogleCloudAiplatformV1DirectRawPredictResponse::class);
|
---|
| 188 | }
|
---|
| 189 | /**
|
---|
| 190 | * Perform an online explanation. If deployed_model_id is specified, the
|
---|
| 191 | * corresponding DeployModel must have explanation_spec populated. If
|
---|
| 192 | * deployed_model_id is not specified, all DeployedModels must have
|
---|
| 193 | * explanation_spec populated. (endpoints.explain)
|
---|
| 194 | *
|
---|
| 195 | * @param string $endpoint Required. The name of the Endpoint requested to serve
|
---|
| 196 | * the explanation. Format:
|
---|
| 197 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 198 | * @param GoogleCloudAiplatformV1ExplainRequest $postBody
|
---|
| 199 | * @param array $optParams Optional parameters.
|
---|
| 200 | * @return GoogleCloudAiplatformV1ExplainResponse
|
---|
| 201 | * @throws \Google\Service\Exception
|
---|
| 202 | */
|
---|
| 203 | public function explain($endpoint, GoogleCloudAiplatformV1ExplainRequest $postBody, $optParams = [])
|
---|
| 204 | {
|
---|
| 205 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 206 | $params = array_merge($params, $optParams);
|
---|
| 207 | return $this->call('explain', [$params], GoogleCloudAiplatformV1ExplainResponse::class);
|
---|
| 208 | }
|
---|
| 209 | /**
|
---|
| 210 | * Fetch an asynchronous online prediction operation.
|
---|
| 211 | * (endpoints.fetchPredictOperation)
|
---|
| 212 | *
|
---|
| 213 | * @param string $endpoint Required. The name of the Endpoint requested to serve
|
---|
| 214 | * the prediction. Format:
|
---|
| 215 | * `projects/{project}/locations/{location}/endpoints/{endpoint}` or `projects/{
|
---|
| 216 | * project}/locations/{location}/publishers/{publisher}/models/{model}`
|
---|
| 217 | * @param GoogleCloudAiplatformV1FetchPredictOperationRequest $postBody
|
---|
| 218 | * @param array $optParams Optional parameters.
|
---|
| 219 | * @return GoogleLongrunningOperation
|
---|
| 220 | * @throws \Google\Service\Exception
|
---|
| 221 | */
|
---|
| 222 | public function fetchPredictOperation($endpoint, GoogleCloudAiplatformV1FetchPredictOperationRequest $postBody, $optParams = [])
|
---|
| 223 | {
|
---|
| 224 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 225 | $params = array_merge($params, $optParams);
|
---|
| 226 | return $this->call('fetchPredictOperation', [$params], GoogleLongrunningOperation::class);
|
---|
| 227 | }
|
---|
| 228 | /**
|
---|
| 229 | * Generate content with multimodal inputs. (endpoints.generateContent)
|
---|
| 230 | *
|
---|
| 231 | * @param string $model Required. The fully qualified name of the publisher
|
---|
| 232 | * model or tuned model endpoint to use. Publisher model format:
|
---|
| 233 | * `projects/{project}/locations/{location}/publishers/models` Tuned model
|
---|
| 234 | * endpoint format:
|
---|
| 235 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 236 | * @param GoogleCloudAiplatformV1GenerateContentRequest $postBody
|
---|
| 237 | * @param array $optParams Optional parameters.
|
---|
| 238 | * @return GoogleCloudAiplatformV1GenerateContentResponse
|
---|
| 239 | * @throws \Google\Service\Exception
|
---|
| 240 | */
|
---|
| 241 | public function generateContent($model, GoogleCloudAiplatformV1GenerateContentRequest $postBody, $optParams = [])
|
---|
| 242 | {
|
---|
| 243 | $params = ['model' => $model, 'postBody' => $postBody];
|
---|
| 244 | $params = array_merge($params, $optParams);
|
---|
| 245 | return $this->call('generateContent', [$params], GoogleCloudAiplatformV1GenerateContentResponse::class);
|
---|
| 246 | }
|
---|
| 247 | /**
|
---|
| 248 | * Gets an Endpoint. (endpoints.get)
|
---|
| 249 | *
|
---|
| 250 | * @param string $name Required. The name of the Endpoint resource. Format:
|
---|
| 251 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 252 | * @param array $optParams Optional parameters.
|
---|
| 253 | * @return GoogleCloudAiplatformV1Endpoint
|
---|
| 254 | * @throws \Google\Service\Exception
|
---|
| 255 | */
|
---|
| 256 | public function get($name, $optParams = [])
|
---|
| 257 | {
|
---|
| 258 | $params = ['name' => $name];
|
---|
| 259 | $params = array_merge($params, $optParams);
|
---|
| 260 | return $this->call('get', [$params], GoogleCloudAiplatformV1Endpoint::class);
|
---|
| 261 | }
|
---|
| 262 | /**
|
---|
| 263 | * Lists Endpoints in a Location. (endpoints.listProjectsLocationsEndpoints)
|
---|
| 264 | *
|
---|
| 265 | * @param string $parent Required. The resource name of the Location from which
|
---|
| 266 | * to list the Endpoints. Format: `projects/{project}/locations/{location}`
|
---|
| 267 | * @param array $optParams Optional parameters.
|
---|
| 268 | *
|
---|
| 269 | * @opt_param string filter Optional. An expression for filtering the results of
|
---|
| 270 | * the request. For field names both snake_case and camelCase are supported. *
|
---|
| 271 | * `endpoint` supports `=` and `!=`. `endpoint` represents the Endpoint ID, i.e.
|
---|
| 272 | * the last segment of the Endpoint's resource name. * `display_name` supports
|
---|
| 273 | * `=` and `!=`. * `labels` supports general map functions that is: *
|
---|
| 274 | * `labels.key=value` - key:value equality * `labels.key:*` or `labels:key` -
|
---|
| 275 | * key existence * A key including a space must be quoted. `labels."a key"`. *
|
---|
| 276 | * `base_model_name` only supports `=`. Some examples: * `endpoint=1` *
|
---|
| 277 | * `displayName="myDisplayName"` * `labels.myKey="myValue"` *
|
---|
| 278 | * `baseModelName="text-bison"`
|
---|
| 279 | * @opt_param string orderBy A comma-separated list of fields to order by,
|
---|
| 280 | * sorted in ascending order. Use "desc" after a field name for descending.
|
---|
| 281 | * Supported fields: * `display_name` * `create_time` * `update_time` Example:
|
---|
| 282 | * `display_name, create_time desc`.
|
---|
| 283 | * @opt_param int pageSize Optional. The standard list page size.
|
---|
| 284 | * @opt_param string pageToken Optional. The standard list page token. Typically
|
---|
| 285 | * obtained via ListEndpointsResponse.next_page_token of the previous
|
---|
| 286 | * EndpointService.ListEndpoints call.
|
---|
| 287 | * @opt_param string readMask Optional. Mask specifying which fields to read.
|
---|
| 288 | * @return GoogleCloudAiplatformV1ListEndpointsResponse
|
---|
| 289 | * @throws \Google\Service\Exception
|
---|
| 290 | */
|
---|
| 291 | public function listProjectsLocationsEndpoints($parent, $optParams = [])
|
---|
| 292 | {
|
---|
| 293 | $params = ['parent' => $parent];
|
---|
| 294 | $params = array_merge($params, $optParams);
|
---|
| 295 | return $this->call('list', [$params], GoogleCloudAiplatformV1ListEndpointsResponse::class);
|
---|
| 296 | }
|
---|
| 297 | /**
|
---|
| 298 | * Updates an existing deployed model. Updatable fields include
|
---|
| 299 | * `min_replica_count`, `max_replica_count`, `autoscaling_metric_specs`,
|
---|
| 300 | * `disable_container_logging` (v1 only), and `enable_container_logging`
|
---|
| 301 | * (v1beta1 only). (endpoints.mutateDeployedModel)
|
---|
| 302 | *
|
---|
| 303 | * @param string $endpoint Required. The name of the Endpoint resource into
|
---|
| 304 | * which to mutate a DeployedModel. Format:
|
---|
| 305 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 306 | * @param GoogleCloudAiplatformV1MutateDeployedModelRequest $postBody
|
---|
| 307 | * @param array $optParams Optional parameters.
|
---|
| 308 | * @return GoogleLongrunningOperation
|
---|
| 309 | * @throws \Google\Service\Exception
|
---|
| 310 | */
|
---|
| 311 | public function mutateDeployedModel($endpoint, GoogleCloudAiplatformV1MutateDeployedModelRequest $postBody, $optParams = [])
|
---|
| 312 | {
|
---|
| 313 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 314 | $params = array_merge($params, $optParams);
|
---|
| 315 | return $this->call('mutateDeployedModel', [$params], GoogleLongrunningOperation::class);
|
---|
| 316 | }
|
---|
| 317 | /**
|
---|
| 318 | * Updates an Endpoint. (endpoints.patch)
|
---|
| 319 | *
|
---|
| 320 | * @param string $name Output only. The resource name of the Endpoint.
|
---|
| 321 | * @param GoogleCloudAiplatformV1Endpoint $postBody
|
---|
| 322 | * @param array $optParams Optional parameters.
|
---|
| 323 | *
|
---|
| 324 | * @opt_param string updateMask Required. The update mask applies to the
|
---|
| 325 | * resource. See google.protobuf.FieldMask.
|
---|
| 326 | * @return GoogleCloudAiplatformV1Endpoint
|
---|
| 327 | * @throws \Google\Service\Exception
|
---|
| 328 | */
|
---|
| 329 | public function patch($name, GoogleCloudAiplatformV1Endpoint $postBody, $optParams = [])
|
---|
| 330 | {
|
---|
| 331 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 332 | $params = array_merge($params, $optParams);
|
---|
| 333 | return $this->call('patch', [$params], GoogleCloudAiplatformV1Endpoint::class);
|
---|
| 334 | }
|
---|
| 335 | /**
|
---|
| 336 | * Perform an online prediction. (endpoints.predict)
|
---|
| 337 | *
|
---|
| 338 | * @param string $endpoint Required. The name of the Endpoint requested to serve
|
---|
| 339 | * the prediction. Format:
|
---|
| 340 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 341 | * @param GoogleCloudAiplatformV1PredictRequest $postBody
|
---|
| 342 | * @param array $optParams Optional parameters.
|
---|
| 343 | * @return GoogleCloudAiplatformV1PredictResponse
|
---|
| 344 | * @throws \Google\Service\Exception
|
---|
| 345 | */
|
---|
| 346 | public function predict($endpoint, GoogleCloudAiplatformV1PredictRequest $postBody, $optParams = [])
|
---|
| 347 | {
|
---|
| 348 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 349 | $params = array_merge($params, $optParams);
|
---|
| 350 | return $this->call('predict', [$params], GoogleCloudAiplatformV1PredictResponse::class);
|
---|
| 351 | }
|
---|
| 352 | /**
|
---|
| 353 | * (endpoints.predictLongRunning)
|
---|
| 354 | *
|
---|
| 355 | * @param string $endpoint Required. The name of the Endpoint requested to serve
|
---|
| 356 | * the prediction. Format:
|
---|
| 357 | * `projects/{project}/locations/{location}/endpoints/{endpoint}` or `projects/{
|
---|
| 358 | * project}/locations/{location}/publishers/{publisher}/models/{model}`
|
---|
| 359 | * @param GoogleCloudAiplatformV1PredictLongRunningRequest $postBody
|
---|
| 360 | * @param array $optParams Optional parameters.
|
---|
| 361 | * @return GoogleLongrunningOperation
|
---|
| 362 | * @throws \Google\Service\Exception
|
---|
| 363 | */
|
---|
| 364 | public function predictLongRunning($endpoint, GoogleCloudAiplatformV1PredictLongRunningRequest $postBody, $optParams = [])
|
---|
| 365 | {
|
---|
| 366 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 367 | $params = array_merge($params, $optParams);
|
---|
| 368 | return $this->call('predictLongRunning', [$params], GoogleLongrunningOperation::class);
|
---|
| 369 | }
|
---|
| 370 | /**
|
---|
| 371 | * Perform an online prediction with an arbitrary HTTP payload. The response
|
---|
| 372 | * includes the following HTTP headers: * `X-Vertex-AI-Endpoint-Id`: ID of the
|
---|
| 373 | * Endpoint that served this prediction. * `X-Vertex-AI-Deployed-Model-Id`: ID
|
---|
| 374 | * of the Endpoint's DeployedModel that served this prediction.
|
---|
| 375 | * (endpoints.rawPredict)
|
---|
| 376 | *
|
---|
| 377 | * @param string $endpoint Required. The name of the Endpoint requested to serve
|
---|
| 378 | * the prediction. Format:
|
---|
| 379 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 380 | * @param GoogleCloudAiplatformV1RawPredictRequest $postBody
|
---|
| 381 | * @param array $optParams Optional parameters.
|
---|
| 382 | * @return GoogleApiHttpBody
|
---|
| 383 | * @throws \Google\Service\Exception
|
---|
| 384 | */
|
---|
| 385 | public function rawPredict($endpoint, GoogleCloudAiplatformV1RawPredictRequest $postBody, $optParams = [])
|
---|
| 386 | {
|
---|
| 387 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 388 | $params = array_merge($params, $optParams);
|
---|
| 389 | return $this->call('rawPredict', [$params], GoogleApiHttpBody::class);
|
---|
| 390 | }
|
---|
| 391 | /**
|
---|
| 392 | * Perform a server-side streaming online prediction request for Vertex LLM
|
---|
| 393 | * streaming. (endpoints.serverStreamingPredict)
|
---|
| 394 | *
|
---|
| 395 | * @param string $endpoint Required. The name of the Endpoint requested to serve
|
---|
| 396 | * the prediction. Format:
|
---|
| 397 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 398 | * @param GoogleCloudAiplatformV1StreamingPredictRequest $postBody
|
---|
| 399 | * @param array $optParams Optional parameters.
|
---|
| 400 | * @return GoogleCloudAiplatformV1StreamingPredictResponse
|
---|
| 401 | * @throws \Google\Service\Exception
|
---|
| 402 | */
|
---|
| 403 | public function serverStreamingPredict($endpoint, GoogleCloudAiplatformV1StreamingPredictRequest $postBody, $optParams = [])
|
---|
| 404 | {
|
---|
| 405 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 406 | $params = array_merge($params, $optParams);
|
---|
| 407 | return $this->call('serverStreamingPredict', [$params], GoogleCloudAiplatformV1StreamingPredictResponse::class);
|
---|
| 408 | }
|
---|
| 409 | /**
|
---|
| 410 | * Generate content with multimodal inputs with streaming support.
|
---|
| 411 | * (endpoints.streamGenerateContent)
|
---|
| 412 | *
|
---|
| 413 | * @param string $model Required. The fully qualified name of the publisher
|
---|
| 414 | * model or tuned model endpoint to use. Publisher model format:
|
---|
| 415 | * `projects/{project}/locations/{location}/publishers/models` Tuned model
|
---|
| 416 | * endpoint format:
|
---|
| 417 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 418 | * @param GoogleCloudAiplatformV1GenerateContentRequest $postBody
|
---|
| 419 | * @param array $optParams Optional parameters.
|
---|
| 420 | * @return GoogleCloudAiplatformV1GenerateContentResponse
|
---|
| 421 | * @throws \Google\Service\Exception
|
---|
| 422 | */
|
---|
| 423 | public function streamGenerateContent($model, GoogleCloudAiplatformV1GenerateContentRequest $postBody, $optParams = [])
|
---|
| 424 | {
|
---|
| 425 | $params = ['model' => $model, 'postBody' => $postBody];
|
---|
| 426 | $params = array_merge($params, $optParams);
|
---|
| 427 | return $this->call('streamGenerateContent', [$params], GoogleCloudAiplatformV1GenerateContentResponse::class);
|
---|
| 428 | }
|
---|
| 429 | /**
|
---|
| 430 | * Perform a streaming online prediction with an arbitrary HTTP payload.
|
---|
| 431 | * (endpoints.streamRawPredict)
|
---|
| 432 | *
|
---|
| 433 | * @param string $endpoint Required. The name of the Endpoint requested to serve
|
---|
| 434 | * the prediction. Format:
|
---|
| 435 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 436 | * @param GoogleCloudAiplatformV1StreamRawPredictRequest $postBody
|
---|
| 437 | * @param array $optParams Optional parameters.
|
---|
| 438 | * @return GoogleApiHttpBody
|
---|
| 439 | * @throws \Google\Service\Exception
|
---|
| 440 | */
|
---|
| 441 | public function streamRawPredict($endpoint, GoogleCloudAiplatformV1StreamRawPredictRequest $postBody, $optParams = [])
|
---|
| 442 | {
|
---|
| 443 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 444 | $params = array_merge($params, $optParams);
|
---|
| 445 | return $this->call('streamRawPredict', [$params], GoogleApiHttpBody::class);
|
---|
| 446 | }
|
---|
| 447 | /**
|
---|
| 448 | * Undeploys a Model from an Endpoint, removing a DeployedModel from it, and
|
---|
| 449 | * freeing all resources it's using. (endpoints.undeployModel)
|
---|
| 450 | *
|
---|
| 451 | * @param string $endpoint Required. The name of the Endpoint resource from
|
---|
| 452 | * which to undeploy a Model. Format:
|
---|
| 453 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 454 | * @param GoogleCloudAiplatformV1UndeployModelRequest $postBody
|
---|
| 455 | * @param array $optParams Optional parameters.
|
---|
| 456 | * @return GoogleLongrunningOperation
|
---|
| 457 | * @throws \Google\Service\Exception
|
---|
| 458 | */
|
---|
| 459 | public function undeployModel($endpoint, GoogleCloudAiplatformV1UndeployModelRequest $postBody, $optParams = [])
|
---|
| 460 | {
|
---|
| 461 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 462 | $params = array_merge($params, $optParams);
|
---|
| 463 | return $this->call('undeployModel', [$params], GoogleLongrunningOperation::class);
|
---|
| 464 | }
|
---|
| 465 | /**
|
---|
| 466 | * Updates an Endpoint with a long running operation. (endpoints.update)
|
---|
| 467 | *
|
---|
| 468 | * @param string $name Output only. The resource name of the Endpoint.
|
---|
| 469 | * @param GoogleCloudAiplatformV1UpdateEndpointLongRunningRequest $postBody
|
---|
| 470 | * @param array $optParams Optional parameters.
|
---|
| 471 | * @return GoogleLongrunningOperation
|
---|
| 472 | * @throws \Google\Service\Exception
|
---|
| 473 | */
|
---|
| 474 | public function update($name, GoogleCloudAiplatformV1UpdateEndpointLongRunningRequest $postBody, $optParams = [])
|
---|
| 475 | {
|
---|
| 476 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 477 | $params = array_merge($params, $optParams);
|
---|
| 478 | return $this->call('update', [$params], GoogleLongrunningOperation::class);
|
---|
| 479 | }
|
---|
| 480 | }
|
---|
| 481 |
|
---|
| 482 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 483 | class_alias(ProjectsLocationsEndpoints::class, 'Google_Service_Aiplatform_Resource_ProjectsLocationsEndpoints');
|
---|