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