diff --git a/google/cloud/dataqna/v1alpha/BUILD.bazel b/google/cloud/dataqna/v1alpha/BUILD.bazel
new file mode 100644
index 00000000..9b911534
--- /dev/null
+++ b/google/cloud/dataqna/v1alpha/BUILD.bazel
@@ -0,0 +1,343 @@
+# This file was automatically generated by BuildFileGenerator
+# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+
+# Most of the manual changes to this file will be overwritten.
+# It's **only** allowed to change the following rule attribute values:
+# - names of *_gapic_assembly_* rules
+# - certain parameters of *_gapic_library rules, including but not limited to:
+# * extra_protoc_parameters
+# * extra_protoc_file_parameters
+# The complete list of preserved parameters can be found in the source code.
+
+# This is an API workspace, having public visibility by default makes perfect sense.
+package(default_visibility = ["//visibility:public"])
+
+##############################################################################
+# Common
+##############################################################################
+load("@rules_proto//proto:defs.bzl", "proto_library")
+load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+
+proto_library(
+ name = "dataqna_proto",
+ srcs = [
+ "annotated_string.proto",
+ "auto_suggestion_service.proto",
+ "question.proto",
+ "question_service.proto",
+ "user_feedback.proto",
+ ],
+ deps = [
+ "//google/api:annotations_proto",
+ "//google/api:client_proto",
+ "//google/api:field_behavior_proto",
+ "//google/api:resource_proto",
+ "//google/rpc:status_proto",
+ "@com_google_protobuf//:any_proto",
+ "@com_google_protobuf//:field_mask_proto",
+ "@com_google_protobuf//:timestamp_proto",
+ ],
+)
+
+proto_library_with_info(
+ name = "dataqna_proto_with_info",
+ deps = [
+ ":dataqna_proto",
+ "//google/cloud:common_resources_proto",
+ ],
+)
+
+##############################################################################
+# Java
+##############################################################################
+load(
+ "@com_google_googleapis_imports//:imports.bzl",
+ "java_gapic_assembly_gradle_pkg",
+ "java_gapic_library",
+ "java_gapic_test",
+ "java_grpc_library",
+ "java_proto_library",
+)
+
+java_proto_library(
+ name = "dataqna_java_proto",
+ deps = [":dataqna_proto"],
+)
+
+java_grpc_library(
+ name = "dataqna_java_grpc",
+ srcs = [":dataqna_proto"],
+ deps = [":dataqna_java_proto"],
+)
+
+java_gapic_library(
+ name = "dataqna_java_gapic",
+ src = ":dataqna_proto_with_info",
+ gapic_yaml = "gapic.yaml",
+ grpc_service_config = "dataqna_grpc_service_config.json",
+ package = "google.cloud.dataqna.v1alpha",
+ service_yaml = "dataqna_v1alpha.yaml",
+ test_deps = [
+ ":dataqna_java_grpc",
+ ],
+ deps = [
+ ":dataqna_java_proto",
+ ],
+)
+
+java_gapic_test(
+ name = "dataqna_java_gapic_test_suite",
+ test_classes = [
+ "com.google.cloud.dataqna.v1alpha.AutoSuggestionServiceClientTest",
+ "com.google.cloud.dataqna.v1alpha.QuestionServiceClientTest",
+ ],
+ runtime_deps = [":dataqna_java_gapic_test"],
+)
+
+# Open Source Packages
+java_gapic_assembly_gradle_pkg(
+ name = "google-cloud-dataqna-v1alpha-java",
+ deps = [
+ ":dataqna_java_gapic",
+ ":dataqna_java_grpc",
+ ":dataqna_java_proto",
+ ":dataqna_proto",
+ ],
+)
+
+##############################################################################
+# Go
+##############################################################################
+load(
+ "@com_google_googleapis_imports//:imports.bzl",
+ "go_gapic_assembly_pkg",
+ "go_gapic_library",
+ "go_proto_library",
+ "go_test",
+)
+
+go_proto_library(
+ name = "dataqna_go_proto",
+ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+ importpath = "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha",
+ protos = [":dataqna_proto"],
+ deps = [
+ "//google/api:annotations_go_proto",
+ "//google/rpc:status_go_proto",
+ ],
+)
+
+go_gapic_library(
+ name = "dataqna_go_gapic",
+ srcs = [":dataqna_proto_with_info"],
+ grpc_service_config = "dataqna_grpc_service_config.json",
+ importpath = "cloud.google.com/go/dataqna/apiv1alpha;dataqna",
+ service_yaml = "dataqna_v1alpha.yaml",
+ deps = [
+ ":dataqna_go_proto",
+ ],
+)
+
+go_test(
+ name = "dataqna_go_gapic_test",
+ srcs = [":dataqna_go_gapic_srcjar_test"],
+ embed = [":dataqna_go_gapic"],
+ importpath = "cloud.google.com/go/dataqna/apiv1alpha",
+)
+
+# Open Source Packages
+go_gapic_assembly_pkg(
+ name = "gapi-cloud-dataqna-v1alpha-go",
+ deps = [
+ ":dataqna_go_gapic",
+ ":dataqna_go_gapic_srcjar-test.srcjar",
+ ":dataqna_go_proto",
+ ],
+)
+
+##############################################################################
+# Python
+##############################################################################
+load(
+ "@com_google_googleapis_imports//:imports.bzl",
+ py_gapic_assembly_pkg = "py_gapic_assembly_pkg2",
+ py_gapic_library = "py_gapic_library2",
+)
+
+py_gapic_library(
+ name = "dataqna_py_gapic",
+ srcs = [":dataqna_proto"],
+ grpc_service_config = "dataqna_grpc_service_config.json",
+)
+
+py_gapic_assembly_pkg(
+ name = "dataqna-v1alpha-py",
+ deps = [
+ ":dataqna_py_gapic",
+ ],
+)
+
+
+##############################################################################
+# PHP
+##############################################################################
+load(
+ "@com_google_googleapis_imports//:imports.bzl",
+ "php_gapic_assembly_pkg",
+ "php_gapic_library",
+ "php_grpc_library",
+ "php_proto_library",
+)
+
+php_proto_library(
+ name = "dataqna_php_proto",
+ deps = [":dataqna_proto"],
+)
+
+php_grpc_library(
+ name = "dataqna_php_grpc",
+ srcs = [":dataqna_proto"],
+ deps = [":dataqna_php_proto"],
+)
+
+php_gapic_library(
+ name = "dataqna_php_gapic",
+ src = ":dataqna_proto_with_info",
+ gapic_yaml = "gapic.yaml",
+ grpc_service_config = "dataqna_grpc_service_config.json",
+ package = "google.cloud.dataqna.v1alpha",
+ service_yaml = "dataqna_v1alpha.yaml",
+ deps = [
+ ":dataqna_php_grpc",
+ ":dataqna_php_proto",
+ ],
+)
+
+# Open Source Packages
+php_gapic_assembly_pkg(
+ name = "google-cloud-dataqna-v1alpha-php",
+ deps = [
+ ":dataqna_php_gapic",
+ ":dataqna_php_grpc",
+ ":dataqna_php_proto",
+ ],
+)
+
+##############################################################################
+# Node.js
+##############################################################################
+load(
+ "@com_google_googleapis_imports//:imports.bzl",
+ "nodejs_gapic_assembly_pkg",
+ "nodejs_gapic_library",
+)
+
+nodejs_gapic_library(
+ name = "dataqna_nodejs_gapic",
+ src = ":dataqna_proto_with_info",
+ grpc_service_config = "dataqna_grpc_service_config.json",
+ package = "google.cloud.dataqna.v1alpha",
+ service_yaml = "dataqna_v1alpha.yaml",
+ deps = [],
+)
+
+nodejs_gapic_assembly_pkg(
+ name = "dataqna-v1alpha-nodejs",
+ deps = [
+ ":dataqna_nodejs_gapic",
+ ":dataqna_proto",
+ ],
+)
+
+##############################################################################
+# Ruby
+##############################################################################
+load(
+ "@com_google_googleapis_imports//:imports.bzl",
+ "ruby_gapic_assembly_pkg",
+ "ruby_gapic_library",
+ "ruby_grpc_library",
+ "ruby_proto_library",
+)
+
+ruby_proto_library(
+ name = "dataqna_ruby_proto",
+ deps = [":dataqna_proto"],
+)
+
+ruby_grpc_library(
+ name = "dataqna_ruby_grpc",
+ srcs = [":dataqna_proto"],
+ deps = [":dataqna_ruby_proto"],
+)
+
+ruby_gapic_library(
+ name = "dataqna_ruby_gapic",
+ src = ":dataqna_proto_with_info",
+ gapic_yaml = "gapic.yaml",
+ grpc_service_config = "dataqna_grpc_service_config.json",
+ package = "google.cloud.dataqna.v1alpha",
+ service_yaml = "dataqna_v1alpha.yaml",
+ deps = [
+ ":dataqna_ruby_grpc",
+ ":dataqna_ruby_proto",
+ ],
+)
+
+# Open Source Packages
+ruby_gapic_assembly_pkg(
+ name = "google-cloud-dataqna-v1alpha-ruby",
+ deps = [
+ ":dataqna_ruby_gapic",
+ ":dataqna_ruby_grpc",
+ ":dataqna_ruby_proto",
+ ],
+)
+
+##############################################################################
+# C#
+##############################################################################
+load(
+ "@com_google_googleapis_imports//:imports.bzl",
+ "csharp_gapic_assembly_pkg",
+ "csharp_gapic_library",
+ "csharp_grpc_library",
+ "csharp_proto_library",
+)
+
+csharp_proto_library(
+ name = "dataqna_csharp_proto",
+ deps = [":dataqna_proto"],
+)
+
+csharp_grpc_library(
+ name = "dataqna_csharp_grpc",
+ srcs = [":dataqna_proto"],
+ deps = [":dataqna_csharp_proto"],
+)
+
+csharp_gapic_library(
+ name = "dataqna_csharp_gapic",
+ srcs = [":dataqna_proto_with_info"],
+ grpc_service_config = "dataqna_grpc_service_config.json",
+ common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+ deps = [
+ ":dataqna_csharp_grpc",
+ ":dataqna_csharp_proto",
+ ],
+)
+
+# Open Source Packages
+csharp_gapic_assembly_pkg(
+ name = "google-cloud-dataqna-v1alpha-csharp",
+ deps = [
+ ":dataqna_csharp_gapic",
+ ":dataqna_csharp_grpc",
+ ":dataqna_csharp_proto",
+ ],
+)
+
+##############################################################################
+# C++
+##############################################################################
+# Put your C++ rules here
diff --git a/google/cloud/dataqna/v1alpha/annotated_string.proto b/google/cloud/dataqna/v1alpha/annotated_string.proto
new file mode 100644
index 00000000..d1eb596d
--- /dev/null
+++ b/google/cloud/dataqna/v1alpha/annotated_string.proto
@@ -0,0 +1,103 @@
+// Copyright 2020 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
+//
+// http://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.
+
+syntax = "proto3";
+
+package google.cloud.dataqna.v1alpha;
+
+option csharp_namespace = "Google.Cloud.DataQnA.V1Alpha";
+option go_package = "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha;dataqna";
+option java_multiple_files = true;
+option java_outer_classname = "AnnotatedStringProto";
+option java_package = "com.google.cloud.dataqna.v1alpha";
+option php_namespace = "Google\\Cloud\\DataQnA\\V1alpha";
+option ruby_package = "Google::Cloud::DataQnA::V1alpha";
+
+// Describes string annotation from both semantic and formatting perspectives.
+// Example:
+//
+// User Query:
+//
+// top countries by population in Africa
+//
+// 0 4 14 17 28 31 37
+//
+// Table Data:
+//
+// + "country" - dimension
+// + "population" - metric
+// + "Africa" - value in the "continent" column
+//
+// text_formatted = `"top countries by population in Africa"`
+//
+// html_formatted =
+// `"top countries by population in Africa"`
+//
+// ```
+// markups = [
+// {DIMENSION, 4, 12}, // 'countries'
+// {METRIC, 17, 26}, // 'population'
+// {FILTER, 31, 36} // 'Africa'
+// ]
+// ```
+//
+// Note that html formattings for 'DIMENSION' and 'METRIC' are the same, while
+// semantic markups are different.
+message AnnotatedString {
+ // Semantic markup denotes a substring (by index and length) with markup
+ // information.
+ message SemanticMarkup {
+ // The semantic type of the markup substring.
+ SemanticMarkupType type = 1;
+
+ // Unicode character index of the query.
+ int32 start_char_index = 2;
+
+ // The length (number of unicode characters) of the markup substring.
+ int32 length = 3;
+ }
+
+ // Semantic markup types.
+ enum SemanticMarkupType {
+ // No markup type was specified.
+ MARKUP_TYPE_UNSPECIFIED = 0;
+
+ // Markup for a substring denoting a metric.
+ METRIC = 1;
+
+ // Markup for a substring denoting a dimension.
+ DIMENSION = 2;
+
+ // Markup for a substring denoting a filter.
+ FILTER = 3;
+
+ // Markup for an unused substring.
+ UNUSED = 4;
+
+ // Markup for a substring containing blocked phrases.
+ BLOCKED = 5;
+
+ // Markup for a substring that contains terms for row.
+ ROW = 6;
+ }
+
+ // Text version of the string.
+ string text_formatted = 1;
+
+ // HTML version of the string annotation.
+ string html_formatted = 2;
+
+ // Semantic version of the string annotation.
+ repeated SemanticMarkup markups = 3;
+}
diff --git a/google/cloud/dataqna/v1alpha/auto_suggestion_service.proto b/google/cloud/dataqna/v1alpha/auto_suggestion_service.proto
new file mode 100644
index 00000000..dc547819
--- /dev/null
+++ b/google/cloud/dataqna/v1alpha/auto_suggestion_service.proto
@@ -0,0 +1,215 @@
+// Copyright 2020 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
+//
+// http://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.
+
+syntax = "proto3";
+
+package google.cloud.dataqna.v1alpha;
+
+import "google/api/annotations.proto";
+import "google/api/field_behavior.proto";
+import "google/api/resource.proto";
+import "google/cloud/dataqna/v1alpha/annotated_string.proto";
+import "google/api/client.proto";
+
+option csharp_namespace = "Google.Cloud.DataQnA.V1Alpha";
+option go_package = "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha;dataqna";
+option java_multiple_files = true;
+option java_outer_classname = "AutoSuggestionServiceProto";
+option java_package = "com.google.cloud.dataqna.v1alpha";
+option php_namespace = "Google\\Cloud\\DataQnA\\V1alpha";
+option ruby_package = "Google::Cloud::DataQnA::V1alpha";
+
+// This stateless API provides automatic suggestions for natural language
+// queries for the data sources in the provided project and location.
+//
+// The service provides a resourceless operation `suggestQueries` that can be
+// called to get a list of suggestions for a given incomplete query and scope
+// (or list of scopes) under which the query is to be interpreted.
+//
+// There are two types of suggestions, ENTITY for single entity suggestions
+// and TEMPLATE for full sentences. By default, both types are returned.
+//
+// Example Request:
+// ```
+// GetSuggestions({
+// parent: "locations/us/projects/my-project"
+// scopes:
+// "//bigquery.googleapis.com/projects/my-project/datasets/my-dataset/tables/my-table"
+// query: "top it"
+// })
+// ```
+//
+// The service will retrieve information based on the given scope(s) and give
+// suggestions based on that (e.g. "top item" for "top it" if "item" is a known
+// dimension for the provided scope).
+// ```
+// suggestions {
+// suggestion_info {
+// annotated_suggestion {
+// text_formatted: "top item by sum of usd_revenue_net"
+// markups {
+// type: DIMENSION
+// start_char_index: 4
+// length: 4
+// }
+// markups {
+// type: METRIC
+// start_char_index: 19
+// length: 15
+// }
+// }
+// query_matches {
+// start_char_index: 0
+// length: 6
+// }
+// }
+// suggestion_type: TEMPLATE
+// ranking_score: 0.9
+// }
+// suggestions {
+// suggestion_info {
+// annotated_suggestion {
+// text_formatted: "item"
+// markups {
+// type: DIMENSION
+// start_char_index: 4
+// length: 2
+// }
+// }
+// query_matches {
+// start_char_index: 0
+// length: 6
+// }
+// }
+// suggestion_type: ENTITY
+// ranking_score: 0.8
+// }
+// ```
+service AutoSuggestionService {
+ option (google.api.default_host) = "dataqna.googleapis.com";
+ option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
+
+ // Gets a list of suggestions based on a prefix string.
+ // AutoSuggestion tolerance should be less than 1 second.
+ rpc SuggestQueries(SuggestQueriesRequest) returns (SuggestQueriesResponse) {
+ option (google.api.http) = {
+ post: "/v1alpha/{parent=projects/*/locations/*}:suggestQueries"
+ body: "*"
+ };
+ }
+}
+
+// Request for query suggestions.
+message SuggestQueriesRequest {
+ // Required. The parent of the suggestion query is the resource denoting the project and
+ // location.
+ string parent = 1 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.resource_reference) = {
+ type: "locations.googleapis.com/Location"
+ }
+ ];
+
+ // The scopes to which this search is restricted. The only supported scope
+ // pattern is
+ // `//bigquery.googleapis.com/projects/{GCP-PROJECT-ID}/datasets/{DATASET-ID}/tables/{TABLE-ID}`.
+ repeated string scopes = 2;
+
+ // User query for which to generate suggestions. If the query is empty, zero
+ // state suggestions are returned. This allows UIs to display suggestions
+ // right away, helping the user to get a sense of what a query might look
+ // like.
+ string query = 3;
+
+ // The requested suggestion type. Multiple suggestion types can be
+ // requested, but there is no guarantee that the service will return
+ // suggestions for each type. Suggestions for a requested type might rank
+ // lower than suggestions for other types and the service may decide to cut
+ // these suggestions off.
+ repeated SuggestionType suggestion_types = 4;
+}
+
+// A suggestion for a query with a ranking score.
+message Suggestion {
+ // Detailed information about the suggestion.
+ SuggestionInfo suggestion_info = 1;
+
+ // The score of the suggestion. This can be used to define ordering in UI.
+ // The score represents confidence in the suggestion where higher is better.
+ // All score values must be in the range [0, 1).
+ double ranking_score = 2;
+
+ // The type of the suggestion.
+ SuggestionType suggestion_type = 3;
+}
+
+// Detailed information about the suggestion.
+message SuggestionInfo {
+ // MatchInfo describes which part of suggestion matched with data in user
+ // typed query. This can be used to highlight matching parts in the UI. This
+ // is different from the annotations provided in annotated_suggestion. The
+ // annotated_suggestion provides information about the semantic meaning, while
+ // this provides information about how it relates to the input.
+ //
+ // Example:
+ // user query: `top products`
+ //
+ // ```
+ // annotated_suggestion {
+ // text_formatted = "top product_group"
+ // html_formatted = "top product_group"
+ // markups {
+ // {type: TEXT, start_char_index: 0, length: 3}
+ // {type: DIMENSION, start_char_index: 4, length: 13}
+ // }
+ // }
+ //
+ // query_matches {
+ // { start_char_index: 0, length: 3 }
+ // { start_char_index: 4, length: 7}
+ // }
+ // ```
+ message MatchInfo {
+ // Unicode character index of the string annotation.
+ int32 start_char_index = 1;
+
+ // Count of unicode characters of this substring.
+ int32 length = 2;
+ }
+
+ // Annotations for the suggestion. This provides information about which part
+ // of the suggestion corresponds to what semantic meaning (e.g. a metric).
+ AnnotatedString annotated_suggestion = 1;
+
+ // Matches between user query and the annotated string.
+ repeated MatchInfo query_matches = 2;
+}
+
+// Response to SuggestQueries.
+message SuggestQueriesResponse {
+ // A list of suggestions.
+ repeated Suggestion suggestions = 1;
+}
+
+// The type of suggestion.
+enum SuggestionType {
+ // No suggestiont type is specified.
+ SUGGESTION_TYPE_UNSPECIFIED = 0;
+
+ // Entity suggestion type. Suggestions are for single entities.
+ ENTITY = 1;
+
+ // Template suggestion type. Suggestions are for full sentences.
+ TEMPLATE = 2;
+}
diff --git a/google/cloud/dataqna/v1alpha/dataqna_grpc_service_config.json b/google/cloud/dataqna/v1alpha/dataqna_grpc_service_config.json
new file mode 100644
index 00000000..434d589c
--- /dev/null
+++ b/google/cloud/dataqna/v1alpha/dataqna_grpc_service_config.json
@@ -0,0 +1,29 @@
+{
+ "methodConfig": [{
+ "name": [{ "service": "google.cloud.dataqna.v1alpha.QuestionService" }],
+ "timeout": "60s",
+ "retryPolicy": {
+ "maxAttempts": 5,
+ "initialBackoff": "1s",
+ "maxBackoff": "10s",
+ "backoffMultiplier": 1.3,
+ "retryableStatusCodes": ["UNAVAILABLE"]
+ }
+ },
+ {
+ "name": [
+ { "service": "google.cloud.dataqna.v1alpha.QuestionService",
+ "method": "CreateQuestion"},
+ { "service": "google.cloud.dataqna.v1alpha.QuestionService",
+ "method": "ExecuteQuestion"},
+ { "service": "google.cloud.dataqna.v1alpha.QuestionService",
+ "method": "UpdateUserFeedback"}
+ ],
+ "timeout": "60s"
+ },
+ {
+ "name": [
+ { "service": "google.cloud.dataqna.v1alpha.AutoSuggestionService" }],
+ "timeout": "2s"
+ }]
+}
diff --git a/google/cloud/dataqna/v1alpha/dataqna_v1alpha.yaml b/google/cloud/dataqna/v1alpha/dataqna_v1alpha.yaml
new file mode 100644
index 00000000..32290947
--- /dev/null
+++ b/google/cloud/dataqna/v1alpha/dataqna_v1alpha.yaml
@@ -0,0 +1,24 @@
+type: google.api.Service
+config_version: 3
+name: dataqna.googleapis.com
+title: Data QnA API
+
+apis:
+- name: google.cloud.dataqna.v1alpha.AutoSuggestionService
+- name: google.cloud.dataqna.v1alpha.QuestionService
+
+documentation:
+ summary: |-
+ Data QnA is a natural language question and answer service for BigQuery
+ data.
+
+authentication:
+ rules:
+ - selector: google.cloud.dataqna.v1alpha.AutoSuggestionService.SuggestQueries
+ oauth:
+ canonical_scopes: |-
+ https://www.googleapis.com/auth/cloud-platform
+ - selector: 'google.cloud.dataqna.v1alpha.QuestionService.*'
+ oauth:
+ canonical_scopes: |-
+ https://www.googleapis.com/auth/cloud-platform
diff --git a/google/cloud/dataqna/v1alpha/gapic.yaml b/google/cloud/dataqna/v1alpha/gapic.yaml
new file mode 100644
index 00000000..72e94744
--- /dev/null
+++ b/google/cloud/dataqna/v1alpha/gapic.yaml
@@ -0,0 +1,18 @@
+type: com.google.api.codegen.ConfigProto
+config_schema_version: 2.0.0
+language_settings:
+ java:
+ package_name: com.google.cloud.dataqna.v1alpha
+ python:
+ package_name: google.cloud.dataqna_v1alpha.gapic
+ go:
+ package_name: google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha;dataqna
+ csharp:
+ package_name: Google.Cloud.DataQnA.V1Alpha
+ ruby:
+ package_name: Google::Cloud::DataQnA::V1alpha
+ php:
+ package_name: Google\Cloud\DataQnA\V1alpha
+ nodejs:
+ package_name: dataqna.v1alpha
+ domain_layer_location: google-cloud
diff --git a/google/cloud/dataqna/v1alpha/question.proto b/google/cloud/dataqna/v1alpha/question.proto
new file mode 100644
index 00000000..7478adfd
--- /dev/null
+++ b/google/cloud/dataqna/v1alpha/question.proto
@@ -0,0 +1,401 @@
+// Copyright 2020 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
+//
+// http://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.
+
+syntax = "proto3";
+
+package google.cloud.dataqna.v1alpha;
+
+import "google/api/field_behavior.proto";
+import "google/api/resource.proto";
+import "google/cloud/dataqna/v1alpha/annotated_string.proto";
+import "google/protobuf/any.proto";
+import "google/protobuf/timestamp.proto";
+import "google/rpc/status.proto";
+
+option csharp_namespace = "Google.Cloud.DataQnA.V1Alpha";
+option go_package = "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha;dataqna";
+option java_multiple_files = true;
+option java_outer_classname = "QuestionProto";
+option java_package = "com.google.cloud.dataqna.v1alpha";
+option php_namespace = "Google\\Cloud\\DataQnA\\V1alpha";
+option ruby_package = "Google::Cloud::DataQnA::V1alpha";
+
+// The question resource represents a natural language query, its settings,
+// understanding generated by the system, and answer retrieval status.
+// A question cannot be modified.
+message Question {
+ option (google.api.resource) = {
+ type: "dataqna.googleapis.com/Question"
+ pattern: "projects/{project}/locations/{location}/questions/{question}"
+ };
+
+ // Output only. Immutable. The unique identifier for the Question. The ID is server-generated.
+ // Example: `projects/foo/locations/bar/questions/123`
+ string name = 1 [
+ (google.api.field_behavior) = OUTPUT_ONLY,
+ (google.api.field_behavior) = IMMUTABLE
+ ];
+
+ // Required. Immutable. Scopes to be used for the question. A scope defines the relevant data set
+ // scope. It can be a reference to a specific data source or a collection of
+ // data sources. Currently, support is limited to a single BigQuery table.
+ // There must be exactly one `scopes` element.
+ //
+ // Example:
+ // `//bigquery.googleapis.com/projects/test-project/datasets/foo/tables/bar`
+ repeated string scopes = 2 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.field_behavior) = IMMUTABLE
+ ];
+
+ // Required. Immutable. The query in natural language.
+ string query = 3 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.field_behavior) = IMMUTABLE
+ ];
+
+ // A list of annotations to use instead of the default annotation of a data
+ // source (set in the data source reference resource). There must not be
+ // more than one annotation with the same data source reference.
+ repeated string data_source_annotations = 4;
+
+ // An error field explaining why interpretation failed. This is only populated
+ // if the interpretation failed.
+ //
+ // Note: This is different from getting a status error on the request itself.
+ // This is not a client or server error and the Question resource is still
+ // persisted, but the service could not interpret the question. Clients should
+ // present the error to the user so the user can rephrase the question.
+ InterpretError interpret_error = 5;
+
+ // A list of interpretations for this question.
+ repeated Interpretation interpretations = 6;
+
+ // Time when the question was created.
+ google.protobuf.Timestamp create_time = 7;
+
+ // Output only. The e-mail address of the user that created this question.
+ string user_email = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ // Input only. Immutable. Flags to request additional information for debugging purposes.
+ DebugFlags debug_flags = 9 [
+ (google.api.field_behavior) = IMMUTABLE,
+ (google.api.field_behavior) = INPUT_ONLY
+ ];
+
+ // Top level debug information.
+ // This will be stored as the type DebugInformation.
+ // Using Any so clients don't need to pull in anything
+ // inside the debug message.
+ google.protobuf.Any debug_info = 10;
+}
+
+// Details on the failure to interpret the question.
+message InterpretError {
+ // Details on interpretation failure.
+ message InterpretErrorDetails {
+ // Populated if parts of the query are unsupported.
+ InterpretUnsupportedDetails unsupported_details = 1;
+
+ // Populated if the query is incomplete.
+ InterpretIncompleteQueryDetails incomplete_query_details = 2;
+
+ // Populated if the query was too ambiguous.
+ InterpretAmbiguityDetails ambiguity_details = 3;
+ }
+
+ // Details about unsupported parts in a query.
+ message InterpretUnsupportedDetails {
+ // Unsupported operators. For example: median.
+ repeated string operators = 1;
+
+ // Unsupported intents.
+ repeated string intent = 2;
+ }
+
+ // Details about an incomplete query.
+ message InterpretIncompleteQueryDetails {
+ // List of missing interpret entities.
+ repeated InterpretEntity entities = 1;
+ }
+
+ // Details about a query that was too ambiguous. Currently, the message
+ // has no fields and its presence signals that there was ambiguity.
+ message InterpretAmbiguityDetails {
+
+ }
+
+ // The interpret error code provides an error category why the interpretation
+ // failed.
+ enum InterpretErrorCode {
+ // No interpret error code was specified.
+ INTERPRET_ERROR_CODE_UNSPECIFIED = 0;
+
+ // The query is not valid.
+ INVALID_QUERY = 1;
+
+ // The interpreter failed to understand the question. For example, because
+ // it was too ambiguous.
+ FAILED_TO_UNDERSTAND = 2;
+
+ // The interpreter could understand the question, but was not able to arrive
+ // at an answer. For example, because a requested operation is not
+ // supported.
+ FAILED_TO_ANSWER = 3;
+ }
+
+ // Error message explaining why this question could not be interpreted.
+ string message = 1;
+
+ // The code for the error category why the interpretation failed.
+ InterpretErrorCode code = 2;
+
+ // Details on interpretation failure.
+ InterpretErrorDetails details = 3;
+}
+
+// Information about the backend status (such as BigQuery) of the execution.
+message ExecutionInfo {
+ // Enum of possible job execution statuses.
+ enum JobExecutionState {
+ // No job execution was specified.
+ JOB_EXECUTION_STATE_UNSPECIFIED = 0;
+
+ // No job execution was requested, yet.
+ NOT_EXECUTED = 1;
+
+ // The job is running.
+ RUNNING = 2;
+
+ // The job completed successfully.
+ SUCCEEDED = 3;
+
+ // The job completed unsuccessfully.
+ FAILED = 4;
+ }
+
+ // Status returned by the backend when the job was created.
+ google.rpc.Status job_creation_status = 1;
+
+ // Status of the job execution.
+ JobExecutionState job_execution_state = 2;
+
+ // Time when the execution was triggered.
+ google.protobuf.Timestamp create_time = 3;
+
+ // BigQuery job information.
+ // Future versions will have different backends. Hence, clients must make sure
+ // they can handle it when this field is not populated.
+ BigQueryJob bigquery_job = 4;
+}
+
+// BigQuery job information. This can be used to query the BigQuery API and
+// retrieve the current job's status (using
+// [jobs.get](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/get)).
+message BigQueryJob {
+ // The job ID.
+ string job_id = 1;
+
+ // The project ID of the job.
+ string project_id = 2;
+
+ // The location where the job is running.
+ string location = 3;
+}
+
+// An interpretation of a natural language query.
+message Interpretation {
+ // List of data sources used in the current understanding.
+ repeated string data_sources = 1;
+
+ // The level of confidence that one of the interpretations is correct. This is
+ // a value in the range [0, 1] where a value of 0.5 or below is to be
+ // considered a low confidence.
+ double confidence = 2;
+
+ // A list of unused phrases. Clients should display a Did You Mean (DYM)
+ // dialog if this is non-empty, even if this is the only interpretation.
+ repeated string unused_phrases = 3;
+
+ // Human readable representation of the query.
+ HumanReadable human_readable = 4;
+
+ // Information about the interpretation structure that helps to understand and
+ // visualize the response.
+ InterpretationStructure interpretation_structure = 5;
+
+ // Representation of the data query to be sent to the backend.
+ DataQuery data_query = 6;
+
+ // Information about the backend response. This is populated only if execution
+ // of an interpretation was requested.
+ ExecutionInfo execution_info = 7;
+}
+
+// Representation of the data query for the backend.
+// This is provided for informational purposes only. Clients should not use
+// it to send it to the backend directly, but rather use the `execute` RPC
+// to trigger the execution. Using the `execute` RPC is needed in order to
+// track the state of a question and report on it correctly to the data
+// administrators.
+message DataQuery {
+ // The generated SQL query to be sent to the backend.
+ string sql = 1;
+}
+
+// Human readable interpretation.
+message HumanReadable {
+ // Generated query explaining the interpretation.
+ AnnotatedString generated_interpretation = 1;
+
+ // Annotations on the original query.
+ AnnotatedString original_question = 2;
+}
+
+// Information about the interpretation structure that helps to understand and
+// visualize the response.
+message InterpretationStructure {
+ // Information about a column.
+ message ColumnInfo {
+ // The alias of the output column as used by the backend. For example, the
+ // field name in the schema provided in the query response in BigQuery.
+ string output_alias = 1;
+
+ // Human readable name of the output column.
+ string display_name = 2;
+ }
+
+ // Enumeration of visualzation types to use for query response data.
+ enum VisualizationType {
+ // No visualization type was specified.
+ VISUALIZATION_TYPE_UNSPECIFIED = 0;
+
+ // Show a table.
+ TABLE = 1;
+
+ // Show a [bar
+ // chart](https://developers.google.com/chart/interactive/docs/gallery/barchart).
+ BAR_CHART = 2;
+
+ // Show a [column
+ // chart](https://developers.google.com/chart/interactive/docs/gallery/columnchart).
+ COLUMN_CHART = 3;
+
+ // Show a
+ // [timeline](https://developers.google.com/chart/interactive/docs/gallery/timeline).
+ TIMELINE = 4;
+
+ // Show a [scatter
+ // plot](https://developers.google.com/chart/interactive/docs/gallery/scatterchart).
+ SCATTER_PLOT = 5;
+
+ // Show a [pie
+ // chart](https://developers.google.com/chart/interactive/docs/gallery/piechart).
+ PIE_CHART = 6;
+
+ // Show a [line
+ // chart](https://developers.google.com/chart/interactive/docs/gallery/linechart).
+ LINE_CHART = 7;
+
+ // Show an [area
+ // chart](https://developers.google.com/chart/interactive/docs/gallery/areachart).
+ AREA_CHART = 8;
+
+ // Show a [combo
+ // chart](https://developers.google.com/chart/interactive/docs/gallery/combochart).
+ COMBO_CHART = 9;
+
+ // Show a
+ // [histogram](https://developers.google.com/chart/interactive/docs/gallery/histogram).
+ HISTOGRAM = 10;
+
+ // This denotes queries when the user has not specified the particular type
+ // of chart and has mentioned only a generic chart name such as "Chart",
+ // "Plot", "Graph", etc. This will differentiate it from specific charting
+ // terms such as "Bar chart", "Pie chart", etc.
+ GENERIC_CHART = 11;
+
+ // The user tried to specify a chart type, but the interpreter could not
+ // understand the type. The client should display a generic chart and may
+ // give a hint to the user that the requested type was not understood.
+ CHART_NOT_UNDERSTOOD = 12;
+ }
+
+ // List of possible visualization types to apply for this interpretation. The
+ // order has no relevance.
+ repeated VisualizationType visualization_types = 1;
+
+ // Information about the output columns, that is, the columns that will be
+ // returned by the backend.
+ repeated ColumnInfo column_info = 2;
+}
+
+// Configuriation of debug flags.
+message DebugFlags {
+ // Whether to include the original VAQuery.
+ bool include_va_query = 1;
+
+ // Whether to include the original nested VAQuery.
+ bool include_nested_va_query = 2;
+
+ // Whether to include the original human interpretation strings generated
+ // by Analyza.
+ bool include_human_interpretation = 3;
+
+ // Whether to include the Aqua debug response.
+ bool include_aqua_debug_response = 4;
+
+ // The time in milliseconds from Unix epoch to be used
+ // to process the query. This is useful for testing
+ // the queries at different time period.
+ // If not set or time_override <= 0, then the current
+ // time is used.
+ int64 time_override = 5;
+
+ // Set to true if request is initiated by an internal Google user.
+ bool is_internal_google_user = 6;
+
+ // Determines whether cache needs to be ignored. If set to
+ // true, cache won't be queried and updated.
+ bool ignore_cache = 7;
+
+ // Whether to include the request/response pair from the call to the
+ // EntityIndex for SearchEntities.
+ bool include_search_entities_rpc = 8;
+
+ // Whether to include the request/response pair from the call to the
+ // Annotations service for ListColumnAnnotations.
+ bool include_list_column_annotations_rpc = 9;
+
+ // Whether to include the entity list passed to Analyza.
+ bool include_virtual_analyst_entities = 10;
+
+ // Whether to include the table list.
+ bool include_table_list = 11;
+
+ // Whether to include the domain list.
+ bool include_domain_list = 12;
+}
+
+// Query entities of an interpretation.
+enum InterpretEntity {
+ // No interpret entity was specified.
+ INTERPRET_ENTITY_UNSPECIFIED = 0;
+
+ // A dimenstion entity.
+ DIMENSION = 1;
+
+ // A metric entity.
+ METRIC = 2;
+}
diff --git a/google/cloud/dataqna/v1alpha/question_service.proto b/google/cloud/dataqna/v1alpha/question_service.proto
new file mode 100644
index 00000000..d92ac127
--- /dev/null
+++ b/google/cloud/dataqna/v1alpha/question_service.proto
@@ -0,0 +1,162 @@
+// Copyright 2020 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
+//
+// http://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.
+
+syntax = "proto3";
+
+package google.cloud.dataqna.v1alpha;
+
+import "google/api/annotations.proto";
+import "google/api/client.proto";
+import "google/api/field_behavior.proto";
+import "google/api/resource.proto";
+import "google/cloud/dataqna/v1alpha/question.proto";
+import "google/cloud/dataqna/v1alpha/user_feedback.proto";
+import "google/protobuf/field_mask.proto";
+
+option csharp_namespace = "Google.Cloud.DataQnA.V1Alpha";
+option go_package = "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha;dataqna";
+option java_multiple_files = true;
+option java_outer_classname = "QuestionServiceProto";
+option java_package = "com.google.cloud.dataqna.v1alpha";
+option php_namespace = "Google\\Cloud\\DataQnA\\V1alpha";
+option ruby_package = "Google::Cloud::DataQnA::V1alpha";
+
+// Service to interpret natural language queries.
+// The service allows to create `Question` resources that are interpreted and
+// are filled with one or more interpretations if the question could be
+// interpreted. Once a `Question` resource is created and has at least one
+// interpretation, an interpretation can be chosen for execution, which
+// triggers a query to the backend (for BigQuery, it will create a job).
+// Upon successful execution of that interpretation, backend specific
+// information will be returned so that the client can retrieve the results
+// from the backend.
+//
+// The `Question` resources are named `projects/*/locations/*/questions/*`.
+//
+// The `Question` resource has a singletion sub-resource `UserFeedback` named
+// `projects/*/locations/*/questions/*/userFeedback`, which allows access to
+// user feedback.
+service QuestionService {
+ option (google.api.default_host) = "dataqna.googleapis.com";
+ option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
+
+ // Gets a previously created question.
+ rpc GetQuestion(GetQuestionRequest) returns (Question) {
+ option (google.api.http) = {
+ get: "/v1alpha/{name=projects/*/locations/*/questions/*}"
+ };
+ option (google.api.method_signature) = "name";
+ }
+
+ // Creates a question.
+ rpc CreateQuestion(CreateQuestionRequest) returns (Question) {
+ option (google.api.http) = {
+ post: "/v1alpha/{parent=projects/*/locations/*}/questions"
+ body: "question"
+ };
+ option (google.api.method_signature) = "parent,question";
+ }
+
+ // Executes an interpretation.
+ rpc ExecuteQuestion(ExecuteQuestionRequest) returns (Question) {
+ option (google.api.http) = {
+ post: "/v1alpha/{name=projects/*/locations/*/questions/*}:execute"
+ body: "*"
+ };
+ option (google.api.method_signature) = "name,interpretation_index";
+ }
+
+ // Gets previously created user feedback.
+ rpc GetUserFeedback(GetUserFeedbackRequest) returns (UserFeedback) {
+ option (google.api.http) = {
+ get: "/v1alpha/{name=projects/*/locations/*/questions/*/userFeedback}"
+ };
+ option (google.api.method_signature) = "name";
+ }
+
+ // Updates user feedback. This creates user feedback if there was none before
+ // (upsert).
+ rpc UpdateUserFeedback(UpdateUserFeedbackRequest) returns (UserFeedback) {
+ option (google.api.http) = {
+ patch: "/v1alpha/{user_feedback.name=projects/*/locations/*/questions/*/userFeedback}"
+ body: "user_feedback"
+ };
+ option (google.api.method_signature) = "user_feedback,update_mask";
+ }
+}
+
+// A request to get a previously created question.
+message GetQuestionRequest {
+ // Required. The unique identifier for the question.
+ // Example: `projects/foo/locations/bar/questions/1234`
+ string name = 1 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.resource_reference) = {
+ type: "dataqna.googleapis.com/Question"
+ }
+ ];
+
+ // The list of fields to be retrieved.
+ google.protobuf.FieldMask read_mask = 2;
+}
+
+// Request to create a question resource.
+message CreateQuestionRequest {
+ // Required. The name of the project this data source reference belongs to.
+ // Example: `projects/foo/locations/bar`
+ string parent = 1 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.resource_reference) = {
+ type: "locations.googleapis.com/Location"
+ }
+ ];
+
+ // Required. The question to create.
+ Question question = 2 [(google.api.field_behavior) = REQUIRED];
+}
+
+// Request to execute an interpretation.
+message ExecuteQuestionRequest {
+ // Required. The unique identifier for the question.
+ // Example: `projects/foo/locations/bar/questions/1234`
+ string name = 1 [(google.api.field_behavior) = REQUIRED];
+
+ // Required. Index of the interpretation to execute.
+ int32 interpretation_index = 2 [(google.api.field_behavior) = REQUIRED];
+}
+
+// Request to get user feedback.
+message GetUserFeedbackRequest {
+ // Required. The unique identifier for the user feedback.
+ // User feedback is a singleton resource on a Question.
+ // Example: `projects/foo/locations/bar/questions/1234/userFeedback`
+ string name = 1 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.resource_reference) = {
+ type: "dataqna.googleapis.com/UserFeedback"
+ }
+ ];
+}
+
+// Request to updates user feedback.
+message UpdateUserFeedbackRequest {
+ // Required. The user feedback to update. This can be called even if there is no
+ // user feedback so far.
+ // The feedback's name field is used to identify the user feedback (and the
+ // corresponding question) to update.
+ UserFeedback user_feedback = 1 [(google.api.field_behavior) = REQUIRED];
+
+ // The list of fields to be updated.
+ google.protobuf.FieldMask update_mask = 2;
+}
diff --git a/google/cloud/dataqna/v1alpha/user_feedback.proto b/google/cloud/dataqna/v1alpha/user_feedback.proto
new file mode 100644
index 00000000..9749d49e
--- /dev/null
+++ b/google/cloud/dataqna/v1alpha/user_feedback.proto
@@ -0,0 +1,59 @@
+// Copyright 2020 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
+//
+// http://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.
+
+syntax = "proto3";
+
+package google.cloud.dataqna.v1alpha;
+
+import "google/api/field_behavior.proto";
+import "google/api/resource.proto";
+
+option csharp_namespace = "Google.Cloud.DataQnA.V1Alpha";
+option go_package = "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha;dataqna";
+option java_multiple_files = true;
+option java_outer_classname = "UserFeedbackProto";
+option java_package = "com.google.cloud.dataqna.v1alpha";
+option php_namespace = "Google\\Cloud\\DataQnA\\V1alpha";
+option ruby_package = "Google::Cloud::DataQnA::V1alpha";
+
+// Feedback provided by a user.
+message UserFeedback {
+ option (google.api.resource) = {
+ type: "dataqna.googleapis.com/UserFeedback"
+ pattern: "projects/{project}/locations/{location}/questions/{question}/userFeedback"
+ };
+
+ // Enumeration of feedback ratings.
+ enum UserFeedbackRating {
+ // No rating was specified.
+ USER_FEEDBACK_RATING_UNSPECIFIED = 0;
+
+ // The user provided positive feedback.
+ POSITIVE = 1;
+
+ // The user provided negative feedback.
+ NEGATIVE = 2;
+ }
+
+ // Required. The unique identifier for the user feedback.
+ // User feedback is a singleton resource on a Question.
+ // Example: `projects/foo/locations/bar/questions/1234/userFeedback`
+ string name = 1 [(google.api.field_behavior) = REQUIRED];
+
+ // Free form user feedback, such as a text box.
+ string free_form_feedback = 2;
+
+ // The user feedback rating
+ UserFeedbackRating rating = 3;
+}