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
NameDescription
opts ClientOptions

Properties

apiEndpoint

static get apiEndpoint(): string;

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

Property Value
TypeDescription
string

auth

auth: gax.GoogleAuth;
Property Value
TypeDescription
gax.GoogleAuth

autoSuggestionServiceStub

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

descriptors

descriptors: Descriptors;
Property Value
TypeDescription
Descriptors

innerApiCalls

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

pathTemplates

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

port

static get port(): number;

The port for this API service.

Property Value
TypeDescription
number

scopes

static get scopes(): string[];

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

Property Value
TypeDescription
string[]

servicePath

static get servicePath(): string;

The DNS address for this API service.

Property Value
TypeDescription
string

warn

warn: (code: string, message: string, warnType?: string) => void;
Property Value
TypeDescription
(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
TypeDescription
Promise<void>

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

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
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
TypeDescription
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
NameDescription
project string
location string
Returns
TypeDescription
string

{string} Resource name string.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromQuestionName(questionName)

matchLocationFromQuestionName(questionName: string): string | number;

Parse the location from Question resource.

Parameter
NameDescription
questionName string

A fully-qualified path representing Question resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromUserFeedbackName(userFeedbackName)

matchLocationFromUserFeedbackName(userFeedbackName: string): string | number;

Parse the location from UserFeedback resource.

Parameter
NameDescription
userFeedbackName string

A fully-qualified path representing UserFeedback resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromQuestionName(questionName)

matchProjectFromQuestionName(questionName: string): string | number;

Parse the project from Question resource.

Parameter
NameDescription
questionName string

A fully-qualified path representing Question resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromUserFeedbackName(userFeedbackName)

matchProjectFromUserFeedbackName(userFeedbackName: string): string | number;

Parse the project from UserFeedback resource.

Parameter
NameDescription
userFeedbackName string

A fully-qualified path representing UserFeedback resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchQuestionFromQuestionName(questionName)

matchQuestionFromQuestionName(questionName: string): string | number;

Parse the question from Question resource.

Parameter
NameDescription
questionName string

A fully-qualified path representing Question resource.

Returns
TypeDescription
string | number

{string} A string representing the question.

matchQuestionFromUserFeedbackName(userFeedbackName)

matchQuestionFromUserFeedbackName(userFeedbackName: string): string | number;

Parse the question from UserFeedback resource.

Parameter
NameDescription
userFeedbackName string

A fully-qualified path representing UserFeedback resource.

Returns
TypeDescription
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
NameDescription
project string
location string
question string
Returns
TypeDescription
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
NameDescription
request protos.google.cloud.dataqna.v1alpha.ISuggestQueriesRequest
options CallOptions
Returns
TypeDescription
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
NameDescription
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
TypeDescription
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
NameDescription
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
TypeDescription
void

userFeedbackPath(project, location, question)

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

Return a fully-qualified userFeedback resource name string.

Parameters
NameDescription
project string
location string
question string
Returns
TypeDescription
string

{string} Resource name string.