Skip to content

Commit 4f8b308

Browse files
feat: [AiPlatform] Add EmbedContent method v1 (#8688)
* feat: Add EmbedContent method v1 PiperOrigin-RevId: 823219007 Source-Link: googleapis/googleapis@0830bd9 Source-Link: googleapis/googleapis-gen@c7c90cd Copy-Tag: eyJwIjoiQWlQbGF0Zm9ybS8uT3dsQm90LnlhbWwiLCJoIjoiYzdjOTBjZGZjZWI3OGRmNzMwNDI3MmNkYmM4NjQwOGUyZjRhNTYwNyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 8fab9a5 commit 4f8b308

15 files changed

Lines changed: 1356 additions & 0 deletions
1.18 KB
Binary file not shown.
1.73 KB
Binary file not shown.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
/*
3+
* Copyright 2025 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+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START aiplatform_v1_generated_PredictionService_EmbedContent_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\AIPlatform\V1\Client\PredictionServiceClient;
28+
use Google\Cloud\AIPlatform\V1\EmbedContentRequest;
29+
use Google\Cloud\AIPlatform\V1\EmbedContentResponse;
30+
31+
/**
32+
* Embed content with multimodal inputs.
33+
*
34+
* This sample has been automatically generated and should be regarded as a code
35+
* template only. It will require modifications to work:
36+
* - It may require correct/in-range values for request initialization.
37+
* - It may require specifying regional endpoints when creating the service client,
38+
* please see the apiEndpoint client configuration option for more details.
39+
*/
40+
function embed_content_sample(): void
41+
{
42+
// Create a client.
43+
$predictionServiceClient = new PredictionServiceClient();
44+
45+
// Prepare the request message.
46+
$request = new EmbedContentRequest();
47+
48+
// Call the API and handle any network failures.
49+
try {
50+
/** @var EmbedContentResponse $response */
51+
$response = $predictionServiceClient->embedContent($request);
52+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
53+
} catch (ApiException $ex) {
54+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
55+
}
56+
}
57+
// [END aiplatform_v1_generated_PredictionService_EmbedContent_sync]

AiPlatform/src/V1/Client/PredictionServiceClient.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
use Google\Cloud\AIPlatform\V1\DirectPredictResponse;
4343
use Google\Cloud\AIPlatform\V1\DirectRawPredictRequest;
4444
use Google\Cloud\AIPlatform\V1\DirectRawPredictResponse;
45+
use Google\Cloud\AIPlatform\V1\EmbedContentRequest;
46+
use Google\Cloud\AIPlatform\V1\EmbedContentResponse;
4547
use Google\Cloud\AIPlatform\V1\ExplainRequest;
4648
use Google\Cloud\AIPlatform\V1\ExplainResponse;
4749
use Google\Cloud\AIPlatform\V1\GenerateContentRequest;
@@ -76,6 +78,7 @@
7678
*
7779
* @method PromiseInterface<DirectPredictResponse> directPredictAsync(DirectPredictRequest $request, array $optionalArgs = [])
7880
* @method PromiseInterface<DirectRawPredictResponse> directRawPredictAsync(DirectRawPredictRequest $request, array $optionalArgs = [])
81+
* @method PromiseInterface<EmbedContentResponse> embedContentAsync(EmbedContentRequest $request, array $optionalArgs = [])
7982
* @method PromiseInterface<ExplainResponse> explainAsync(ExplainRequest $request, array $optionalArgs = [])
8083
* @method PromiseInterface<GenerateContentResponse> generateContentAsync(GenerateContentRequest $request, array $optionalArgs = [])
8184
* @method PromiseInterface<PredictResponse> predictAsync(PredictRequest $request, array $optionalArgs = [])
@@ -425,6 +428,32 @@ public function directRawPredict(
425428
return $this->startApiCall('DirectRawPredict', $request, $callOptions)->wait();
426429
}
427430

431+
/**
432+
* Embed content with multimodal inputs.
433+
*
434+
* The async variant is {@see PredictionServiceClient::embedContentAsync()} .
435+
*
436+
* @example samples/V1/PredictionServiceClient/embed_content.php
437+
*
438+
* @param EmbedContentRequest $request A request to house fields associated with the call.
439+
* @param array $callOptions {
440+
* Optional.
441+
*
442+
* @type RetrySettings|array $retrySettings
443+
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
444+
* associative array of retry settings parameters. See the documentation on
445+
* {@see RetrySettings} for example usage.
446+
* }
447+
*
448+
* @return EmbedContentResponse
449+
*
450+
* @throws ApiException Thrown if the API call fails.
451+
*/
452+
public function embedContent(EmbedContentRequest $request, array $callOptions = []): EmbedContentResponse
453+
{
454+
return $this->startApiCall('EmbedContent', $request, $callOptions)->wait();
455+
}
456+
428457
/**
429458
* Perform an online explanation.
430459
*

0 commit comments

Comments
 (0)