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.
Name | Description |
opts |
ClientOptions
|
Properties
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
Type | Description |
string |
auth
auth: gax.GoogleAuth;
Type | Description |
gax.GoogleAuth |
autoSuggestionServiceStub
autoSuggestionServiceStub?: Promise<{
[name: string]: Function;
}>;
Type | Description |
Promise<{ [name: string]: Function; }> |
descriptors
descriptors: Descriptors;
Type | Description |
Descriptors |
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
Type | Description |
{ [name: string]: Function; } |
pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};
Type | Description |
{ [name: string]: gax.PathTemplate; } |
port
static get port(): number;
The port for this API service.
Type | Description |
number |
scopes
static get scopes(): string[];
The scopes needed to make gRPC calls for every method defined in this service.
Type | Description |
string[] |
servicePath
static get servicePath(): string;
The DNS address for this API service.
Type | Description |
string |
warn
warn: (code: string, message: string, warnType?: string) => void;
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.
Type | Description |
Promise<void> | {Promise} A promise that resolves when the client is closed. |
getProjectId()
getProjectId(): Promise<string>;
Type | Description |
Promise<string> |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Name | Description |
callback |
Callback<string, undefined, undefined>
|
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.
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.
Name | Description |
project |
string
|
location |
string
|
Type | Description |
string | {string} Resource name string. |
matchLocationFromLocationName(locationName)
matchLocationFromLocationName(locationName: string): string | number;
Parse the location from Location resource.
Name | Description |
locationName |
string
A fully-qualified path representing Location resource. |
Type | Description |
string | number | {string} A string representing the location. |
matchLocationFromQuestionName(questionName)
matchLocationFromQuestionName(questionName: string): string | number;
Parse the location from Question resource.
Name | Description |
questionName |
string
A fully-qualified path representing Question resource. |
Type | Description |
string | number | {string} A string representing the location. |
matchLocationFromUserFeedbackName(userFeedbackName)
matchLocationFromUserFeedbackName(userFeedbackName: string): string | number;
Parse the location from UserFeedback resource.
Name | Description |
userFeedbackName |
string
A fully-qualified path representing UserFeedback resource. |
Type | Description |
string | number | {string} A string representing the location. |
matchProjectFromLocationName(locationName)
matchProjectFromLocationName(locationName: string): string | number;
Parse the project from Location resource.
Name | Description |
locationName |
string
A fully-qualified path representing Location resource. |
Type | Description |
string | number | {string} A string representing the project. |
matchProjectFromQuestionName(questionName)
matchProjectFromQuestionName(questionName: string): string | number;
Parse the project from Question resource.
Name | Description |
questionName |
string
A fully-qualified path representing Question resource. |
Type | Description |
string | number | {string} A string representing the project. |
matchProjectFromUserFeedbackName(userFeedbackName)
matchProjectFromUserFeedbackName(userFeedbackName: string): string | number;
Parse the project from UserFeedback resource.
Name | Description |
userFeedbackName |
string
A fully-qualified path representing UserFeedback resource. |
Type | Description |
string | number | {string} A string representing the project. |
matchQuestionFromQuestionName(questionName)
matchQuestionFromQuestionName(questionName: string): string | number;
Parse the question from Question resource.
Name | Description |
questionName |
string
A fully-qualified path representing Question resource. |
Type | Description |
string | number | {string} A string representing the question. |
matchQuestionFromUserFeedbackName(userFeedbackName)
matchQuestionFromUserFeedbackName(userFeedbackName: string): string | number;
Parse the question from UserFeedback resource.
Name | Description |
userFeedbackName |
string
A fully-qualified path representing UserFeedback resource. |
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.
Name | Description |
project |
string
|
location |
string
|
question |
string
|
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
]>;
Name | Description |
request |
protos.google.cloud.dataqna.v1alpha.ISuggestQueriesRequest
|
options |
CallOptions
|
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;
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>
|
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;
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>
|
Type | Description |
void |
userFeedbackPath(project, location, question)
userFeedbackPath(project: string, location: string, question: string): string;
Return a fully-qualified userFeedback resource name string.
Name | Description |
project |
string
|
location |
string
|
question |
string
|
Type | Description |
string | {string} Resource name string. |