#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnnotatedString {
#[prost(string, tag = "1")]
pub text_formatted: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub html_formatted: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub markups: ::prost::alloc::vec::Vec<annotated_string::SemanticMarkup>,
}
pub mod annotated_string {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SemanticMarkup {
#[prost(enumeration = "SemanticMarkupType", tag = "1")]
pub r#type: i32,
#[prost(int32, tag = "2")]
pub start_char_index: i32,
#[prost(int32, tag = "3")]
pub length: i32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SemanticMarkupType {
MarkupTypeUnspecified = 0,
Metric = 1,
Dimension = 2,
Filter = 3,
Unused = 4,
Blocked = 5,
Row = 6,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SuggestQueriesRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub scopes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "3")]
pub query: ::prost::alloc::string::String,
#[prost(enumeration = "SuggestionType", repeated, tag = "4")]
pub suggestion_types: ::prost::alloc::vec::Vec<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Suggestion {
#[prost(message, optional, tag = "1")]
pub suggestion_info: ::core::option::Option<SuggestionInfo>,
#[prost(double, tag = "2")]
pub ranking_score: f64,
#[prost(enumeration = "SuggestionType", tag = "3")]
pub suggestion_type: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SuggestionInfo {
#[prost(message, optional, tag = "1")]
pub annotated_suggestion: ::core::option::Option<AnnotatedString>,
#[prost(message, repeated, tag = "2")]
pub query_matches: ::prost::alloc::vec::Vec<suggestion_info::MatchInfo>,
}
pub mod suggestion_info {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MatchInfo {
#[prost(int32, tag = "1")]
pub start_char_index: i32,
#[prost(int32, tag = "2")]
pub length: i32,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SuggestQueriesResponse {
#[prost(message, repeated, tag = "1")]
pub suggestions: ::prost::alloc::vec::Vec<Suggestion>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SuggestionType {
Unspecified = 0,
Entity = 1,
Template = 2,
}
#[doc = r" Generated client implementations."]
pub mod auto_suggestion_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " This stateless API provides automatic suggestions for natural language"]
#[doc = " queries for the data sources in the provided project and location."]
#[doc = ""]
#[doc = " The service provides a resourceless operation `suggestQueries` that can be"]
#[doc = " called to get a list of suggestions for a given incomplete query and scope"]
#[doc = " (or list of scopes) under which the query is to be interpreted."]
#[doc = ""]
#[doc = " There are two types of suggestions, ENTITY for single entity suggestions"]
#[doc = " and TEMPLATE for full sentences. By default, both types are returned."]
#[doc = ""]
#[doc = " Example Request:"]
#[doc = " ```"]
#[doc = " GetSuggestions({"]
#[doc = " parent: \"locations/us/projects/my-project\""]
#[doc = " scopes:"]
#[doc = " \"//bigquery.googleapis.com/projects/my-project/datasets/my-dataset/tables/my-table\""]
#[doc = " query: \"top it\""]
#[doc = " })"]
#[doc = " ```"]
#[doc = ""]
#[doc = " The service will retrieve information based on the given scope(s) and give"]
#[doc = " suggestions based on that (e.g. \"top item\" for \"top it\" if \"item\" is a known"]
#[doc = " dimension for the provided scope)."]
#[doc = " ```"]
#[doc = " suggestions {"]
#[doc = " suggestion_info {"]
#[doc = " annotated_suggestion {"]
#[doc = " text_formatted: \"top item by sum of usd_revenue_net\""]
#[doc = " markups {"]
#[doc = " type: DIMENSION"]
#[doc = " start_char_index: 4"]
#[doc = " length: 4"]
#[doc = " }"]
#[doc = " markups {"]
#[doc = " type: METRIC"]
#[doc = " start_char_index: 19"]
#[doc = " length: 15"]
#[doc = " }"]
#[doc = " }"]
#[doc = " query_matches {"]
#[doc = " start_char_index: 0"]
#[doc = " length: 6"]
#[doc = " }"]
#[doc = " }"]
#[doc = " suggestion_type: TEMPLATE"]
#[doc = " ranking_score: 0.9"]
#[doc = " }"]
#[doc = " suggestions {"]
#[doc = " suggestion_info {"]
#[doc = " annotated_suggestion {"]
#[doc = " text_formatted: \"item\""]
#[doc = " markups {"]
#[doc = " type: DIMENSION"]
#[doc = " start_char_index: 4"]
#[doc = " length: 2"]
#[doc = " }"]
#[doc = " }"]
#[doc = " query_matches {"]
#[doc = " start_char_index: 0"]
#[doc = " length: 6"]
#[doc = " }"]
#[doc = " }"]
#[doc = " suggestion_type: ENTITY"]
#[doc = " ranking_score: 0.8"]
#[doc = " }"]
#[doc = " ```"]
#[derive(Debug, Clone)]
pub struct AutoSuggestionServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> AutoSuggestionServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> AutoSuggestionServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
AutoSuggestionServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Gets a list of suggestions based on a prefix string."]
#[doc = " AutoSuggestion tolerance should be less than 1 second."]
pub async fn suggest_queries(
&mut self,
request: impl tonic::IntoRequest<super::SuggestQueriesRequest>,
) -> Result<tonic::Response<super::SuggestQueriesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.dataqna.v1alpha.AutoSuggestionService/SuggestQueries",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Question {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub scopes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "3")]
pub query: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "4")]
pub data_source_annotations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(message, optional, tag = "5")]
pub interpret_error: ::core::option::Option<InterpretError>,
#[prost(message, repeated, tag = "6")]
pub interpretations: ::prost::alloc::vec::Vec<Interpretation>,
#[prost(message, optional, tag = "7")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "8")]
pub user_email: ::prost::alloc::string::String,
#[prost(message, optional, tag = "9")]
pub debug_flags: ::core::option::Option<DebugFlags>,
#[prost(message, optional, tag = "10")]
pub debug_info: ::core::option::Option<::prost_types::Any>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InterpretError {
#[prost(string, tag = "1")]
pub message: ::prost::alloc::string::String,
#[prost(enumeration = "interpret_error::InterpretErrorCode", tag = "2")]
pub code: i32,
#[prost(message, optional, tag = "3")]
pub details: ::core::option::Option<interpret_error::InterpretErrorDetails>,
}
pub mod interpret_error {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InterpretErrorDetails {
#[prost(message, optional, tag = "1")]
pub unsupported_details: ::core::option::Option<InterpretUnsupportedDetails>,
#[prost(message, optional, tag = "2")]
pub incomplete_query_details: ::core::option::Option<InterpretIncompleteQueryDetails>,
#[prost(message, optional, tag = "3")]
pub ambiguity_details: ::core::option::Option<InterpretAmbiguityDetails>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InterpretUnsupportedDetails {
#[prost(string, repeated, tag = "1")]
pub operators: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "2")]
pub intent: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InterpretIncompleteQueryDetails {
#[prost(enumeration = "super::InterpretEntity", repeated, tag = "1")]
pub entities: ::prost::alloc::vec::Vec<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InterpretAmbiguityDetails {}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum InterpretErrorCode {
Unspecified = 0,
InvalidQuery = 1,
FailedToUnderstand = 2,
FailedToAnswer = 3,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecutionInfo {
#[prost(message, optional, tag = "1")]
pub job_creation_status: ::core::option::Option<super::super::super::rpc::Status>,
#[prost(enumeration = "execution_info::JobExecutionState", tag = "2")]
pub job_execution_state: i32,
#[prost(message, optional, tag = "3")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "4")]
pub bigquery_job: ::core::option::Option<BigQueryJob>,
}
pub mod execution_info {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum JobExecutionState {
Unspecified = 0,
NotExecuted = 1,
Running = 2,
Succeeded = 3,
Failed = 4,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BigQueryJob {
#[prost(string, tag = "1")]
pub job_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub project_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub location: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Interpretation {
#[prost(string, repeated, tag = "1")]
pub data_sources: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(double, tag = "2")]
pub confidence: f64,
#[prost(string, repeated, tag = "3")]
pub unused_phrases: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(message, optional, tag = "4")]
pub human_readable: ::core::option::Option<HumanReadable>,
#[prost(message, optional, tag = "5")]
pub interpretation_structure: ::core::option::Option<InterpretationStructure>,
#[prost(message, optional, tag = "6")]
pub data_query: ::core::option::Option<DataQuery>,
#[prost(message, optional, tag = "7")]
pub execution_info: ::core::option::Option<ExecutionInfo>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DataQuery {
#[prost(string, tag = "1")]
pub sql: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HumanReadable {
#[prost(message, optional, tag = "1")]
pub generated_interpretation: ::core::option::Option<AnnotatedString>,
#[prost(message, optional, tag = "2")]
pub original_question: ::core::option::Option<AnnotatedString>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InterpretationStructure {
#[prost(enumeration = "interpretation_structure::VisualizationType", repeated, tag = "1")]
pub visualization_types: ::prost::alloc::vec::Vec<i32>,
#[prost(message, repeated, tag = "2")]
pub column_info: ::prost::alloc::vec::Vec<interpretation_structure::ColumnInfo>,
}
pub mod interpretation_structure {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ColumnInfo {
#[prost(string, tag = "1")]
pub output_alias: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub display_name: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum VisualizationType {
Unspecified = 0,
Table = 1,
BarChart = 2,
ColumnChart = 3,
Timeline = 4,
ScatterPlot = 5,
PieChart = 6,
LineChart = 7,
AreaChart = 8,
ComboChart = 9,
Histogram = 10,
GenericChart = 11,
ChartNotUnderstood = 12,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DebugFlags {
#[prost(bool, tag = "1")]
pub include_va_query: bool,
#[prost(bool, tag = "2")]
pub include_nested_va_query: bool,
#[prost(bool, tag = "3")]
pub include_human_interpretation: bool,
#[prost(bool, tag = "4")]
pub include_aqua_debug_response: bool,
#[prost(int64, tag = "5")]
pub time_override: i64,
#[prost(bool, tag = "6")]
pub is_internal_google_user: bool,
#[prost(bool, tag = "7")]
pub ignore_cache: bool,
#[prost(bool, tag = "8")]
pub include_search_entities_rpc: bool,
#[prost(bool, tag = "9")]
pub include_list_column_annotations_rpc: bool,
#[prost(bool, tag = "10")]
pub include_virtual_analyst_entities: bool,
#[prost(bool, tag = "11")]
pub include_table_list: bool,
#[prost(bool, tag = "12")]
pub include_domain_list: bool,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum InterpretEntity {
Unspecified = 0,
Dimension = 1,
Metric = 2,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserFeedback {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub free_form_feedback: ::prost::alloc::string::String,
#[prost(enumeration = "user_feedback::UserFeedbackRating", tag = "3")]
pub rating: i32,
}
pub mod user_feedback {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum UserFeedbackRating {
Unspecified = 0,
Positive = 1,
Negative = 2,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetQuestionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub read_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateQuestionRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub question: ::core::option::Option<Question>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecuteQuestionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub interpretation_index: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetUserFeedbackRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateUserFeedbackRequest {
#[prost(message, optional, tag = "1")]
pub user_feedback: ::core::option::Option<UserFeedback>,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[doc = r" Generated client implementations."]
pub mod question_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " Service to interpret natural language queries."]
#[doc = " The service allows to create `Question` resources that are interpreted and"]
#[doc = " are filled with one or more interpretations if the question could be"]
#[doc = " interpreted. Once a `Question` resource is created and has at least one"]
#[doc = " interpretation, an interpretation can be chosen for execution, which"]
#[doc = " triggers a query to the backend (for BigQuery, it will create a job)."]
#[doc = " Upon successful execution of that interpretation, backend specific"]
#[doc = " information will be returned so that the client can retrieve the results"]
#[doc = " from the backend."]
#[doc = ""]
#[doc = " The `Question` resources are named `projects/*/locations/*/questions/*`."]
#[doc = ""]
#[doc = " The `Question` resource has a singletion sub-resource `UserFeedback` named"]
#[doc = " `projects/*/locations/*/questions/*/userFeedback`, which allows access to"]
#[doc = " user feedback."]
#[derive(Debug, Clone)]
pub struct QuestionServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> QuestionServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> QuestionServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
QuestionServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Gets a previously created question."]
pub async fn get_question(
&mut self,
request: impl tonic::IntoRequest<super::GetQuestionRequest>,
) -> Result<tonic::Response<super::Question>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.dataqna.v1alpha.QuestionService/GetQuestion",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates a question."]
pub async fn create_question(
&mut self,
request: impl tonic::IntoRequest<super::CreateQuestionRequest>,
) -> Result<tonic::Response<super::Question>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.dataqna.v1alpha.QuestionService/CreateQuestion",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Executes an interpretation."]
pub async fn execute_question(
&mut self,
request: impl tonic::IntoRequest<super::ExecuteQuestionRequest>,
) -> Result<tonic::Response<super::Question>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.dataqna.v1alpha.QuestionService/ExecuteQuestion",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets previously created user feedback."]
pub async fn get_user_feedback(
&mut self,
request: impl tonic::IntoRequest<super::GetUserFeedbackRequest>,
) -> Result<tonic::Response<super::UserFeedback>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.dataqna.v1alpha.QuestionService/GetUserFeedback",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Updates user feedback. This creates user feedback if there was none before"]
#[doc = " (upsert)."]
pub async fn update_user_feedback(
&mut self,
request: impl tonic::IntoRequest<super::UpdateUserFeedbackRequest>,
) -> Result<tonic::Response<super::UserFeedback>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.dataqna.v1alpha.QuestionService/UpdateUserFeedback",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}