Skip to content

Commit 12c3c41

Browse files
feat: [DeveloperKnowledge] add AnswerQuery RPC to v1
* feat: add AnswerQuery RPC to v1 docs: Update `DocumentView.DOCUMENT_VIEW_BASIC` comment to include `content_length_bytes` docs: Update `SearchDocumentChunksRequest.page_size` comment to reflect new maximum limit of 100 and coercion behavior docs: Update `SearchDocumentChunksRequest.filter` comment to document `content_length_bytes` filtering docs: Fix formatting in `BatchGetDocumentsRequest.names` comment The AnswerQuery RPC is now generally available in the v1 API. This method allows clients to submit queries and receive answers grounded in the Developer Knowledge corpus. PiperOrigin-RevId: 949549664 Source-Link: googleapis/googleapis@6145fa8 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d83f7ceea5d28d83d314e1454f89550c1902b0e6 Copy-Tag: eyJwIjoiRGV2ZWxvcGVyS25vd2xlZGdlLy5Pd2xCb3QueWFtbCIsImgiOiJkODNmN2NlZWE1ZDI4ZDgzZDMxNGUxNDU0Zjg5NTUwYzE5MDJiMGU2In0= * 🦉 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 cf0a4f8 commit 12c3c41

19 files changed

Lines changed: 933 additions & 25 deletions

DeveloperKnowledge/metadata/V1/Developerknowledge.php

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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 developerknowledge_v1_generated_DeveloperKnowledge_AnswerQuery_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Developers\DeveloperKnowledge\V1\AnswerQueryRequest;
28+
use Google\Developers\DeveloperKnowledge\V1\AnswerQueryResponse;
29+
use Google\Developers\DeveloperKnowledge\V1\Client\DeveloperKnowledgeClient;
30+
31+
/**
32+
* Answers a query using grounded generation.
33+
*
34+
* @param string $query The query to answer.
35+
*/
36+
function answer_query_sample(string $query): void
37+
{
38+
// Create a client.
39+
$developerKnowledgeClient = new DeveloperKnowledgeClient();
40+
41+
// Prepare the request message.
42+
$request = (new AnswerQueryRequest())
43+
->setQuery($query);
44+
45+
// Call the API and handle any network failures.
46+
try {
47+
/** @var AnswerQueryResponse $response */
48+
$response = $developerKnowledgeClient->answerQuery($request);
49+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
50+
} catch (ApiException $ex) {
51+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
52+
}
53+
}
54+
55+
/**
56+
* Helper to execute the sample.
57+
*
58+
* This sample has been automatically generated and should be regarded as a code
59+
* template only. It will require modifications to work:
60+
* - It may require correct/in-range values for request initialization.
61+
* - It may require specifying regional endpoints when creating the service client,
62+
* please see the apiEndpoint client configuration option for more details.
63+
*/
64+
function callSample(): void
65+
{
66+
$query = '[QUERY]';
67+
68+
answer_query_sample($query);
69+
}
70+
// [END developerknowledge_v1_generated_DeveloperKnowledge_AnswerQuery_sync]

DeveloperKnowledge/samples/V1/DeveloperKnowledgeClient/batch_get_documents.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
*
3838
* Format: `documents/{uri_without_scheme}`
3939
* Example: `documents/docs.cloud.google.com/storage/docs/creating-buckets`
40+
*
4041
* Please see {@see DeveloperKnowledgeClient::documentName()} for help formatting this field.
4142
*/
4243
function batch_get_documents_sample(string $formattedNamesElement): void

DeveloperKnowledge/src/V1/Answer.php

Lines changed: 135 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)