session.proto 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878
  1. // Copyright 2022 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.v3beta1;
  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/dialogflow/cx/v3beta1/audio_config.proto";
  21. import "google/cloud/dialogflow/cx/v3beta1/intent.proto";
  22. import "google/cloud/dialogflow/cx/v3beta1/page.proto";
  23. import "google/cloud/dialogflow/cx/v3beta1/response_message.proto";
  24. import "google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto";
  25. import "google/protobuf/duration.proto";
  26. import "google/protobuf/struct.proto";
  27. import "google/rpc/status.proto";
  28. import "google/type/latlng.proto";
  29. option cc_enable_arenas = true;
  30. option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1";
  31. option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx";
  32. option java_multiple_files = true;
  33. option java_outer_classname = "SessionProto";
  34. option java_package = "com.google.cloud.dialogflow.cx.v3beta1";
  35. option objc_class_prefix = "DF";
  36. option ruby_package = "Google::Cloud::Dialogflow::CX::V3beta1";
  37. option (google.api.resource_definition) = {
  38. type: "dialogflow.googleapis.com/Session"
  39. pattern: "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}"
  40. pattern: "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}"
  41. };
  42. // A session represents an interaction with a user. You retrieve user input
  43. // and pass it to the [DetectIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.DetectIntent] method to determine
  44. // user intent and respond.
  45. service Sessions {
  46. option (google.api.default_host) = "dialogflow.googleapis.com";
  47. option (google.api.oauth_scopes) =
  48. "https://www.googleapis.com/auth/cloud-platform,"
  49. "https://www.googleapis.com/auth/dialogflow";
  50. // Processes a natural language query and returns structured, actionable data
  51. // as a result. This method is not idempotent, because it may cause session
  52. // entity types to be updated, which in turn might affect results of future
  53. // queries.
  54. //
  55. // Note: Always use agent versions for production traffic.
  56. // See [Versions and
  57. // environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
  58. rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse) {
  59. option (google.api.http) = {
  60. post: "/v3beta1/{session=projects/*/locations/*/agents/*/sessions/*}:detectIntent"
  61. body: "*"
  62. additional_bindings {
  63. post: "/v3beta1/{session=projects/*/locations/*/agents/*/environments/*/sessions/*}:detectIntent"
  64. body: "*"
  65. }
  66. };
  67. }
  68. // Processes a natural language query in audio format in a streaming fashion
  69. // and returns structured, actionable data as a result. This method is only
  70. // available via the gRPC API (not REST).
  71. //
  72. // Note: Always use agent versions for production traffic.
  73. // See [Versions and
  74. // environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
  75. rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) returns (stream StreamingDetectIntentResponse) {
  76. }
  77. // Returns preliminary intent match results, doesn't change the session
  78. // status.
  79. rpc MatchIntent(MatchIntentRequest) returns (MatchIntentResponse) {
  80. option (google.api.http) = {
  81. post: "/v3beta1/{session=projects/*/locations/*/agents/*/sessions/*}:matchIntent"
  82. body: "*"
  83. additional_bindings {
  84. post: "/v3beta1/{session=projects/*/locations/*/agents/*/environments/*/sessions/*}:matchIntent"
  85. body: "*"
  86. }
  87. };
  88. }
  89. // Fulfills a matched intent returned by [MatchIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntent].
  90. // Must be called after [MatchIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntent], with input from
  91. // [MatchIntentResponse][google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse]. Otherwise, the behavior is undefined.
  92. rpc FulfillIntent(FulfillIntentRequest) returns (FulfillIntentResponse) {
  93. option (google.api.http) = {
  94. post: "/v3beta1/{match_intent_request.session=projects/*/locations/*/agents/*/sessions/*}:fulfillIntent"
  95. body: "*"
  96. additional_bindings {
  97. post: "/v3beta1/{match_intent_request.session=projects/*/locations/*/agents/*/environments/*/sessions/*}:fulfillIntent"
  98. body: "*"
  99. }
  100. };
  101. }
  102. }
  103. // The request to detect user's intent.
  104. message DetectIntentRequest {
  105. // Required. The name of the session this query is sent to.
  106. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  107. // ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location
  108. // ID>/agents/<Agent ID>/environments/<Environment ID>/sessions/<Session ID>`.
  109. // If `Environment ID` is not specified, we assume default 'draft'
  110. // environment.
  111. // It's up to the API caller to choose an appropriate `Session ID`. It can be
  112. // a random number or some type of session identifiers (preferably hashed).
  113. // The length of the `Session ID` must not exceed 36 characters.
  114. //
  115. // For more information, see the [sessions
  116. // guide](https://cloud.google.com/dialogflow/cx/docs/concept/session).
  117. //
  118. // Note: Always use agent versions for production traffic.
  119. // See [Versions and
  120. // environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
  121. string session = 1 [
  122. (google.api.field_behavior) = REQUIRED,
  123. (google.api.resource_reference) = {
  124. type: "dialogflow.googleapis.com/Session"
  125. }
  126. ];
  127. // The parameters of this query.
  128. QueryParameters query_params = 2;
  129. // Required. The input specification.
  130. QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED];
  131. // Instructs the speech synthesizer how to generate the output audio.
  132. OutputAudioConfig output_audio_config = 4;
  133. }
  134. // The message returned from the DetectIntent method.
  135. message DetectIntentResponse {
  136. // Represents different DetectIntentResponse types.
  137. enum ResponseType {
  138. // Not specified. This should never happen.
  139. RESPONSE_TYPE_UNSPECIFIED = 0;
  140. // Partial response. e.g. Aggregated responses in a Fulfillment that enables
  141. // `return_partial_response` can be returned as partial response.
  142. // WARNING: partial response is not eligible for barge-in.
  143. PARTIAL = 1;
  144. // Final response.
  145. FINAL = 2;
  146. }
  147. // Output only. The unique identifier of the response. It can be used to
  148. // locate a response in the training example set or for reporting issues.
  149. string response_id = 1;
  150. // The result of the conversational query.
  151. QueryResult query_result = 2;
  152. // The audio data bytes encoded as specified in the request.
  153. // Note: The output audio is generated based on the values of default platform
  154. // text responses found in the
  155. // [`query_result.response_messages`][google.cloud.dialogflow.cx.v3beta1.QueryResult.response_messages] field. If
  156. // multiple default text responses exist, they will be concatenated when
  157. // generating audio. If no default platform text responses exist, the
  158. // generated audio content will be empty.
  159. //
  160. // In some scenarios, multiple output audio fields may be present in the
  161. // response structure. In these cases, only the top-most-level audio output
  162. // has content.
  163. bytes output_audio = 4;
  164. // The config used by the speech synthesizer to generate the output audio.
  165. OutputAudioConfig output_audio_config = 5;
  166. // Response type.
  167. ResponseType response_type = 6;
  168. // Indicates whether the partial response can be cancelled when a later
  169. // response arrives. e.g. if the agent specified some music as partial
  170. // response, it can be cancelled.
  171. bool allow_cancellation = 7;
  172. }
  173. // The top-level message sent by the client to the
  174. // [Sessions.StreamingDetectIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.StreamingDetectIntent] method.
  175. //
  176. // Multiple request messages should be sent in order:
  177. //
  178. // 1. The first message must contain
  179. // [session][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.session],
  180. // [query_input][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_input] plus optionally
  181. // [query_params][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_params]. If the client
  182. // wants to receive an audio response, it should also contain
  183. // [output_audio_config][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.output_audio_config].
  184. //
  185. // 2. If [query_input][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_input] was set to
  186. // [query_input.audio.config][google.cloud.dialogflow.cx.v3beta1.AudioInput.config], all subsequent messages
  187. // must contain [query_input.audio.audio][google.cloud.dialogflow.cx.v3beta1.AudioInput.audio] to continue with
  188. // Speech recognition.
  189. // If you decide to rather detect an intent from text
  190. // input after you already started Speech recognition, please send a message
  191. // with [query_input.text][google.cloud.dialogflow.cx.v3beta1.QueryInput.text].
  192. //
  193. // However, note that:
  194. //
  195. // * Dialogflow will bill you for the audio duration so far.
  196. // * Dialogflow discards all Speech recognition results in favor of the
  197. // input text.
  198. // * Dialogflow will use the language code from the first message.
  199. //
  200. // After you sent all input, you must half-close or abort the request stream.
  201. message StreamingDetectIntentRequest {
  202. // The name of the session this query is sent to.
  203. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  204. // ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location
  205. // ID>/agents/<Agent ID>/environments/<Environment ID>/sessions/<Session ID>`.
  206. // If `Environment ID` is not specified, we assume default 'draft'
  207. // environment.
  208. // It's up to the API caller to choose an appropriate `Session ID`. It can be
  209. // a random number or some type of session identifiers (preferably hashed).
  210. // The length of the `Session ID` must not exceed 36 characters.
  211. // Note: session must be set in the first request.
  212. //
  213. // For more information, see the [sessions
  214. // guide](https://cloud.google.com/dialogflow/cx/docs/concept/session).
  215. //
  216. // Note: Always use agent versions for production traffic.
  217. // See [Versions and
  218. // environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
  219. string session = 1 [(google.api.resource_reference) = {
  220. type: "dialogflow.googleapis.com/Session"
  221. }];
  222. // The parameters of this query.
  223. QueryParameters query_params = 2;
  224. // Required. The input specification.
  225. QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED];
  226. // Instructs the speech synthesizer how to generate the output audio.
  227. OutputAudioConfig output_audio_config = 4;
  228. // Enable partial detect intent response. If this flag is not enabled,
  229. // response stream still contains only one final `DetectIntentResponse` even
  230. // if some `Fulfillment`s in the agent have been configured to return partial
  231. // responses.
  232. bool enable_partial_response = 5;
  233. }
  234. // The top-level message returned from the
  235. // [StreamingDetectIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.StreamingDetectIntent] method.
  236. //
  237. // Multiple response messages (N) can be returned in order.
  238. //
  239. // The first (N-1) responses set either the `recognition_result` or
  240. // `detect_intent_response` field, depending on the request:
  241. //
  242. // * If the `StreamingDetectIntentRequest.query_input.audio` field was
  243. // set, and the `StreamingDetectIntentRequest.enable_partial_response`
  244. // field was false, the `recognition_result` field is populated for each
  245. // of the (N-1) responses.
  246. // See the [StreamingRecognitionResult][google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult] message for details
  247. // about the result message sequence.
  248. //
  249. // * If the `StreamingDetectIntentRequest.enable_partial_response` field was
  250. // true, the `detect_intent_response` field is populated for each
  251. // of the (N-1) responses, where 1 <= N <= 4.
  252. // These responses set the [DetectIntentResponse.response_type][google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse.response_type] field
  253. // to `PARTIAL`.
  254. //
  255. // For the final Nth response message, the `detect_intent_response` is fully
  256. // populated, and [DetectIntentResponse.response_type][google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse.response_type] is set to `FINAL`.
  257. message StreamingDetectIntentResponse {
  258. // The output response.
  259. oneof response {
  260. // The result of speech recognition.
  261. StreamingRecognitionResult recognition_result = 1;
  262. // The response from detect intent.
  263. DetectIntentResponse detect_intent_response = 2;
  264. }
  265. }
  266. // Contains a speech recognition result corresponding to a portion of the audio
  267. // that is currently being processed or an indication that this is the end
  268. // of the single requested utterance.
  269. //
  270. // While end-user audio is being processed, Dialogflow sends a series of
  271. // results. Each result may contain a `transcript` value. A transcript
  272. // represents a portion of the utterance. While the recognizer is processing
  273. // audio, transcript values may be interim values or finalized values.
  274. // Once a transcript is finalized, the `is_final` value is set to true and
  275. // processing continues for the next transcript.
  276. //
  277. // If `StreamingDetectIntentRequest.query_input.audio.config.single_utterance`
  278. // was true, and the recognizer has completed processing audio,
  279. // the `message_type` value is set to `END_OF_SINGLE_UTTERANCE and the
  280. // following (last) result contains the last finalized transcript.
  281. //
  282. // The complete end-user utterance is determined by concatenating the
  283. // finalized transcript values received for the series of results.
  284. //
  285. // In the following example, single utterance is enabled. In the case where
  286. // single utterance is not enabled, result 7 would not occur.
  287. //
  288. // ```
  289. // Num | transcript | message_type | is_final
  290. // --- | ----------------------- | ----------------------- | --------
  291. // 1 | "tube" | TRANSCRIPT | false
  292. // 2 | "to be a" | TRANSCRIPT | false
  293. // 3 | "to be" | TRANSCRIPT | false
  294. // 4 | "to be or not to be" | TRANSCRIPT | true
  295. // 5 | "that's" | TRANSCRIPT | false
  296. // 6 | "that is | TRANSCRIPT | false
  297. // 7 | unset | END_OF_SINGLE_UTTERANCE | unset
  298. // 8 | " that is the question" | TRANSCRIPT | true
  299. // ```
  300. //
  301. // Concatenating the finalized transcripts with `is_final` set to true,
  302. // the complete utterance becomes "to be or not to be that is the question".
  303. message StreamingRecognitionResult {
  304. // Type of the response message.
  305. enum MessageType {
  306. // Not specified. Should never be used.
  307. MESSAGE_TYPE_UNSPECIFIED = 0;
  308. // Message contains a (possibly partial) transcript.
  309. TRANSCRIPT = 1;
  310. // Event indicates that the server has detected the end of the user's speech
  311. // utterance and expects no additional speech. Therefore, the server will
  312. // not process additional audio (although it may subsequently return
  313. // additional results). The client should stop sending additional audio
  314. // data, half-close the gRPC connection, and wait for any additional results
  315. // until the server closes the gRPC connection. This message is only sent if
  316. // [`single_utterance`][google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.single_utterance] was set to
  317. // `true`, and is not used otherwise.
  318. END_OF_SINGLE_UTTERANCE = 2;
  319. }
  320. // Type of the result message.
  321. MessageType message_type = 1;
  322. // Transcript text representing the words that the user spoke.
  323. // Populated if and only if `message_type` = `TRANSCRIPT`.
  324. string transcript = 2;
  325. // If `false`, the `StreamingRecognitionResult` represents an
  326. // interim result that may change. If `true`, the recognizer will not return
  327. // any further hypotheses about this piece of the audio. May only be populated
  328. // for `message_type` = `TRANSCRIPT`.
  329. bool is_final = 3;
  330. // The Speech confidence between 0.0 and 1.0 for the current portion of audio.
  331. // A higher number indicates an estimated greater likelihood that the
  332. // recognized words are correct. The default of 0.0 is a sentinel value
  333. // indicating that confidence was not set.
  334. //
  335. // This field is typically only provided if `is_final` is true and you should
  336. // not rely on it being accurate or even set.
  337. float confidence = 4;
  338. // An estimate of the likelihood that the speech recognizer will
  339. // not change its guess about this interim recognition result:
  340. // * If the value is unspecified or 0.0, Dialogflow didn't compute the
  341. // stability. In particular, Dialogflow will only provide stability for
  342. // `TRANSCRIPT` results with `is_final = false`.
  343. // * Otherwise, the value is in (0.0, 1.0] where 0.0 means completely
  344. // unstable and 1.0 means completely stable.
  345. float stability = 6;
  346. // Word-specific information for the words recognized by Speech in
  347. // [transcript][google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.transcript]. Populated if and only if `message_type` = `TRANSCRIPT` and
  348. // [InputAudioConfig.enable_word_info] is set.
  349. repeated SpeechWordInfo speech_word_info = 7;
  350. // Time offset of the end of this Speech recognition result relative to the
  351. // beginning of the audio. Only populated for `message_type` =
  352. // `TRANSCRIPT`.
  353. google.protobuf.Duration speech_end_offset = 8;
  354. // Detected language code for the transcript.
  355. string language_code = 10;
  356. }
  357. // Represents the parameters of a conversational query.
  358. message QueryParameters {
  359. // The time zone of this conversational query from the [time zone
  360. // database](https://www.iana.org/time-zones), e.g., America/New_York,
  361. // Europe/Paris. If not provided, the time zone specified in the agent is
  362. // used.
  363. string time_zone = 1;
  364. // The geo location of this conversational query.
  365. google.type.LatLng geo_location = 2;
  366. // Additional session entity types to replace or extend developer entity types
  367. // with. The entity synonyms apply to all languages and persist for the
  368. // session of this query.
  369. repeated SessionEntityType session_entity_types = 3;
  370. // This field can be used to pass custom data into the webhook associated with
  371. // the agent. Arbitrary JSON objects are supported.
  372. // Some integrations that query a Dialogflow agent may provide additional
  373. // information in the payload.
  374. // In particular, for the Dialogflow Phone Gateway integration, this field has
  375. // the form:
  376. // ```
  377. // {
  378. // "telephony": {
  379. // "caller_id": "+18558363987"
  380. // }
  381. // }
  382. // ```
  383. google.protobuf.Struct payload = 4;
  384. // Additional parameters to be put into [session
  385. // parameters][SessionInfo.parameters]. To remove a
  386. // parameter from the session, clients should explicitly set the parameter
  387. // value to null.
  388. //
  389. // You can reference the session parameters in the agent with the following
  390. // format: $session.params.parameter-id.
  391. //
  392. // Depending on your protocol or client library language, this is a
  393. // map, associative array, symbol table, dictionary, or JSON object
  394. // composed of a collection of (MapKey, MapValue) pairs:
  395. //
  396. // * MapKey type: string
  397. // * MapKey value: parameter name
  398. // * MapValue type: If parameter's entity type is a composite entity then use
  399. // map, otherwise, depending on the parameter value type, it could be one of
  400. // string, number, boolean, null, list or map.
  401. // * MapValue value: If parameter's entity type is a composite entity then use
  402. // map from composite entity property names to property values, otherwise,
  403. // use parameter value.
  404. google.protobuf.Struct parameters = 5;
  405. // The unique identifier of the [page][google.cloud.dialogflow.cx.v3beta1.Page] to override the [current
  406. // page][QueryResult.current_page] in the session.
  407. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  408. // ID>/flows/<Flow ID>/pages/<Page ID>`.
  409. //
  410. // If `current_page` is specified, the previous state of the session will be
  411. // ignored by Dialogflow, including the [previous
  412. // page][QueryResult.current_page] and the [previous session
  413. // parameters][QueryResult.parameters].
  414. // In most cases, [current_page][google.cloud.dialogflow.cx.v3beta1.QueryParameters.current_page] and
  415. // [parameters][google.cloud.dialogflow.cx.v3beta1.QueryParameters.parameters] should be configured together to
  416. // direct a session to a specific state.
  417. string current_page = 6 [(google.api.resource_reference) = {
  418. type: "dialogflow.googleapis.com/Page"
  419. }];
  420. // Whether to disable webhook calls for this request.
  421. bool disable_webhook = 7;
  422. // Configures whether sentiment analysis should be performed. If not
  423. // provided, sentiment analysis is not performed.
  424. bool analyze_query_text_sentiment = 8;
  425. // This field can be used to pass HTTP headers for a webhook
  426. // call. These headers will be sent to webhook along with the headers that
  427. // have been configured through Dialogflow web console. The headers defined
  428. // within this field will overwrite the headers configured through Dialogflow
  429. // console if there is a conflict. Header names are case-insensitive.
  430. // Google's specified headers are not allowed. Including: "Host",
  431. // "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding",
  432. // "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc.
  433. map<string, string> webhook_headers = 10;
  434. // A list of flow versions to override for the request.
  435. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  436. // ID>/flows/<Flow ID>/versions/<Version ID>`.
  437. //
  438. // If version 1 of flow X is included in this list, the traffic of
  439. // flow X will go through version 1 regardless of the version configuration in
  440. // the environment. Each flow can have at most one version specified in this
  441. // list.
  442. repeated string flow_versions = 14 [(google.api.resource_reference) = {
  443. type: "dialogflow.googleapis.com/Version"
  444. }];
  445. }
  446. // Represents the query input. It can contain one of:
  447. //
  448. // 1. A conversational query in the form of text.
  449. //
  450. // 2. An intent query that specifies which intent to trigger.
  451. //
  452. // 3. Natural language speech audio to be processed.
  453. //
  454. // 4. An event to be triggered.
  455. //
  456. message QueryInput {
  457. // Required. The input specification.
  458. oneof input {
  459. // The natural language text to be processed.
  460. TextInput text = 2;
  461. // The intent to be triggered.
  462. IntentInput intent = 3;
  463. // The natural language speech audio to be processed.
  464. AudioInput audio = 5;
  465. // The event to be triggered.
  466. EventInput event = 6;
  467. // The DTMF event to be handled.
  468. DtmfInput dtmf = 7;
  469. }
  470. // Required. The language of the input. See [Language
  471. // Support](https://cloud.google.com/dialogflow/cx/docs/reference/language)
  472. // for a list of the currently supported language codes. Note that queries in
  473. // the same session do not necessarily need to specify the same language.
  474. string language_code = 4 [(google.api.field_behavior) = REQUIRED];
  475. }
  476. // Represents the result of a conversational query.
  477. message QueryResult {
  478. // The original conversational query.
  479. oneof query {
  480. // If [natural language text][google.cloud.dialogflow.cx.v3beta1.TextInput] was provided as input, this field
  481. // will contain a copy of the text.
  482. string text = 1;
  483. // If an [intent][google.cloud.dialogflow.cx.v3beta1.IntentInput] was provided as input, this field will
  484. // contain a copy of the intent identifier.
  485. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  486. // ID>/intents/<Intent ID>`.
  487. string trigger_intent = 11 [(google.api.resource_reference) = {
  488. type: "dialogflow.googleapis.com/Intent"
  489. }];
  490. // If [natural language speech audio][google.cloud.dialogflow.cx.v3beta1.AudioInput] was provided as input,
  491. // this field will contain the transcript for the audio.
  492. string transcript = 12;
  493. // If an [event][google.cloud.dialogflow.cx.v3beta1.EventInput] was provided as input, this field will contain
  494. // the name of the event.
  495. string trigger_event = 14;
  496. // If a [DTMF][DTMFInput] was provided as input, this field will contain
  497. // a copy of the [DTMFInput][].
  498. DtmfInput dtmf = 23;
  499. }
  500. // The language that was triggered during intent detection.
  501. // See [Language
  502. // Support](https://cloud.google.com/dialogflow/cx/docs/reference/language)
  503. // for a list of the currently supported language codes.
  504. string language_code = 2;
  505. // The collected [session parameters][google.cloud.dialogflow.cx.v3beta1.SessionInfo.parameters].
  506. //
  507. // Depending on your protocol or client library language, this is a
  508. // map, associative array, symbol table, dictionary, or JSON object
  509. // composed of a collection of (MapKey, MapValue) pairs:
  510. //
  511. // * MapKey type: string
  512. // * MapKey value: parameter name
  513. // * MapValue type: If parameter's entity type is a composite entity then use
  514. // map, otherwise, depending on the parameter value type, it could be one of
  515. // string, number, boolean, null, list or map.
  516. // * MapValue value: If parameter's entity type is a composite entity then use
  517. // map from composite entity property names to property values, otherwise,
  518. // use parameter value.
  519. google.protobuf.Struct parameters = 3;
  520. // The list of rich messages returned to the client. Responses vary from
  521. // simple text messages to more sophisticated, structured payloads used
  522. // to drive complex logic.
  523. repeated ResponseMessage response_messages = 4;
  524. // The list of webhook call status in the order of call sequence.
  525. repeated google.rpc.Status webhook_statuses = 13;
  526. // The list of webhook payload in [WebhookResponse.payload][google.cloud.dialogflow.cx.v3beta1.WebhookResponse.payload], in
  527. // the order of call sequence. If some webhook call fails or doesn't return
  528. // any payload, an empty `Struct` would be used instead.
  529. repeated google.protobuf.Struct webhook_payloads = 6;
  530. // The current [Page][google.cloud.dialogflow.cx.v3beta1.Page]. Some, not all fields are filled in this message,
  531. // including but not limited to `name` and `display_name`.
  532. Page current_page = 7;
  533. // The [Intent][google.cloud.dialogflow.cx.v3beta1.Intent] that matched the conversational query. Some, not all fields
  534. // are filled in this message, including but not limited to: `name` and
  535. // `display_name`.
  536. // This field is deprecated, please use [QueryResult.match][google.cloud.dialogflow.cx.v3beta1.QueryResult.match] instead.
  537. Intent intent = 8 [deprecated = true];
  538. // The intent detection confidence. Values range from 0.0 (completely
  539. // uncertain) to 1.0 (completely certain).
  540. // This value is for informational purpose only and is only used to
  541. // help match the best intent within the classification threshold.
  542. // This value may change for the same end-user expression at any time due to a
  543. // model retraining or change in implementation.
  544. // This field is deprecated, please use [QueryResult.match][google.cloud.dialogflow.cx.v3beta1.QueryResult.match] instead.
  545. float intent_detection_confidence = 9 [deprecated = true];
  546. // Intent match result, could be an intent or an event.
  547. Match match = 15;
  548. // The free-form diagnostic info. For example, this field could contain
  549. // webhook call latency. The fields of this data can change without notice,
  550. // so you should not write code that depends on its structure.
  551. //
  552. // One of the fields is called "Alternative Matched Intents", which may
  553. // aid with debugging. The following describes these intent results:
  554. //
  555. // - The list is empty if no intent was matched to end-user input.
  556. // - Only intents that are referenced in the currently active flow are
  557. // included.
  558. // - The matched intent is included.
  559. // - Other intents that could have matched end-user input, but did not match
  560. // because they are referenced by intent routes that are out of
  561. // [scope](https://cloud.google.com/dialogflow/cx/docs/concept/handler#scope),
  562. // are included.
  563. // - Other intents referenced by intent routes in scope that matched end-user
  564. // input, but had a lower confidence score.
  565. google.protobuf.Struct diagnostic_info = 10;
  566. // The sentiment analyss result, which depends on
  567. // [`analyze_query_text_sentiment`]
  568. // [google.cloud.dialogflow.cx.v3beta1.QueryParameters.analyze_query_text_sentiment], specified in the request.
  569. SentimentAnalysisResult sentiment_analysis_result = 17;
  570. }
  571. // Represents the natural language text to be processed.
  572. message TextInput {
  573. // Required. The UTF-8 encoded natural language text to be processed. Text length must
  574. // not exceed 256 characters.
  575. string text = 1 [(google.api.field_behavior) = REQUIRED];
  576. }
  577. // Represents the intent to trigger programmatically rather than as a result of
  578. // natural language processing.
  579. message IntentInput {
  580. // Required. The unique identifier of the intent.
  581. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  582. // ID>/intents/<Intent ID>`.
  583. string intent = 1 [
  584. (google.api.field_behavior) = REQUIRED,
  585. (google.api.resource_reference) = {
  586. type: "dialogflow.googleapis.com/Intent"
  587. }
  588. ];
  589. }
  590. // Represents the natural speech audio to be processed.
  591. message AudioInput {
  592. // Required. Instructs the speech recognizer how to process the speech audio.
  593. InputAudioConfig config = 1 [(google.api.field_behavior) = REQUIRED];
  594. // The natural language speech audio to be processed.
  595. // A single request can contain up to 1 minute of speech audio data.
  596. // The [transcribed text][google.cloud.dialogflow.cx.v3beta1.QueryResult.transcript] cannot contain more than 256
  597. // bytes.
  598. //
  599. // For non-streaming audio detect intent, both `config` and `audio` must be
  600. // provided.
  601. // For streaming audio detect intent, `config` must be provided in
  602. // the first request and `audio` must be provided in all following requests.
  603. bytes audio = 2;
  604. }
  605. // Represents the event to trigger.
  606. message EventInput {
  607. // Name of the event.
  608. string event = 1;
  609. }
  610. // Represents the input for dtmf event.
  611. message DtmfInput {
  612. // The dtmf digits.
  613. string digits = 1;
  614. // The finish digit (if any).
  615. string finish_digit = 2;
  616. }
  617. // Represents one match result of [MatchIntent][].
  618. message Match {
  619. // Type of a Match.
  620. enum MatchType {
  621. // Not specified. Should never be used.
  622. MATCH_TYPE_UNSPECIFIED = 0;
  623. // The query was matched to an intent.
  624. INTENT = 1;
  625. // The query directly triggered an intent.
  626. DIRECT_INTENT = 2;
  627. // The query was used for parameter filling.
  628. PARAMETER_FILLING = 3;
  629. // No match was found for the query.
  630. NO_MATCH = 4;
  631. // Indicates an empty query.
  632. NO_INPUT = 5;
  633. // The query directly triggered an event.
  634. EVENT = 6;
  635. }
  636. // The [Intent][google.cloud.dialogflow.cx.v3beta1.Intent] that matched the query. Some, not all fields are filled in
  637. // this message, including but not limited to: `name` and `display_name`. Only
  638. // filled for [`INTENT`][google.cloud.dialogflow.cx.v3beta1.Match.MatchType] match type.
  639. Intent intent = 1;
  640. // The event that matched the query. Filled for
  641. // [`EVENT`][google.cloud.dialogflow.cx.v3beta1.Match.MatchType], [`NO_MATCH`][google.cloud.dialogflow.cx.v3beta1.Match.MatchType] and
  642. // [`NO_INPUT`][google.cloud.dialogflow.cx.v3beta1.Match.MatchType] match types.
  643. string event = 6;
  644. // The collection of parameters extracted from the query.
  645. //
  646. // Depending on your protocol or client library language, this is a
  647. // map, associative array, symbol table, dictionary, or JSON object
  648. // composed of a collection of (MapKey, MapValue) pairs:
  649. //
  650. // * MapKey type: string
  651. // * MapKey value: parameter name
  652. // * MapValue type: If parameter's entity type is a composite entity then use
  653. // map, otherwise, depending on the parameter value type, it could be one of
  654. // string, number, boolean, null, list or map.
  655. // * MapValue value: If parameter's entity type is a composite entity then use
  656. // map from composite entity property names to property values, otherwise,
  657. // use parameter value.
  658. google.protobuf.Struct parameters = 2;
  659. // Final text input which was matched during MatchIntent. This value can be
  660. // different from original input sent in request because of spelling
  661. // correction or other processing.
  662. string resolved_input = 3;
  663. // Type of this [Match][google.cloud.dialogflow.cx.v3beta1.Match].
  664. MatchType match_type = 4;
  665. // The confidence of this match. Values range from 0.0 (completely uncertain)
  666. // to 1.0 (completely certain).
  667. // This value is for informational purpose only and is only used to help match
  668. // the best intent within the classification threshold. This value may change
  669. // for the same end-user expression at any time due to a model retraining or
  670. // change in implementation.
  671. float confidence = 5;
  672. }
  673. // Request of [MatchIntent][].
  674. message MatchIntentRequest {
  675. // Required. The name of the session this query is sent to.
  676. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  677. // ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location
  678. // ID>/agents/<Agent ID>/environments/<Environment ID>/sessions/<Session ID>`.
  679. // If `Environment ID` is not specified, we assume default 'draft'
  680. // environment.
  681. // It's up to the API caller to choose an appropriate `Session ID`. It can be
  682. // a random number or some type of session identifiers (preferably hashed).
  683. // The length of the `Session ID` must not exceed 36 characters.
  684. //
  685. // For more information, see the [sessions
  686. // guide](https://cloud.google.com/dialogflow/cx/docs/concept/session).
  687. string session = 1 [
  688. (google.api.field_behavior) = REQUIRED,
  689. (google.api.resource_reference) = {
  690. type: "dialogflow.googleapis.com/Session"
  691. }
  692. ];
  693. // The parameters of this query.
  694. QueryParameters query_params = 2;
  695. // Required. The input specification.
  696. QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED];
  697. }
  698. // Response of [MatchIntent][].
  699. message MatchIntentResponse {
  700. // The original conversational query.
  701. oneof query {
  702. // If [natural language text][google.cloud.dialogflow.cx.v3beta1.TextInput] was provided as input, this field
  703. // will contain a copy of the text.
  704. string text = 1;
  705. // If an [intent][google.cloud.dialogflow.cx.v3beta1.IntentInput] was provided as input, this field will
  706. // contain a copy of the intent identifier.
  707. // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
  708. // ID>/intents/<Intent ID>`.
  709. string trigger_intent = 2 [(google.api.resource_reference) = {
  710. type: "dialogflow.googleapis.com/Intent"
  711. }];
  712. // If [natural language speech audio][google.cloud.dialogflow.cx.v3beta1.AudioInput] was provided as input,
  713. // this field will contain the transcript for the audio.
  714. string transcript = 3;
  715. // If an [event][google.cloud.dialogflow.cx.v3beta1.EventInput] was provided as input, this field will
  716. // contain a copy of the event name.
  717. string trigger_event = 6;
  718. }
  719. // Match results, if more than one, ordered descendingly by the confidence
  720. // we have that the particular intent matches the query.
  721. repeated Match matches = 4;
  722. // The current [Page][google.cloud.dialogflow.cx.v3beta1.Page]. Some, not all fields are filled in this message,
  723. // including but not limited to `name` and `display_name`.
  724. Page current_page = 5;
  725. }
  726. // Request of [FulfillIntent][]
  727. message FulfillIntentRequest {
  728. // Must be same as the corresponding MatchIntent request, otherwise the
  729. // behavior is undefined.
  730. MatchIntentRequest match_intent_request = 1;
  731. // The matched intent/event to fulfill.
  732. Match match = 2;
  733. // Instructs the speech synthesizer how to generate output audio.
  734. OutputAudioConfig output_audio_config = 3;
  735. }
  736. // Response of [FulfillIntent][]
  737. message FulfillIntentResponse {
  738. // Output only. The unique identifier of the response. It can be used to
  739. // locate a response in the training example set or for reporting issues.
  740. string response_id = 1;
  741. // The result of the conversational query.
  742. QueryResult query_result = 2;
  743. // The audio data bytes encoded as specified in the request.
  744. // Note: The output audio is generated based on the values of default platform
  745. // text responses found in the
  746. // [`query_result.response_messages`][google.cloud.dialogflow.cx.v3beta1.QueryResult.response_messages] field. If
  747. // multiple default text responses exist, they will be concatenated when
  748. // generating audio. If no default platform text responses exist, the
  749. // generated audio content will be empty.
  750. //
  751. // In some scenarios, multiple output audio fields may be present in the
  752. // response structure. In these cases, only the top-most-level audio output
  753. // has content.
  754. bytes output_audio = 3;
  755. // The config used by the speech synthesizer to generate the output audio.
  756. OutputAudioConfig output_audio_config = 4;
  757. }
  758. // The result of sentiment analysis. Sentiment analysis inspects user input
  759. // and identifies the prevailing subjective opinion, especially to determine a
  760. // user's attitude as positive, negative, or neutral.
  761. message SentimentAnalysisResult {
  762. // Sentiment score between -1.0 (negative sentiment) and 1.0 (positive
  763. // sentiment).
  764. float score = 1;
  765. // A non-negative number in the [0, +inf) range, which represents the absolute
  766. // magnitude of sentiment, regardless of score (positive or negative).
  767. float magnitude = 2;
  768. }