fulfillment.proto 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // Copyright 2021 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.dialogflow.cx.v3;
  16. import "google/api/resource.proto";
  17. import "google/cloud/dialogflow/cx/v3/advanced_settings.proto";
  18. import "google/cloud/dialogflow/cx/v3/response_message.proto";
  19. import "google/protobuf/struct.proto";
  20. import "google/api/annotations.proto";
  21. option cc_enable_arenas = true;
  22. option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3";
  23. option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3;cx";
  24. option java_multiple_files = true;
  25. option java_outer_classname = "FulfillmentProto";
  26. option java_package = "com.google.cloud.dialogflow.cx.v3";
  27. option objc_class_prefix = "DF";
  28. // A fulfillment can do one or more of the following actions at the same time:
  29. //
  30. // * Generate rich message responses.
  31. // * Set parameter values.
  32. // * Call the webhook.
  33. //
  34. // Fulfillments can be called at various stages in the [Page][google.cloud.dialogflow.cx.v3.Page] or
  35. // [Form][google.cloud.dialogflow.cx.v3.Form] lifecycle. For example, when a [DetectIntentRequest][google.cloud.dialogflow.cx.v3.DetectIntentRequest] drives a
  36. // session to enter a new page, the page's entry fulfillment can add a static
  37. // response to the [QueryResult][google.cloud.dialogflow.cx.v3.QueryResult] in the returning [DetectIntentResponse][google.cloud.dialogflow.cx.v3.DetectIntentResponse],
  38. // call the webhook (for example, to load user data from a database), or both.
  39. message Fulfillment {
  40. // Setting a parameter value.
  41. message SetParameterAction {
  42. // Display name of the parameter.
  43. string parameter = 1;
  44. // The new value of the parameter. A null value clears the parameter.
  45. google.protobuf.Value value = 2;
  46. }
  47. // A list of cascading if-else conditions. Cases are mutually exclusive.
  48. // The first one with a matching condition is selected, all the rest ignored.
  49. message ConditionalCases {
  50. // Each case has a Boolean condition. When it is evaluated to be True, the
  51. // corresponding messages will be selected and evaluated recursively.
  52. message Case {
  53. // The list of messages or conditional cases to activate for this case.
  54. message CaseContent {
  55. // Either a message is returned or additional cases to be evaluated.
  56. oneof cases_or_message {
  57. // Returned message.
  58. ResponseMessage message = 1;
  59. // Additional cases to be evaluated.
  60. ConditionalCases additional_cases = 2;
  61. }
  62. }
  63. // The condition to activate and select this case. Empty means the
  64. // condition is always true. The condition is evaluated against [form
  65. // parameters][Form.parameters] or [session
  66. // parameters][SessionInfo.parameters].
  67. //
  68. // See the [conditions
  69. // reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition).
  70. string condition = 1;
  71. // A list of case content.
  72. repeated CaseContent case_content = 2;
  73. }
  74. // A list of cascading if-else conditions.
  75. repeated Case cases = 1;
  76. }
  77. // The list of rich message responses to present to the user.
  78. repeated ResponseMessage messages = 1;
  79. // The webhook to call.
  80. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  81. // ID>/webhooks/<Webhook ID>`.
  82. string webhook = 2 [(google.api.resource_reference) = {
  83. type: "dialogflow.googleapis.com/Webhook"
  84. }];
  85. // Whether Dialogflow should return currently queued fulfillment response
  86. // messages in streaming APIs. If a webhook is specified, it happens before
  87. // Dialogflow invokes webhook.
  88. // Warning:
  89. // 1) This flag only affects streaming API. Responses are still queued
  90. // and returned once in non-streaming API.
  91. // 2) The flag can be enabled in any fulfillment but only the first 3 partial
  92. // responses will be returned. You may only want to apply it to fulfillments
  93. // that have slow webhooks.
  94. bool return_partial_responses = 8;
  95. // The tag used by the webhook to identify which fulfillment is being called.
  96. // This field is required if `webhook` is specified.
  97. string tag = 3;
  98. // Set parameter values before executing the webhook.
  99. repeated SetParameterAction set_parameter_actions = 4;
  100. // Conditional cases for this fulfillment.
  101. repeated ConditionalCases conditional_cases = 5;
  102. }