Reference documentation and code samples for the BigQuery Data QnA API module Google::Cloud::DataQnA.
Methods
.auto_suggestion_service
def self.auto_suggestion_service(version: :v1alpha, &block) -> ::Object
Create a new client object for AutoSuggestionService.
By default, this returns an instance of
Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Client
for a gRPC client for version V1alpha of the API.
However, you can specify a different API version by passing it in the
version
parameter. If the AutoSuggestionService service is
supported by that API version, and the corresponding gem is available, the
appropriate versioned client will be returned.
About AutoSuggestionService
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
}
-
version (::String, ::Symbol) (defaults to: :v1alpha) — The API version to connect to. Optional.
Defaults to
:v1alpha
.
- (::Object) — A client object for the specified version.
.configure
def self.configure() -> ::Google::Cloud::Config
Configure the google-cloud-dataqna library.
The following configuration parameters are supported:
credentials
(type:String, Hash, Google::Auth::Credentials
) - The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object.lib_name
(type:String
) - The library name as recorded in instrumentation and logging.lib_version
(type:String
) - The library version as recorded in instrumentation and logging.interceptors
(type:Array<GRPC::ClientInterceptor>
) - An array of interceptors that are run before calls are executed.timeout
(type:Numeric
) - Default timeout in seconds.metadata
(type:Hash{Symbol=>String}
) - Additional headers to be sent with the call.retry_policy
(type:Hash
) - The retry policy. The value is a hash with the following keys::initial_delay
(type:Numeric
) - The initial delay in seconds.:max_delay
(type:Numeric
) - The max delay in seconds.:multiplier
(type:Numeric
) - The incremental backoff multiplier.:retry_codes
(type:Array<String>
) - The error codes that should trigger a retry.
- (::Google::Cloud.configure.dataqna)
- (::Google::Cloud::Config) — The default configuration used by this library
.question_service
def self.question_service(version: :v1alpha, &block) -> ::Object
Create a new client object for QuestionService.
By default, this returns an instance of
Google::Cloud::DataQnA::V1alpha::QuestionService::Client
for a gRPC client for version V1alpha of the API.
However, you can specify a different API version by passing it in the
version
parameter. If the QuestionService service is
supported by that API version, and the corresponding gem is available, the
appropriate versioned client will be returned.
About QuestionService
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.
-
version (::String, ::Symbol) (defaults to: :v1alpha) — The API version to connect to. Optional.
Defaults to
:v1alpha
.
- (::Object) — A client object for the specified version.
Constants
VERSION
value: "0.5.0"