question_service.proto 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.dataqna.v1alpha;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/cloud/dataqna/v1alpha/question.proto";
  21. import "google/cloud/dataqna/v1alpha/user_feedback.proto";
  22. import "google/protobuf/field_mask.proto";
  23. option csharp_namespace = "Google.Cloud.DataQnA.V1Alpha";
  24. option go_package = "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha;dataqna";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "QuestionServiceProto";
  27. option java_package = "com.google.cloud.dataqna.v1alpha";
  28. option php_namespace = "Google\\Cloud\\DataQnA\\V1alpha";
  29. option ruby_package = "Google::Cloud::DataQnA::V1alpha";
  30. // Service to interpret natural language queries.
  31. // The service allows to create `Question` resources that are interpreted and
  32. // are filled with one or more interpretations if the question could be
  33. // interpreted. Once a `Question` resource is created and has at least one
  34. // interpretation, an interpretation can be chosen for execution, which
  35. // triggers a query to the backend (for BigQuery, it will create a job).
  36. // Upon successful execution of that interpretation, backend specific
  37. // information will be returned so that the client can retrieve the results
  38. // from the backend.
  39. //
  40. // The `Question` resources are named `projects/*/locations/*/questions/*`.
  41. //
  42. // The `Question` resource has a singletion sub-resource `UserFeedback` named
  43. // `projects/*/locations/*/questions/*/userFeedback`, which allows access to
  44. // user feedback.
  45. service QuestionService {
  46. option (google.api.default_host) = "dataqna.googleapis.com";
  47. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  48. // Gets a previously created question.
  49. rpc GetQuestion(GetQuestionRequest) returns (Question) {
  50. option (google.api.http) = {
  51. get: "/v1alpha/{name=projects/*/locations/*/questions/*}"
  52. };
  53. option (google.api.method_signature) = "name";
  54. }
  55. // Creates a question.
  56. rpc CreateQuestion(CreateQuestionRequest) returns (Question) {
  57. option (google.api.http) = {
  58. post: "/v1alpha/{parent=projects/*/locations/*}/questions"
  59. body: "question"
  60. };
  61. option (google.api.method_signature) = "parent,question";
  62. }
  63. // Executes an interpretation.
  64. rpc ExecuteQuestion(ExecuteQuestionRequest) returns (Question) {
  65. option (google.api.http) = {
  66. post: "/v1alpha/{name=projects/*/locations/*/questions/*}:execute"
  67. body: "*"
  68. };
  69. option (google.api.method_signature) = "name,interpretation_index";
  70. }
  71. // Gets previously created user feedback.
  72. rpc GetUserFeedback(GetUserFeedbackRequest) returns (UserFeedback) {
  73. option (google.api.http) = {
  74. get: "/v1alpha/{name=projects/*/locations/*/questions/*/userFeedback}"
  75. };
  76. option (google.api.method_signature) = "name";
  77. }
  78. // Updates user feedback. This creates user feedback if there was none before
  79. // (upsert).
  80. rpc UpdateUserFeedback(UpdateUserFeedbackRequest) returns (UserFeedback) {
  81. option (google.api.http) = {
  82. patch: "/v1alpha/{user_feedback.name=projects/*/locations/*/questions/*/userFeedback}"
  83. body: "user_feedback"
  84. };
  85. option (google.api.method_signature) = "user_feedback,update_mask";
  86. }
  87. }
  88. // A request to get a previously created question.
  89. message GetQuestionRequest {
  90. // Required. The unique identifier for the question.
  91. // Example: `projects/foo/locations/bar/questions/1234`
  92. string name = 1 [
  93. (google.api.field_behavior) = REQUIRED,
  94. (google.api.resource_reference) = {
  95. type: "dataqna.googleapis.com/Question"
  96. }
  97. ];
  98. // The list of fields to be retrieved.
  99. google.protobuf.FieldMask read_mask = 2;
  100. }
  101. // Request to create a question resource.
  102. message CreateQuestionRequest {
  103. // Required. The name of the project this data source reference belongs to.
  104. // Example: `projects/foo/locations/bar`
  105. string parent = 1 [
  106. (google.api.field_behavior) = REQUIRED,
  107. (google.api.resource_reference) = {
  108. type: "locations.googleapis.com/Location"
  109. }
  110. ];
  111. // Required. The question to create.
  112. Question question = 2 [(google.api.field_behavior) = REQUIRED];
  113. }
  114. // Request to execute an interpretation.
  115. message ExecuteQuestionRequest {
  116. // Required. The unique identifier for the question.
  117. // Example: `projects/foo/locations/bar/questions/1234`
  118. string name = 1 [(google.api.field_behavior) = REQUIRED];
  119. // Required. Index of the interpretation to execute.
  120. int32 interpretation_index = 2 [(google.api.field_behavior) = REQUIRED];
  121. }
  122. // Request to get user feedback.
  123. message GetUserFeedbackRequest {
  124. // Required. The unique identifier for the user feedback.
  125. // User feedback is a singleton resource on a Question.
  126. // Example: `projects/foo/locations/bar/questions/1234/userFeedback`
  127. string name = 1 [
  128. (google.api.field_behavior) = REQUIRED,
  129. (google.api.resource_reference) = {
  130. type: "dataqna.googleapis.com/UserFeedback"
  131. }
  132. ];
  133. }
  134. // Request to updates user feedback.
  135. message UpdateUserFeedbackRequest {
  136. // Required. The user feedback to update. This can be called even if there is no
  137. // user feedback so far.
  138. // The feedback's name field is used to identify the user feedback (and the
  139. // corresponding question) to update.
  140. UserFeedback user_feedback = 1 [(google.api.field_behavior) = REQUIRED];
  141. // The list of fields to be updated.
  142. google.protobuf.FieldMask update_mask = 2;
  143. }