Create a new client object for AutoSuggestionService.
By default, this returns an instance ofGoogle::Cloud::DataQnA::V1alpha::AutoSuggestionService::Clientfor a gRPC client for version V1alpha of the API.
However, you can specify a different API version by passing it in theversionparameter. If the AutoSuggestionService service is
supported by that API version, and the corresponding gem is available, the
appropriate versioned client will be returned.
Raises an exception if the currently installed versioned client gem for the
given API version does not support the AutoSuggestionService service.
You can determine whether the method will succeed by callingDataQnA.auto_suggestion_service_available?.
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 operationsuggestQueriesthat 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
}
Parameter
version(::String, ::Symbol)(defaults to: :v1alpha)— The API version to connect to. Optional.
Defaults to:v1alpha.
Returns
(::Object) — A client object for the specified version.
Determines whether the AutoSuggestionService service is supported by the current client.
If true, you can retrieve a client object by callingDataQnA.auto_suggestion_service.
If false, that method will raise an exception. This could happen if the given
API version does not exist or does not support the AutoSuggestionService service,
or if the versioned client gem needs an update to support the AutoSuggestionService service.
Parameter
version(::String, ::Symbol)(defaults to: :v1alpha)— The API version to connect to. Optional.
Defaults to:v1alpha.
Returns
(boolean) — Whether the service is available.
.configure
defself.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.
Yields
(::Google::Cloud.configure.dataqna)
Returns
(::Google::Cloud::Config) — The default configuration used by this library
By default, this returns an instance ofGoogle::Cloud::DataQnA::V1alpha::QuestionService::Clientfor a gRPC client for version V1alpha of the API.
However, you can specify a different API version by passing it in theversionparameter. If the QuestionService service is
supported by that API version, and the corresponding gem is available, the
appropriate versioned client will be returned.
Raises an exception if the currently installed versioned client gem for the
given API version does not support the QuestionService service.
You can determine whether the method will succeed by callingDataQnA.question_service_available?.
About QuestionService
Service to interpret natural language queries.
The service allows to createQuestionresources that are interpreted and
are filled with one or more interpretations if the question could be
interpreted. Once aQuestionresource 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.
TheQuestionresources are namedprojects//locations//questions/*.
TheQuestionresource has a singletion sub-resourceUserFeedbacknamedprojects//locations//questions/*/userFeedback, which allows access to
user feedback.
Parameter
version(::String, ::Symbol)(defaults to: :v1alpha)— The API version to connect to. Optional.
Defaults to:v1alpha.
Returns
(::Object) — A client object for the specified version.
Determines whether the QuestionService service is supported by the current client.
If true, you can retrieve a client object by callingDataQnA.question_service.
If false, that method will raise an exception. This could happen if the given
API version does not exist or does not support the QuestionService service,
or if the versioned client gem needs an update to support the QuestionService service.
Parameter
version(::String, ::Symbol)(defaults to: :v1alpha)— The API version to connect to. Optional.
Defaults to:v1alpha.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# BigQuery Data QnA API - Module Google::Cloud::DataQnA (v0.6.1)\n\nVersion latestkeyboard_arrow_down\n\n- [0.6.1 (latest)](/ruby/docs/reference/google-cloud-dataqna/latest/Google-Cloud-DataQnA)\n- [0.6.0](/ruby/docs/reference/google-cloud-dataqna/0.6.0/Google-Cloud-DataQnA)\n- [0.5.1](/ruby/docs/reference/google-cloud-dataqna/0.5.1/Google-Cloud-DataQnA)\n- [0.4.0](/ruby/docs/reference/google-cloud-dataqna/0.4.0/Google-Cloud-DataQnA)\n- [0.3.1](/ruby/docs/reference/google-cloud-dataqna/0.3.1/Google-Cloud-DataQnA)\n- [0.2.3](/ruby/docs/reference/google-cloud-dataqna/0.2.3/Google-Cloud-DataQnA) \nReference documentation and code samples for the BigQuery Data QnA API module Google::Cloud::DataQnA.\n\nMethods\n-------\n\n### .auto_suggestion_service\n\n def self.auto_suggestion_service(version: :v1alpha, &block) -\u003e ::Object\n\nCreate a new client object for AutoSuggestionService.\n\n\nBy default, this returns an instance of\n[Google::Cloud::DataQnA::V1alpha::AutoSuggestionService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-dataqna-v1alpha/latest/Google-Cloud-DataQnA-V1alpha-AutoSuggestionService-Client)\nfor a gRPC client for version V1alpha of the API.\nHowever, you can specify a different API version by passing it in the\n`version` parameter. If the AutoSuggestionService service is\nsupported by that API version, and the corresponding gem is available, the\nappropriate versioned client will be returned.\n\nRaises an exception if the currently installed versioned client gem for the\ngiven API version does not support the AutoSuggestionService service.\nYou can determine whether the method will succeed by calling\n[DataQnA.auto_suggestion_service_available?](/ruby/docs/reference/google-cloud-dataqna/latest/Google-Cloud-DataQnA#Google__Cloud__DataQnA_auto_suggestion_service_available__class_ \"Google::Cloud::DataQnA.auto_suggestion_service_available? (method)\").\n\n#### About AutoSuggestionService\n\nThis stateless API provides automatic suggestions for natural language\nqueries for the data sources in the provided project and location.\n\nThe service provides a resourceless operation `suggestQueries` that can be\ncalled to get a list of suggestions for a given incomplete query and scope\n(or list of scopes) under which the query is to be interpreted.\n\nThere are two types of suggestions, ENTITY for single entity suggestions\nand TEMPLATE for full sentences. By default, both types are returned.\n\nExample Request:\n`\nGetSuggestions({\nparent: \"locations/us/projects/my-project\"\nscopes:\n\"//bigquery.googleapis.com/projects/my-project/datasets/my-dataset/tables/my-table\"\nquery: \"top it\"\n})\n`\n\n\u003cbr /\u003e\n\nThe service will retrieve information based on the given scope(s) and give\nsuggestions based on that (e.g. \"top item\" for \"top it\" if \"item\" is a known\ndimension for the provided scope).\n`\nsuggestions {\nsuggestion_info {\nannotated_suggestion {\ntext_formatted: \"top item by sum of usd_revenue_net\"\nmarkups {\ntype: DIMENSION\nstart_char_index: 4\nlength: 4\n}\nmarkups {\ntype: METRIC\nstart_char_index: 19\nlength: 15\n}\n}\nquery_matches {\nstart_char_index: 0\nlength: 6\n}\n}\nsuggestion_type: TEMPLATE\nranking_score: 0.9\n}\nsuggestions {\nsuggestion_info {\nannotated_suggestion {\ntext_formatted: \"item\"\nmarkups {\ntype: DIMENSION\nstart_char_index: 4\nlength: 2\n}\n}\nquery_matches {\nstart_char_index: 0\nlength: 6\n}\n}\nsuggestion_type: ENTITY\nranking_score: 0.8\n}\n` \n**Parameter**\n\n- **version** (::String, ::Symbol) *(defaults to: :v1alpha)* --- The API version to connect to. Optional. Defaults to `:v1alpha`. \n**Returns**\n\n- (::Object) --- A client object for the specified version.\n\n### .auto_suggestion_service_available?\n\n def self.auto_suggestion_service_available?(version: :v1alpha) -\u003e boolean\n\nDetermines whether the AutoSuggestionService service is supported by the current client.\nIf true, you can retrieve a client object by calling [DataQnA.auto_suggestion_service](/ruby/docs/reference/google-cloud-dataqna/latest/Google-Cloud-DataQnA#Google__Cloud__DataQnA_auto_suggestion_service_class_ \"Google::Cloud::DataQnA.auto_suggestion_service (method)\").\nIf false, that method will raise an exception. This could happen if the given\nAPI version does not exist or does not support the AutoSuggestionService service,\nor if the versioned client gem needs an update to support the AutoSuggestionService service. \n**Parameter**\n\n- **version** (::String, ::Symbol) *(defaults to: :v1alpha)* --- The API version to connect to. Optional. Defaults to `:v1alpha`. \n**Returns**\n\n- (boolean) --- Whether the service is available.\n\n### .configure\n\n def self.configure() -\u003e ::Google::Cloud::Config\n\nConfigure the google-cloud-dataqna library.\n\nThe following configuration parameters are supported:\n\n- `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.\n- `lib_name` (*type:* `String`) - The library name as recorded in instrumentation and logging.\n- `lib_version` (*type:* `String`) - The library version as recorded in instrumentation and logging.\n- `interceptors` (*type:* `Array\u003cGRPC::ClientInterceptor\u003e`) - An array of interceptors that are run before calls are executed.\n- `timeout` (*type:* `Numeric`) - Default timeout in seconds.\n- `metadata` (*type:* `Hash{Symbol=\u003eString}`) - Additional headers to be sent with the call.\n- `retry_policy` (*type:* `Hash`) - The retry policy. The value is a hash with the following keys:\n - `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.\n - `:max_delay` (*type:* `Numeric`) - The max delay in seconds.\n - `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.\n- `:retry_codes` (*type:* `Array\u003cString\u003e`) - The error codes that should trigger a retry. \n**Yields**\n\n- (::Google::Cloud.configure.dataqna) \n**Returns**\n\n- (::Google::Cloud::Config) --- The default configuration used by this library\n\n### .question_service\n\n def self.question_service(version: :v1alpha, &block) -\u003e ::Object\n\nCreate a new client object for QuestionService.\n\n\nBy default, this returns an instance of\n[Google::Cloud::DataQnA::V1alpha::QuestionService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-dataqna-v1alpha/latest/Google-Cloud-DataQnA-V1alpha-QuestionService-Client)\nfor a gRPC client for version V1alpha of the API.\nHowever, you can specify a different API version by passing it in the\n`version` parameter. If the QuestionService service is\nsupported by that API version, and the corresponding gem is available, the\nappropriate versioned client will be returned.\n\nRaises an exception if the currently installed versioned client gem for the\ngiven API version does not support the QuestionService service.\nYou can determine whether the method will succeed by calling\n[DataQnA.question_service_available?](/ruby/docs/reference/google-cloud-dataqna/latest/Google-Cloud-DataQnA#Google__Cloud__DataQnA_question_service_available__class_ \"Google::Cloud::DataQnA.question_service_available? (method)\").\n\n#### About QuestionService\n\nService to interpret natural language queries.\nThe service allows to create `Question` resources that are interpreted and\nare filled with one or more interpretations if the question could be\ninterpreted. Once a `Question` resource is created and has at least one\ninterpretation, an interpretation can be chosen for execution, which\ntriggers a query to the backend (for BigQuery, it will create a job).\nUpon successful execution of that interpretation, backend specific\ninformation will be returned so that the client can retrieve the results\nfrom the backend.\n\nThe `Question` resources are named `projects/`*/locations/*`/questions/*`.\n\n\u003cbr /\u003e\n\nThe `Question` resource has a singletion sub-resource `UserFeedback` named\n`projects/`*/locations/*`/questions/*/userFeedback`, which allows access to\nuser feedback. \n**Parameter**\n\n- **version** (::String, ::Symbol) *(defaults to: :v1alpha)* --- The API version to connect to. Optional. Defaults to `:v1alpha`. \n**Returns**\n\n- (::Object) --- A client object for the specified version.\n\n### .question_service_available?\n\n def self.question_service_available?(version: :v1alpha) -\u003e boolean\n\nDetermines whether the QuestionService service is supported by the current client.\nIf true, you can retrieve a client object by calling [DataQnA.question_service](/ruby/docs/reference/google-cloud-dataqna/latest/Google-Cloud-DataQnA#Google__Cloud__DataQnA_question_service_class_ \"Google::Cloud::DataQnA.question_service (method)\").\nIf false, that method will raise an exception. This could happen if the given\nAPI version does not exist or does not support the QuestionService service,\nor if the versioned client gem needs an update to support the QuestionService service. \n**Parameter**\n\n- **version** (::String, ::Symbol) *(defaults to: :v1alpha)* --- The API version to connect to. Optional. Defaults to `:v1alpha`. \n**Returns**\n\n- (boolean) --- Whether the service is available.\n\nConstants\n---------\n\n### VERSION\n\n**value:**\"0.6.1\""]]