Skip to content

Commit a1565d2

Browse files
feat: [AiPlatform] Add image_spec to Reasoning Engine public protos (#8944)
* feat: Add image_spec to Reasoning Engine public protos PiperOrigin-RevId: 874847840 Source-Link: googleapis/googleapis@1a699d6 Source-Link: googleapis/googleapis-gen@81f1d7d Copy-Tag: eyJwIjoiQWlQbGF0Zm9ybS8uT3dsQm90LnlhbWwiLCJoIjoiODFmMWQ3ZGY2ZmJhYzZhZmM0OGFhOTcyZTZiM2VmOWYxMDViZmQ1ZCJ9 feat: Add transcription fields to Session Service feat: Add v1 API version for Session Service docs: A comment for field `expire_time` in message `.google.cloud.aiplatform.v1beta1.Session` is changed docs: A comment for field `ttl` in message `.google.cloud.aiplatform.v1beta1.Session` is changed docs: A comment for field `filter` in message `.google.cloud.aiplatform.v1beta1.ListSessionsRequest` is changed PiperOrigin-RevId: 874707222 Source-Link: googleapis/googleapis@1499898 Source-Link: googleapis/googleapis-gen@95784c6 Copy-Tag: eyJwIjoiQWlQbGF0Zm9ybS8uT3dsQm90LnlhbWwiLCJoIjoiOTU3ODRjNjdlN2VmODRkNTIzOTI3NzYyNGQ5MzQzMjU2MDgxMjJiOSJ9 * 🦉 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 d166056 commit a1565d2

72 files changed

Lines changed: 10086 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
279 Bytes
Binary file not shown.

AiPlatform/metadata/V1/Session.php

3.33 KB
Binary file not shown.

AiPlatform/metadata/V1/SessionService.php

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?php
2+
/*
3+
* Copyright 2026 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_SessionService_AppendEvent_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\AIPlatform\V1\AppendEventRequest;
28+
use Google\Cloud\AIPlatform\V1\AppendEventResponse;
29+
use Google\Cloud\AIPlatform\V1\Client\SessionServiceClient;
30+
use Google\Cloud\AIPlatform\V1\SessionEvent;
31+
use Google\Protobuf\Timestamp;
32+
33+
/**
34+
* Appends an event to a given session.
35+
*
36+
* @param string $formattedName The resource name of the session to append event to.
37+
* Format:
38+
* `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}`
39+
* Please see {@see SessionServiceClient::sessionName()} for help formatting this field.
40+
* @param string $eventAuthor The name of the agent that sent the event, or user.
41+
* @param string $eventInvocationId The invocation id of the event, multiple events can have the same
42+
* invocation id.
43+
*/
44+
function append_event_sample(
45+
string $formattedName,
46+
string $eventAuthor,
47+
string $eventInvocationId
48+
): void {
49+
// Create a client.
50+
$sessionServiceClient = new SessionServiceClient();
51+
52+
// Prepare the request message.
53+
$eventTimestamp = new Timestamp();
54+
$event = (new SessionEvent())
55+
->setAuthor($eventAuthor)
56+
->setInvocationId($eventInvocationId)
57+
->setTimestamp($eventTimestamp);
58+
$request = (new AppendEventRequest())
59+
->setName($formattedName)
60+
->setEvent($event);
61+
62+
// Call the API and handle any network failures.
63+
try {
64+
/** @var AppendEventResponse $response */
65+
$response = $sessionServiceClient->appendEvent($request);
66+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
67+
} catch (ApiException $ex) {
68+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
69+
}
70+
}
71+
72+
/**
73+
* Helper to execute the sample.
74+
*
75+
* This sample has been automatically generated and should be regarded as a code
76+
* template only. It will require modifications to work:
77+
* - It may require correct/in-range values for request initialization.
78+
* - It may require specifying regional endpoints when creating the service client,
79+
* please see the apiEndpoint client configuration option for more details.
80+
*/
81+
function callSample(): void
82+
{
83+
$formattedName = SessionServiceClient::sessionName(
84+
'[PROJECT]',
85+
'[LOCATION]',
86+
'[REASONING_ENGINE]',
87+
'[SESSION]'
88+
);
89+
$eventAuthor = '[AUTHOR]';
90+
$eventInvocationId = '[INVOCATION_ID]';
91+
92+
append_event_sample($formattedName, $eventAuthor, $eventInvocationId);
93+
}
94+
// [END aiplatform_v1_generated_SessionService_AppendEvent_sync]
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?php
2+
/*
3+
* Copyright 2026 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_SessionService_CreateSession_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\AIPlatform\V1\Client\SessionServiceClient;
29+
use Google\Cloud\AIPlatform\V1\CreateSessionRequest;
30+
use Google\Cloud\AIPlatform\V1\Session;
31+
use Google\Rpc\Status;
32+
33+
/**
34+
* Creates a new [Session][google.cloud.aiplatform.v1.Session].
35+
*
36+
* @param string $formattedParent The resource name of the location to create the session in.
37+
* Format:
38+
* `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
39+
* Please see {@see SessionServiceClient::reasoningEngineName()} for help formatting this field.
40+
* @param string $sessionUserId Immutable. String id provided by the user
41+
*/
42+
function create_session_sample(string $formattedParent, string $sessionUserId): void
43+
{
44+
// Create a client.
45+
$sessionServiceClient = new SessionServiceClient();
46+
47+
// Prepare the request message.
48+
$session = (new Session())
49+
->setUserId($sessionUserId);
50+
$request = (new CreateSessionRequest())
51+
->setParent($formattedParent)
52+
->setSession($session);
53+
54+
// Call the API and handle any network failures.
55+
try {
56+
/** @var OperationResponse $response */
57+
$response = $sessionServiceClient->createSession($request);
58+
$response->pollUntilComplete();
59+
60+
if ($response->operationSucceeded()) {
61+
/** @var Session $result */
62+
$result = $response->getResult();
63+
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
64+
} else {
65+
/** @var Status $error */
66+
$error = $response->getError();
67+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
68+
}
69+
} catch (ApiException $ex) {
70+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
71+
}
72+
}
73+
74+
/**
75+
* Helper to execute the sample.
76+
*
77+
* This sample has been automatically generated and should be regarded as a code
78+
* template only. It will require modifications to work:
79+
* - It may require correct/in-range values for request initialization.
80+
* - It may require specifying regional endpoints when creating the service client,
81+
* please see the apiEndpoint client configuration option for more details.
82+
*/
83+
function callSample(): void
84+
{
85+
$formattedParent = SessionServiceClient::reasoningEngineName(
86+
'[PROJECT]',
87+
'[LOCATION]',
88+
'[REASONING_ENGINE]'
89+
);
90+
$sessionUserId = '[USER_ID]';
91+
92+
create_session_sample($formattedParent, $sessionUserId);
93+
}
94+
// [END aiplatform_v1_generated_SessionService_CreateSession_sync]
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
/*
3+
* Copyright 2026 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_SessionService_DeleteSession_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\AIPlatform\V1\Client\SessionServiceClient;
29+
use Google\Cloud\AIPlatform\V1\DeleteSessionRequest;
30+
use Google\Rpc\Status;
31+
32+
/**
33+
* Deletes details of the specific
34+
* [Session][google.cloud.aiplatform.v1.Session].
35+
*
36+
* @param string $formattedName The resource name of the session.
37+
* Format:
38+
* `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}`
39+
* Please see {@see SessionServiceClient::sessionName()} for help formatting this field.
40+
*/
41+
function delete_session_sample(string $formattedName): void
42+
{
43+
// Create a client.
44+
$sessionServiceClient = new SessionServiceClient();
45+
46+
// Prepare the request message.
47+
$request = (new DeleteSessionRequest())
48+
->setName($formattedName);
49+
50+
// Call the API and handle any network failures.
51+
try {
52+
/** @var OperationResponse $response */
53+
$response = $sessionServiceClient->deleteSession($request);
54+
$response->pollUntilComplete();
55+
56+
if ($response->operationSucceeded()) {
57+
printf('Operation completed successfully.' . PHP_EOL);
58+
} else {
59+
/** @var Status $error */
60+
$error = $response->getError();
61+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
62+
}
63+
} catch (ApiException $ex) {
64+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
65+
}
66+
}
67+
68+
/**
69+
* Helper to execute the sample.
70+
*
71+
* This sample has been automatically generated and should be regarded as a code
72+
* template only. It will require modifications to work:
73+
* - It may require correct/in-range values for request initialization.
74+
* - It may require specifying regional endpoints when creating the service client,
75+
* please see the apiEndpoint client configuration option for more details.
76+
*/
77+
function callSample(): void
78+
{
79+
$formattedName = SessionServiceClient::sessionName(
80+
'[PROJECT]',
81+
'[LOCATION]',
82+
'[REASONING_ENGINE]',
83+
'[SESSION]'
84+
);
85+
86+
delete_session_sample($formattedName);
87+
}
88+
// [END aiplatform_v1_generated_SessionService_DeleteSession_sync]

0 commit comments

Comments
 (0)