xref: /aosp_15_r20/external/googleapis/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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
15syntax = "proto3";
16
17package google.cloud.dialogflow.cx.v3beta1;
18
19import "google/api/resource.proto";
20import "google/cloud/dialogflow/cx/v3beta1/advanced_settings.proto";
21import "google/cloud/dialogflow/cx/v3beta1/response_message.proto";
22import "google/protobuf/struct.proto";
23
24option cc_enable_arenas = true;
25option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1";
26option go_package = "cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb;cxpb";
27option java_multiple_files = true;
28option java_outer_classname = "FulfillmentProto";
29option java_package = "com.google.cloud.dialogflow.cx.v3beta1";
30option objc_class_prefix = "DF";
31option ruby_package = "Google::Cloud::Dialogflow::CX::V3beta1";
32
33// A fulfillment can do one or more of the following actions at the same time:
34//
35//   * Generate rich message responses.
36//   * Set parameter values.
37//   * Call the webhook.
38//
39// Fulfillments can be called at various stages in the
40// [Page][google.cloud.dialogflow.cx.v3beta1.Page] or
41// [Form][google.cloud.dialogflow.cx.v3beta1.Form] lifecycle. For example, when
42// a
43// [DetectIntentRequest][google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest]
44// drives a session to enter a new page, the page's entry fulfillment can add a
45// static response to the
46// [QueryResult][google.cloud.dialogflow.cx.v3beta1.QueryResult] in the
47// returning
48// [DetectIntentResponse][google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse],
49// call the webhook (for example, to load user data from a database), or both.
50message Fulfillment {
51  // Setting a parameter value.
52  message SetParameterAction {
53    // Display name of the parameter.
54    string parameter = 1;
55
56    // The new value of the parameter. A null value clears the parameter.
57    google.protobuf.Value value = 2;
58  }
59
60  // A list of cascading if-else conditions. Cases are mutually exclusive.
61  // The first one with a matching condition is selected, all the rest ignored.
62  message ConditionalCases {
63    // Each case has a Boolean condition. When it is evaluated to be True, the
64    // corresponding messages will be selected and evaluated recursively.
65    message Case {
66      // The list of messages or conditional cases to activate for this case.
67      message CaseContent {
68        // Either a message is returned or additional cases to be evaluated.
69        oneof cases_or_message {
70          // Returned message.
71          ResponseMessage message = 1;
72
73          // Additional cases to be evaluated.
74          ConditionalCases additional_cases = 2;
75        }
76      }
77
78      // The condition to activate and select this case. Empty means the
79      // condition is always true. The condition is evaluated against [form
80      // parameters][Form.parameters] or [session
81      // parameters][SessionInfo.parameters].
82      //
83      // See the [conditions
84      // reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition).
85      string condition = 1;
86
87      // A list of case content.
88      repeated CaseContent case_content = 2;
89    }
90
91    // A list of cascading if-else conditions.
92    repeated Case cases = 1;
93  }
94
95  // The list of rich message responses to present to the user.
96  repeated ResponseMessage messages = 1;
97
98  // The webhook to call.
99  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
100  // ID>/webhooks/<Webhook ID>`.
101  string webhook = 2 [(google.api.resource_reference) = {
102    type: "dialogflow.googleapis.com/Webhook"
103  }];
104
105  // Whether Dialogflow should return currently queued fulfillment response
106  // messages in streaming APIs. If a webhook is specified, it happens before
107  // Dialogflow invokes webhook.
108  // Warning:
109  // 1) This flag only affects streaming API. Responses are still queued
110  // and returned once in non-streaming API.
111  // 2) The flag can be enabled in any fulfillment but only the first 3 partial
112  // responses will be returned. You may only want to apply it to fulfillments
113  // that have slow webhooks.
114  bool return_partial_responses = 8;
115
116  // The value of this field will be populated in the
117  // [WebhookRequest][google.cloud.dialogflow.cx.v3beta1.WebhookRequest]
118  // `fulfillmentInfo.tag` field by Dialogflow when the associated webhook is
119  // called.
120  // The tag is typically used by the webhook service to identify which
121  // fulfillment is being called, but it could be used for other purposes.
122  // This field is required if `webhook` is specified.
123  string tag = 3;
124
125  // Set parameter values before executing the webhook.
126  repeated SetParameterAction set_parameter_actions = 4;
127
128  // Conditional cases for this fulfillment.
129  repeated ConditionalCases conditional_cases = 5;
130
131  // Hierarchical advanced settings for this fulfillment. The settings exposed
132  // at the lower level overrides the settings exposed at the higher level.
133  AdvancedSettings advanced_settings = 7;
134
135  // If the flag is true, the agent will utilize LLM to generate a text
136  // response. If LLM generation fails, the defined
137  // [responses][google.cloud.dialogflow.cx.v3beta1.Fulfillment.messages] in the
138  // fulfillment will be respected. This flag is only useful for fulfillments
139  // associated with no-match event handlers.
140  bool enable_generative_fallback = 12;
141}
142