module Google::Cloud::DataQnA
Constants
- VERSION
Public Class Methods
Create a new client object for AutoSuggestionService.
By default, this returns an instance of [Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Client](googleapis.dev/ruby/google-cloud-dataqna-v1alpha/latest/Google/Cloud/DataQnA/V1alpha/AutoSuggestionService/Client.html) for version V1alpha of the API. However, you can specify 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
} “`
@param version [::String, ::Symbol] The API version to connect to. Optional.
Defaults to `:v1alpha`.
@return [AutoSuggestionService::Client] A client object for the specified version.
# File lib/google/cloud/dataqna.rb, line 131 def self.auto_suggestion_service version: :v1alpha, &block require "google/cloud/dataqna/#{version.to_s.downcase}" package_name = Google::Cloud::DataQnA .constants .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } .first package_module = Google::Cloud::DataQnA.const_get package_name package_module.const_get(:AutoSuggestionService).const_get(:Client).new(&block) end
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 gRPC 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.
@return [::Google::Cloud::Config] The default configuration used by this library
# File lib/google/cloud/dataqna.rb, line 214 def self.configure yield ::Google::Cloud.configure.dataqna if block_given? ::Google::Cloud.configure.dataqna end
Create a new client object for QuestionService.
By default, this returns an instance of [Google::Cloud::DataQnA::V1alpha::QuestionService::Client](googleapis.dev/ruby/google-cloud-dataqna-v1alpha/latest/Google/Cloud/DataQnA/V1alpha/QuestionService/Client.html) for version V1alpha of the API. However, you can specify 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.
@param version [::String, ::Symbol] The API version to connect to. Optional.
Defaults to `:v1alpha`.
@return [QuestionService::Client] A client object for the specified version.
# File lib/google/cloud/dataqna.rb, line 175 def self.question_service version: :v1alpha, &block require "google/cloud/dataqna/#{version.to_s.downcase}" package_name = Google::Cloud::DataQnA .constants .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } .first package_module = Google::Cloud::DataQnA.const_get package_name package_module.const_get(:QuestionService).const_get(:Client).new(&block) end