Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit36f9aa0

Browse files
feat: [GeminiDataAnalytics] add a QueryData API for NL2SQL conversion (#8796)
* feat: add a QueryData API for NL2SQL conversionfeat: A new message `AgentContextReference` is addedfeat: A new method `QueryData` is added to service `DataChatService`feat: A new message `QueryDataRequest` is addedfeat: A new message `GenerationOptions` is addedfeat: A new message `QueryDataContext` is addedfeat: A new message `QueryDataResponse` is addedfeat: A new message `ExecutedQueryResult` is addedfeat: A new field `alloydb` is added to message `.google.cloud.geminidataanalytics.v1beta.DatasourceReferences`feat: A new field `spanner_reference` is added to message `.google.cloud.geminidataanalytics.v1beta.DatasourceReferences`feat: A new field `cloud_sql_reference` is added to message `.google.cloud.geminidataanalytics.v1beta.DatasourceReferences`feat: A new message `AlloyDbReference` is addedfeat: A new message `AlloyDbDatabaseReference` is addedfeat: A new message `SpannerReference` is addedfeat: A new message `SpannerDatabaseReference` is addedfeat: A new message `CloudSqlReference` is addedfeat: A new message `CloudSqlDatabaseReference` is addedfeat: A new field `alloy_db_reference` is added to message `.google.cloud.geminidataanalytics.v1beta.Datasource`feat: A new field `spanner_reference` is added to message `.google.cloud.geminidataanalytics.v1beta.Datasource`feat: A new field `cloud_sql_reference` is added to message `.google.cloud.geminidataanalytics.v1beta.Datasource`PiperOrigin-RevId: 842905100Source-Link:googleapis/googleapis@b32495aSource-Link:googleapis/googleapis-gen@f67a35aCopy-Tag: eyJwIjoiR2VtaW5pRGF0YUFuYWx5dGljcy8uT3dsQm90LnlhbWwiLCJoIjoiZjY3YTM1YTZkNGQyOTUyNWQ2ZDU5MDAzMDdhYTcxOWNmNTEzMzJiMyJ9* 🦉 Updates from OwlBot post-processorSeehttps://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 parentfd5c3c9 commit36f9aa0

File tree

29 files changed

+2932
-0
lines changed

29 files changed

+2932
-0
lines changed

‎GeminiDataAnalytics/metadata/V1Beta/AgentContext.php‎

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
1.39 KB
Binary file not shown.
2.09 KB
Binary file not shown.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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 geminidataanalytics_v1beta_generated_DataChatService_QueryData_sync]
26+
useGoogle\ApiCore\ApiException;
27+
useGoogle\Cloud\GeminiDataAnalytics\V1beta\Client\DataChatServiceClient;
28+
useGoogle\Cloud\GeminiDataAnalytics\V1beta\DatasourceReferences;
29+
useGoogle\Cloud\GeminiDataAnalytics\V1beta\QueryDataContext;
30+
useGoogle\Cloud\GeminiDataAnalytics\V1beta\QueryDataRequest;
31+
useGoogle\Cloud\GeminiDataAnalytics\V1beta\QueryDataResponse;
32+
33+
/**
34+
* Queries data from a natural language user query.
35+
*
36+
* @param string $formattedParent The parent resource to generate the query for.
37+
* Format: projects/{project}/locations/{location}
38+
* Please see {@see DataChatServiceClient::locationName()} for help formatting this field.
39+
* @param string $prompt The natural language query for which to generate query.
40+
* Example: "What are the top 5 best selling products this month?"
41+
*/
42+
functionquery_data_sample(string$formattedParent,string$prompt):void
43+
{
44+
// Create a client.
45+
$dataChatServiceClient =newDataChatServiceClient();
46+
47+
// Prepare the request message.
48+
$contextDatasourceReferences =newDatasourceReferences();
49+
$context = (newQueryDataContext())
50+
->setDatasourceReferences($contextDatasourceReferences);
51+
$request = (newQueryDataRequest())
52+
->setParent($formattedParent)
53+
->setPrompt($prompt)
54+
->setContext($context);
55+
56+
// Call the API and handle any network failures.
57+
try {
58+
/** @var QueryDataResponse $response */
59+
$response =$dataChatServiceClient->queryData($request);
60+
printf('Response data: %s' .PHP_EOL,$response->serializeToJsonString());
61+
}catch (ApiException$ex) {
62+
printf('Call failed with message: %s' .PHP_EOL,$ex->getMessage());
63+
}
64+
}
65+
66+
/**
67+
* Helper to execute the sample.
68+
*
69+
* This sample has been automatically generated and should be regarded as a code
70+
* template only. It will require modifications to work:
71+
* - It may require correct/in-range values for request initialization.
72+
* - It may require specifying regional endpoints when creating the service client,
73+
* please see the apiEndpoint client configuration option for more details.
74+
*/
75+
functioncallSample():void
76+
{
77+
$formattedParent = DataChatServiceClient::locationName('[PROJECT]','[LOCATION]');
78+
$prompt ='[PROMPT]';
79+
80+
query_data_sample($formattedParent,$prompt);
81+
}
82+
// [END geminidataanalytics_v1beta_generated_DataChatService_QueryData_sync]

‎GeminiDataAnalytics/src/V1beta/AgentContextReference.php‎

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp