Class v1alpha.AutoSuggestionServiceClient (1.0.8)

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 } ``` v1alpha

Package

@google-cloud/data-qna!

Constructors

(constructor)(opts)

constructor(opts?: ClientOptions);

Construct an instance of AutoSuggestionServiceClient.

Parameter
Name Description
opts ClientOptions

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

Property Value
Type Description
string

auth

auth: gax.GoogleAuth;
Property Value
Type Description
gax.GoogleAuth

autoSuggestionServiceStub

autoSuggestionServiceStub?: Promise<{
        [name: string]: Function;
    }>;
Property Value
Type Description
Promise<{ [name: string]: Function; }>

descriptors

descriptors: Descriptors;
Property Value
Type Description
Descriptors

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };
Property Value
Type Description
{ [name: string]: Function; }

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };
Property Value
Type Description
{ [name: string]: gax.PathTemplate; }

port

static get port(): number;

The port for this API service.

Property Value
Type Description
number

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

Property Value
Type Description
string[]

servicePath

static get servicePath(): string;

The DNS address for this API service.

Property Value
Type Description
string

warn

warn: (code: string, message: string, warnType?: string) => void;
Property Value
Type Description
(code: string, message: string, warnType?: string) => void

Methods

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
Type Description
Promise<void>

{Promise} A promise that resolves when the client is closed.

getProjectId()

getProjectId(): Promise<string>;
Returns
Type Description
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name Description
callback Callback<string, undefined, undefined>
Returns
Type Description
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
Type Description
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

locationPath(project, location)

locationPath(project: string, location: string): string;

Return a fully-qualified location resource name string.

Parameters
Name Description
project string
location string
Returns
Type Description
string

{string} Resource name string.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromQuestionName(questionName)

matchLocationFromQuestionName(questionName: string): string | number;

Parse the location from Question resource.

Parameter
Name Description
questionName string

A fully-qualified path representing Question resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromUserFeedbackName(userFeedbackName)

matchLocationFromUserFeedbackName(userFeedbackName: string): string | number;

Parse the location from UserFeedback resource.

Parameter
Name Description
userFeedbackName string

A fully-qualified path representing UserFeedback resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromQuestionName(questionName)

matchProjectFromQuestionName(questionName: string): string | number;

Parse the project from Question resource.

Parameter
Name Description
questionName string

A fully-qualified path representing Question resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromUserFeedbackName(userFeedbackName)

matchProjectFromUserFeedbackName(userFeedbackName: string): string | number;

Parse the project from UserFeedback resource.

Parameter
Name Description
userFeedbackName string

A fully-qualified path representing UserFeedback resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchQuestionFromQuestionName(questionName)

matchQuestionFromQuestionName(questionName: string): string | number;

Parse the question from Question resource.

Parameter
Name Description
questionName string

A fully-qualified path representing Question resource.

Returns
Type Description
string | number

{string} A string representing the question.

matchQuestionFromUserFeedbackName(userFeedbackName)

matchQuestionFromUserFeedbackName(userFeedbackName: string): string | number;

Parse the question from UserFeedback resource.

Parameter
Name Description
userFeedbackName string

A fully-qualified path representing UserFeedback resource.

Returns
Type Description
string | number

{string} A string representing the question.

questionPath(project, location, question)

questionPath(project: string, location: string, question: string): string;

Return a fully-qualified question resource name string.

Parameters
Name Description
project string
location string
question string
Returns
Type Description
string

{string} Resource name string.

suggestQueries(request, options)

suggestQueries(request?: protos.google.cloud.dataqna.v1alpha.ISuggestQueriesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.dataqna.v1alpha.ISuggestQueriesResponse,
        protos.google.cloud.dataqna.v1alpha.ISuggestQueriesRequest | undefined,
        {} | undefined
    ]>;
Parameters
Name Description
request protos.google.cloud.dataqna.v1alpha.ISuggestQueriesRequest
options CallOptions
Returns
Type Description
Promise<[ protos.google.cloud.dataqna.v1alpha.ISuggestQueriesResponse, protos.google.cloud.dataqna.v1alpha.ISuggestQueriesRequest | undefined, {} | undefined ]>

suggestQueries(request, options, callback)

suggestQueries(request: protos.google.cloud.dataqna.v1alpha.ISuggestQueriesRequest, options: CallOptions, callback: Callback<protos.google.cloud.dataqna.v1alpha.ISuggestQueriesResponse, protos.google.cloud.dataqna.v1alpha.ISuggestQueriesRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request protos.google.cloud.dataqna.v1alpha.ISuggestQueriesRequest
options CallOptions
callback Callback<protos.google.cloud.dataqna.v1alpha.ISuggestQueriesResponse, protos.google.cloud.dataqna.v1alpha.ISuggestQueriesRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

suggestQueries(request, callback)

suggestQueries(request: protos.google.cloud.dataqna.v1alpha.ISuggestQueriesRequest, callback: Callback<protos.google.cloud.dataqna.v1alpha.ISuggestQueriesResponse, protos.google.cloud.dataqna.v1alpha.ISuggestQueriesRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request protos.google.cloud.dataqna.v1alpha.ISuggestQueriesRequest
callback Callback<protos.google.cloud.dataqna.v1alpha.ISuggestQueriesResponse, protos.google.cloud.dataqna.v1alpha.ISuggestQueriesRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

userFeedbackPath(project, location, question)

userFeedbackPath(project: string, location: string, question: string): string;

Return a fully-qualified userFeedback resource name string.

Parameters
Name Description
project string
location string
question string
Returns
Type Description
string

{string} Resource name string.