Skip to content

Commit

Permalink
feat: add conversational search (#7734)
Browse files Browse the repository at this point in the history
feat: add tile navigation
docs: keep the API doc up-to-date with recent changes
PiperOrigin-RevId: 683821686
Source-Link: googleapis/googleapis@d01eb46
Source-Link: googleapis/googleapis-gen@1db3459
Copy-Tag: eyJwIjoiUmV0YWlsLy5Pd2xCb3QueWFtbCIsImgiOiIxZGIzNDU5ZjNkZmE5MzQ3YTU4MTFkNzJiMTJlMTcxNGRhNzVlZDkzIn0=
  • Loading branch information
gcf-owl-bot[bot] authored Oct 11, 2024
1 parent dd48f72 commit 7c553c2
Show file tree
Hide file tree
Showing 42 changed files with 4,623 additions and 24 deletions.
14 changes: 10 additions & 4 deletions Retail/metadata/V2/CompletionService.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions Retail/metadata/V2/GenerativeQuestion.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions Retail/metadata/V2/GenerativeQuestionService.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Retail/metadata/V2/SearchService.php
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START retail_v2_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Retail\V2\BatchUpdateGenerativeQuestionConfigsRequest;
use Google\Cloud\Retail\V2\BatchUpdateGenerativeQuestionConfigsResponse;
use Google\Cloud\Retail\V2\Client\GenerativeQuestionServiceClient;
use Google\Cloud\Retail\V2\GenerativeQuestionConfig;
use Google\Cloud\Retail\V2\UpdateGenerativeQuestionConfigRequest;

/**
* Allows management of multiple questions.
*
* @param string $requestsGenerativeQuestionConfigCatalog Resource name of the catalog.
* Format: projects/{project}/locations/{location}/catalogs/{catalog}
* @param string $requestsGenerativeQuestionConfigFacet The facet to which the question is associated.
*/
function batch_update_generative_question_configs_sample(
string $requestsGenerativeQuestionConfigCatalog,
string $requestsGenerativeQuestionConfigFacet
): void {
// Create a client.
$generativeQuestionServiceClient = new GenerativeQuestionServiceClient();

// Prepare the request message.
$requestsGenerativeQuestionConfig = (new GenerativeQuestionConfig())
->setCatalog($requestsGenerativeQuestionConfigCatalog)
->setFacet($requestsGenerativeQuestionConfigFacet);
$updateGenerativeQuestionConfigRequest = (new UpdateGenerativeQuestionConfigRequest())
->setGenerativeQuestionConfig($requestsGenerativeQuestionConfig);
$requests = [$updateGenerativeQuestionConfigRequest,];
$request = (new BatchUpdateGenerativeQuestionConfigsRequest())
->setRequests($requests);

// Call the API and handle any network failures.
try {
/** @var BatchUpdateGenerativeQuestionConfigsResponse $response */
$response = $generativeQuestionServiceClient->batchUpdateGenerativeQuestionConfigs($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$requestsGenerativeQuestionConfigCatalog = '[CATALOG]';
$requestsGenerativeQuestionConfigFacet = '[FACET]';

batch_update_generative_question_configs_sample(
$requestsGenerativeQuestionConfigCatalog,
$requestsGenerativeQuestionConfigFacet
);
}
// [END retail_v2_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START retail_v2_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Retail\V2\Client\GenerativeQuestionServiceClient;
use Google\Cloud\Retail\V2\GenerativeQuestionsFeatureConfig;
use Google\Cloud\Retail\V2\GetGenerativeQuestionsFeatureConfigRequest;

/**
* Manages overal generative question feature state -- enables toggling
* feature on and off.
*
* @param string $formattedCatalog Resource name of the parent catalog.
* Format: projects/{project}/locations/{location}/catalogs/{catalog}
* Please see {@see GenerativeQuestionServiceClient::catalogName()} for help formatting this field.
*/
function get_generative_questions_feature_config_sample(string $formattedCatalog): void
{
// Create a client.
$generativeQuestionServiceClient = new GenerativeQuestionServiceClient();

// Prepare the request message.
$request = (new GetGenerativeQuestionsFeatureConfigRequest())
->setCatalog($formattedCatalog);

// Call the API and handle any network failures.
try {
/** @var GenerativeQuestionsFeatureConfig $response */
$response = $generativeQuestionServiceClient->getGenerativeQuestionsFeatureConfig($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedCatalog = GenerativeQuestionServiceClient::catalogName(
'[PROJECT]',
'[LOCATION]',
'[CATALOG]'
);

get_generative_questions_feature_config_sample($formattedCatalog);
}
// [END retail_v2_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START retail_v2_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Retail\V2\Client\GenerativeQuestionServiceClient;
use Google\Cloud\Retail\V2\ListGenerativeQuestionConfigsRequest;
use Google\Cloud\Retail\V2\ListGenerativeQuestionConfigsResponse;

/**
* Returns all questions for a given catalog.
*
* @param string $formattedParent Resource name of the parent catalog.
* Format: projects/{project}/locations/{location}/catalogs/{catalog}
* Please see {@see GenerativeQuestionServiceClient::catalogName()} for help formatting this field.
*/
function list_generative_question_configs_sample(string $formattedParent): void
{
// Create a client.
$generativeQuestionServiceClient = new GenerativeQuestionServiceClient();

// Prepare the request message.
$request = (new ListGenerativeQuestionConfigsRequest())
->setParent($formattedParent);

// Call the API and handle any network failures.
try {
/** @var ListGenerativeQuestionConfigsResponse $response */
$response = $generativeQuestionServiceClient->listGenerativeQuestionConfigs($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}

/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = GenerativeQuestionServiceClient::catalogName(
'[PROJECT]',
'[LOCATION]',
'[CATALOG]'
);

list_generative_question_configs_sample($formattedParent);
}
// [END retail_v2_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_sync]
Loading

0 comments on commit 7c553c2

Please sign in to comment.