BigQuery Data QnA V1alpha API - Class Google::Cloud::DataQnA::V1alpha::QuestionService::Client (v0.7.1)

Reference documentation and code samples for the BigQuery Data QnA V1alpha API class Google::Cloud::DataQnA::V1alpha::QuestionService::Client.

Client for the QuestionService service.

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.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the QuestionService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all QuestionService clients
::Google::Cloud::DataQnA::V1alpha::QuestionService::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the QuestionService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_question

def create_question(request, options = nil) -> ::Google::Cloud::DataQnA::V1alpha::Question
def create_question(parent: nil, question: nil) -> ::Google::Cloud::DataQnA::V1alpha::Question

Creates a question.

Overloads
def create_question(request, options = nil) -> ::Google::Cloud::DataQnA::V1alpha::Question
Pass arguments to create_question via a request object, either of type CreateQuestionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DataQnA::V1alpha::CreateQuestionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_question(parent: nil, question: nil) -> ::Google::Cloud::DataQnA::V1alpha::Question
Pass arguments to create_question via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The name of the project this data source reference belongs to. Example: projects/foo/locations/bar
  • question (::Google::Cloud::DataQnA::V1alpha::Question, ::Hash) — Required. The question to create.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataqna/v1alpha"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataQnA::V1alpha::QuestionService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataQnA::V1alpha::CreateQuestionRequest.new

# Call the create_question method.
result = client.create_question request

# The returned object is of type Google::Cloud::DataQnA::V1alpha::Question.
p result

#execute_question

def execute_question(request, options = nil) -> ::Google::Cloud::DataQnA::V1alpha::Question
def execute_question(name: nil, interpretation_index: nil) -> ::Google::Cloud::DataQnA::V1alpha::Question

Executes an interpretation.

Overloads
def execute_question(request, options = nil) -> ::Google::Cloud::DataQnA::V1alpha::Question
Pass arguments to execute_question via a request object, either of type ExecuteQuestionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DataQnA::V1alpha::ExecuteQuestionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def execute_question(name: nil, interpretation_index: nil) -> ::Google::Cloud::DataQnA::V1alpha::Question
Pass arguments to execute_question via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The unique identifier for the question. Example: projects/foo/locations/bar/questions/1234
  • interpretation_index (::Integer) — Required. Index of the interpretation to execute.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataqna/v1alpha"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataQnA::V1alpha::QuestionService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataQnA::V1alpha::ExecuteQuestionRequest.new

# Call the execute_question method.
result = client.execute_question request

# The returned object is of type Google::Cloud::DataQnA::V1alpha::Question.
p result

#get_question

def get_question(request, options = nil) -> ::Google::Cloud::DataQnA::V1alpha::Question
def get_question(name: nil, read_mask: nil) -> ::Google::Cloud::DataQnA::V1alpha::Question

Gets a previously created question.

Overloads
def get_question(request, options = nil) -> ::Google::Cloud::DataQnA::V1alpha::Question
Pass arguments to get_question via a request object, either of type GetQuestionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DataQnA::V1alpha::GetQuestionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_question(name: nil, read_mask: nil) -> ::Google::Cloud::DataQnA::V1alpha::Question
Pass arguments to get_question via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The unique identifier for the question. Example: projects/foo/locations/bar/questions/1234
  • read_mask (::Google::Protobuf::FieldMask, ::Hash) — The list of fields to be retrieved.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataqna/v1alpha"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataQnA::V1alpha::QuestionService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataQnA::V1alpha::GetQuestionRequest.new

# Call the get_question method.
result = client.get_question request

# The returned object is of type Google::Cloud::DataQnA::V1alpha::Question.
p result

#get_user_feedback

def get_user_feedback(request, options = nil) -> ::Google::Cloud::DataQnA::V1alpha::UserFeedback
def get_user_feedback(name: nil) -> ::Google::Cloud::DataQnA::V1alpha::UserFeedback

Gets previously created user feedback.

Overloads
def get_user_feedback(request, options = nil) -> ::Google::Cloud::DataQnA::V1alpha::UserFeedback
Pass arguments to get_user_feedback via a request object, either of type GetUserFeedbackRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DataQnA::V1alpha::GetUserFeedbackRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_user_feedback(name: nil) -> ::Google::Cloud::DataQnA::V1alpha::UserFeedback
Pass arguments to get_user_feedback via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — 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
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataqna/v1alpha"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataQnA::V1alpha::QuestionService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataQnA::V1alpha::GetUserFeedbackRequest.new

# Call the get_user_feedback method.
result = client.get_user_feedback request

# The returned object is of type Google::Cloud::DataQnA::V1alpha::UserFeedback.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new QuestionService client object.

Yields
  • (config) — Configure the QuestionService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::DataQnA::V1alpha::QuestionService::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::DataQnA::V1alpha::QuestionService::Client.new do |config|
  config.timeout = 10.0
end

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_user_feedback

def update_user_feedback(request, options = nil) -> ::Google::Cloud::DataQnA::V1alpha::UserFeedback
def update_user_feedback(user_feedback: nil, update_mask: nil) -> ::Google::Cloud::DataQnA::V1alpha::UserFeedback

Updates user feedback. This creates user feedback if there was none before (upsert).

Overloads
def update_user_feedback(request, options = nil) -> ::Google::Cloud::DataQnA::V1alpha::UserFeedback
Pass arguments to update_user_feedback via a request object, either of type UpdateUserFeedbackRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DataQnA::V1alpha::UpdateUserFeedbackRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_user_feedback(user_feedback: nil, update_mask: nil) -> ::Google::Cloud::DataQnA::V1alpha::UserFeedback
Pass arguments to update_user_feedback via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/dataqna/v1alpha"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataQnA::V1alpha::QuestionService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataQnA::V1alpha::UpdateUserFeedbackRequest.new

# Call the update_user_feedback method.
result = client.update_user_feedback request

# The returned object is of type Google::Cloud::DataQnA::V1alpha::UserFeedback.
p result