google-cloud-dialogflow 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +8 -0
- data/LICENSE +201 -0
- data/README.md +32 -0
- data/lib/google/cloud/dialogflow.rb +452 -0
- data/lib/google/cloud/dialogflow/credentials.rb +30 -0
- data/lib/google/cloud/dialogflow/v2.rb +454 -0
- data/lib/google/cloud/dialogflow/v2/agent_pb.rb +87 -0
- data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +104 -0
- data/lib/google/cloud/dialogflow/v2/agents_client.rb +639 -0
- data/lib/google/cloud/dialogflow/v2/agents_client_config.json +56 -0
- data/lib/google/cloud/dialogflow/v2/context_pb.rb +59 -0
- data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +71 -0
- data/lib/google/cloud/dialogflow/v2/contexts_client.rb +445 -0
- data/lib/google/cloud/dialogflow/v2/contexts_client_config.json +56 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/agent.rb +223 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/context.rb +115 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/entity_type.rb +290 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/intent.rb +714 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb +451 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session_entity_type.rb +134 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/any.rb +124 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/field_mask.rb +223 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/struct.rb +73 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/rpc/status.rb +83 -0
- data/lib/google/cloud/dialogflow/v2/doc/google/type/latlng.rb +64 -0
- data/lib/google/cloud/dialogflow/v2/doc/overview.rb +55 -0
- data/lib/google/cloud/dialogflow/v2/entity_type_pb.rb +120 -0
- data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +105 -0
- data/lib/google/cloud/dialogflow/v2/entity_types_client.rb +900 -0
- data/lib/google/cloud/dialogflow/v2/entity_types_client_config.json +76 -0
- data/lib/google/cloud/dialogflow/v2/intent_pb.rb +274 -0
- data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +91 -0
- data/lib/google/cloud/dialogflow/v2/intents_client.rb +684 -0
- data/lib/google/cloud/dialogflow/v2/intents_client_config.json +61 -0
- data/lib/google/cloud/dialogflow/v2/session_entity_type_pb.rb +61 -0
- data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +64 -0
- data/lib/google/cloud/dialogflow/v2/session_entity_types_client.rb +413 -0
- data/lib/google/cloud/dialogflow/v2/session_entity_types_client_config.json +51 -0
- data/lib/google/cloud/dialogflow/v2/session_pb.rb +127 -0
- data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +55 -0
- data/lib/google/cloud/dialogflow/v2/sessions_client.rb +286 -0
- data/lib/google/cloud/dialogflow/v2/sessions_client_config.json +36 -0
- data/lib/google/cloud/dialogflow/v2/webhook_pb.rb +42 -0
- metadata +142 -0
@@ -0,0 +1,451 @@
|
|
1
|
+
# Copyright 2018 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
|
+
# https://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
|
+
|
15
|
+
module Google
|
16
|
+
module Cloud
|
17
|
+
module Dialogflow
|
18
|
+
##
|
19
|
+
# # Dialogflow API Contents
|
20
|
+
#
|
21
|
+
# | Class | Description |
|
22
|
+
# | ----- | ----------- |
|
23
|
+
# | [SessionsClient][] | A session represents an interaction with a user. |
|
24
|
+
# | [Data Types][] | Data types for Google::Cloud::Dialogflow::V2 |
|
25
|
+
#
|
26
|
+
# [SessionsClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-dialogflow/latest/google/cloud/dialogflow/v2/sessionsclient
|
27
|
+
# [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-dialogflow/latest/google/cloud/dialogflow/v2/datatypes
|
28
|
+
#
|
29
|
+
module V2
|
30
|
+
# The request to detect user's intent.
|
31
|
+
# @!attribute [rw] session
|
32
|
+
# @return [String]
|
33
|
+
# Required. The name of the session this query is sent to. Format:
|
34
|
+
# +projects/<Project ID>/agent/sessions/<Session ID>+. It's up to the API
|
35
|
+
# caller to choose an appropriate session ID. It can be a random number or
|
36
|
+
# some type of user identifier (preferably hashed). The length of the session
|
37
|
+
# ID must not exceed 36 bytes.
|
38
|
+
# @!attribute [rw] query_params
|
39
|
+
# @return [Google::Cloud::Dialogflow::V2::QueryParameters]
|
40
|
+
# Optional. The parameters of this query.
|
41
|
+
# @!attribute [rw] query_input
|
42
|
+
# @return [Google::Cloud::Dialogflow::V2::QueryInput]
|
43
|
+
# Required. The input specification. It can be set to:
|
44
|
+
#
|
45
|
+
# 1. an audio config
|
46
|
+
# which instructs the speech recognizer how to process the speech audio,
|
47
|
+
#
|
48
|
+
# 2. a conversational query in the form of text, or
|
49
|
+
#
|
50
|
+
# 3. an event that specifies which intent to trigger.
|
51
|
+
# @!attribute [rw] input_audio
|
52
|
+
# @return [String]
|
53
|
+
# Optional. The natural language speech audio to be processed. This field
|
54
|
+
# should be populated iff +query_input+ is set to an input audio config.
|
55
|
+
# A single request can contain up to 1 minute of speech audio data.
|
56
|
+
class DetectIntentRequest; end
|
57
|
+
|
58
|
+
# The message returned from the DetectIntent method.
|
59
|
+
# @!attribute [rw] response_id
|
60
|
+
# @return [String]
|
61
|
+
# The unique identifier of the response. It can be used to
|
62
|
+
# locate a response in the training example set or for reporting issues.
|
63
|
+
# @!attribute [rw] query_result
|
64
|
+
# @return [Google::Cloud::Dialogflow::V2::QueryResult]
|
65
|
+
# The results of the conversational query or event processing.
|
66
|
+
# @!attribute [rw] webhook_status
|
67
|
+
# @return [Google::Rpc::Status]
|
68
|
+
# Specifies the status of the webhook request. +webhook_status+
|
69
|
+
# is never populated in webhook requests.
|
70
|
+
class DetectIntentResponse; end
|
71
|
+
|
72
|
+
# Represents the parameters of the conversational query.
|
73
|
+
# @!attribute [rw] time_zone
|
74
|
+
# @return [String]
|
75
|
+
# Optional. The time zone of this conversational query from the
|
76
|
+
# [time zone database](https://www.iana.org/time-zones), e.g.,
|
77
|
+
# America/New_York, Europe/Paris. If not provided, the time zone specified in
|
78
|
+
# agent settings is used.
|
79
|
+
# @!attribute [rw] geo_location
|
80
|
+
# @return [Google::Type::LatLng]
|
81
|
+
# Optional. The geo location of this conversational query.
|
82
|
+
# @!attribute [rw] contexts
|
83
|
+
# @return [Array<Google::Cloud::Dialogflow::V2::Context>]
|
84
|
+
# Optional. The collection of contexts to be activated before this query is
|
85
|
+
# executed.
|
86
|
+
# @!attribute [rw] reset_contexts
|
87
|
+
# @return [true, false]
|
88
|
+
# Optional. Specifies whether to delete all contexts in the current session
|
89
|
+
# before the new ones are activated.
|
90
|
+
# @!attribute [rw] session_entity_types
|
91
|
+
# @return [Array<Google::Cloud::Dialogflow::V2::SessionEntityType>]
|
92
|
+
# Optional. The collection of session entity types to replace or extend
|
93
|
+
# developer entities with for this query only. The entity synonyms apply
|
94
|
+
# to all languages.
|
95
|
+
# @!attribute [rw] payload
|
96
|
+
# @return [Google::Protobuf::Struct]
|
97
|
+
# Optional. This field can be used to pass custom data into the webhook
|
98
|
+
# associated with the agent. Arbitrary JSON objects are supported.
|
99
|
+
class QueryParameters; end
|
100
|
+
|
101
|
+
# Represents the query input. It can contain either:
|
102
|
+
#
|
103
|
+
# 1. An audio config which
|
104
|
+
# instructs the speech recognizer how to process the speech audio.
|
105
|
+
#
|
106
|
+
# 2. A conversational query in the form of text,.
|
107
|
+
#
|
108
|
+
# 3. An event that specifies which intent to trigger.
|
109
|
+
# @!attribute [rw] audio_config
|
110
|
+
# @return [Google::Cloud::Dialogflow::V2::InputAudioConfig]
|
111
|
+
# Instructs the speech recognizer how to process the speech audio.
|
112
|
+
# @!attribute [rw] text
|
113
|
+
# @return [Google::Cloud::Dialogflow::V2::TextInput]
|
114
|
+
# The natural language text to be processed.
|
115
|
+
# @!attribute [rw] event
|
116
|
+
# @return [Google::Cloud::Dialogflow::V2::EventInput]
|
117
|
+
# The event to be processed.
|
118
|
+
class QueryInput; end
|
119
|
+
|
120
|
+
# Represents the result of conversational query or event processing.
|
121
|
+
# @!attribute [rw] query_text
|
122
|
+
# @return [String]
|
123
|
+
# The original conversational query text:
|
124
|
+
# * If natural language text was provided as input, +query_text+ contains
|
125
|
+
# a copy of the input.
|
126
|
+
# * If natural language speech audio was provided as input, +query_text+
|
127
|
+
# contains the speech recognition result. If speech recognizer produced
|
128
|
+
# multiple alternatives, a particular one is picked.
|
129
|
+
# * If an event was provided as input, +query_text+ is not set.
|
130
|
+
# @!attribute [rw] language_code
|
131
|
+
# @return [String]
|
132
|
+
# The language that was triggered during intent detection.
|
133
|
+
# See [Language Support](https://dialogflow.com/docs/reference/language)
|
134
|
+
# for a list of the currently supported language codes.
|
135
|
+
# @!attribute [rw] speech_recognition_confidence
|
136
|
+
# @return [Float]
|
137
|
+
# The Speech recognition confidence between 0.0 and 1.0. A higher number
|
138
|
+
# indicates an estimated greater likelihood that the recognized words are
|
139
|
+
# correct. The default of 0.0 is a sentinel value indicating that confidence
|
140
|
+
# was not set.
|
141
|
+
#
|
142
|
+
# You should not rely on this field as it isn't guaranteed to be accurate, or
|
143
|
+
# even set. In particular this field isn't set in Webhook calls and for
|
144
|
+
# StreamingDetectIntent since the streaming endpoint has separate confidence
|
145
|
+
# estimates per portion of the audio in StreamingRecognitionResult.
|
146
|
+
# @!attribute [rw] action
|
147
|
+
# @return [String]
|
148
|
+
# The action name from the matched intent.
|
149
|
+
# @!attribute [rw] parameters
|
150
|
+
# @return [Google::Protobuf::Struct]
|
151
|
+
# The collection of extracted parameters.
|
152
|
+
# @!attribute [rw] all_required_params_present
|
153
|
+
# @return [true, false]
|
154
|
+
# This field is set to:
|
155
|
+
# * +false+ if the matched intent has required parameters and not all of
|
156
|
+
# the required parameter values have been collected.
|
157
|
+
# * +true+ if all required parameter values have been collected, or if the
|
158
|
+
# matched intent doesn't contain any required parameters.
|
159
|
+
# @!attribute [rw] fulfillment_text
|
160
|
+
# @return [String]
|
161
|
+
# The text to be pronounced to the user or shown on the screen.
|
162
|
+
# @!attribute [rw] fulfillment_messages
|
163
|
+
# @return [Array<Google::Cloud::Dialogflow::V2::Intent::Message>]
|
164
|
+
# The collection of rich messages to present to the user.
|
165
|
+
# @!attribute [rw] webhook_source
|
166
|
+
# @return [String]
|
167
|
+
# If the query was fulfilled by a webhook call, this field is set to the
|
168
|
+
# value of the +source+ field returned in the webhook response.
|
169
|
+
# @!attribute [rw] webhook_payload
|
170
|
+
# @return [Google::Protobuf::Struct]
|
171
|
+
# If the query was fulfilled by a webhook call, this field is set to the
|
172
|
+
# value of the +payload+ field returned in the webhook response.
|
173
|
+
# @!attribute [rw] output_contexts
|
174
|
+
# @return [Array<Google::Cloud::Dialogflow::V2::Context>]
|
175
|
+
# The collection of output contexts. If applicable,
|
176
|
+
# +output_contexts.parameters+ contains entries with name
|
177
|
+
# +<parameter name>.original+ containing the original parameter values
|
178
|
+
# before the query.
|
179
|
+
# @!attribute [rw] intent
|
180
|
+
# @return [Google::Cloud::Dialogflow::V2::Intent]
|
181
|
+
# The intent that matched the conversational query. Some, not
|
182
|
+
# all fields are filled in this message, including but not limited to:
|
183
|
+
# +name+, +display_name+ and +webhook_state+.
|
184
|
+
# @!attribute [rw] intent_detection_confidence
|
185
|
+
# @return [Float]
|
186
|
+
# The intent detection confidence. Values range from 0.0
|
187
|
+
# (completely uncertain) to 1.0 (completely certain).
|
188
|
+
# @!attribute [rw] diagnostic_info
|
189
|
+
# @return [Google::Protobuf::Struct]
|
190
|
+
# The free-form diagnostic info. For example, this field
|
191
|
+
# could contain webhook call latency.
|
192
|
+
class QueryResult; end
|
193
|
+
|
194
|
+
# The top-level message sent by the client to the
|
195
|
+
# +StreamingDetectIntent+ method.
|
196
|
+
#
|
197
|
+
# Multiple request messages should be sent in order:
|
198
|
+
#
|
199
|
+
# 1. The first message must contain +session+, +query_input+ plus optionally
|
200
|
+
# +query_params+ and/or +single_utterance+. The message must not contain +input_audio+.
|
201
|
+
#
|
202
|
+
# 2. If +query_input+ was set to a streaming input audio config,
|
203
|
+
# all subsequent messages must contain only +input_audio+.
|
204
|
+
# Otherwise, finish the request stream.
|
205
|
+
# @!attribute [rw] session
|
206
|
+
# @return [String]
|
207
|
+
# Required. The name of the session the query is sent to.
|
208
|
+
# Format of the session name:
|
209
|
+
# +projects/<Project ID>/agent/sessions/<Session ID>+. It’s up to the API
|
210
|
+
# caller to choose an appropriate <Session ID>. It can be a random number or
|
211
|
+
# some type of user identifier (preferably hashed). The length of the session
|
212
|
+
# ID must not exceed 36 characters.
|
213
|
+
# @!attribute [rw] query_params
|
214
|
+
# @return [Google::Cloud::Dialogflow::V2::QueryParameters]
|
215
|
+
# Optional. The parameters of this query.
|
216
|
+
# @!attribute [rw] query_input
|
217
|
+
# @return [Google::Cloud::Dialogflow::V2::QueryInput]
|
218
|
+
# Required. The input specification. It can be set to:
|
219
|
+
#
|
220
|
+
# 1. an audio config which instructs the speech recognizer how to process
|
221
|
+
# the speech audio,
|
222
|
+
#
|
223
|
+
# 2. a conversational query in the form of text, or
|
224
|
+
#
|
225
|
+
# 3. an event that specifies which intent to trigger.
|
226
|
+
# @!attribute [rw] single_utterance
|
227
|
+
# @return [true, false]
|
228
|
+
# Optional. If +false+ (default), recognition does not cease until the
|
229
|
+
# client closes the stream.
|
230
|
+
# If +true+, the recognizer will detect a single spoken utterance in input
|
231
|
+
# audio. Recognition ceases when it detects the audio's voice has
|
232
|
+
# stopped or paused. In this case, once a detected intent is received, the
|
233
|
+
# client should close the stream and start a new request with a new stream as
|
234
|
+
# needed.
|
235
|
+
# This setting is ignored when +query_input+ is a piece of text or an event.
|
236
|
+
# @!attribute [rw] input_audio
|
237
|
+
# @return [String]
|
238
|
+
# Optional. The input audio content to be recognized. Must be sent if
|
239
|
+
# +query_input+ was set to a streaming input audio config. The complete audio
|
240
|
+
# over all streaming messages must not exceed 1 minute.
|
241
|
+
class StreamingDetectIntentRequest; end
|
242
|
+
|
243
|
+
# The top-level message returned from the
|
244
|
+
# +StreamingDetectIntent+ method.
|
245
|
+
#
|
246
|
+
# Multiple response messages can be returned in order:
|
247
|
+
#
|
248
|
+
# 1. If the input was set to streaming audio, the first one or more messages
|
249
|
+
# contain +recognition_result+. Each +recognition_result+ represents a more
|
250
|
+
# complete transcript of what the user said. The last +recognition_result+
|
251
|
+
# has +is_final+ set to +true+.
|
252
|
+
#
|
253
|
+
# 2. The next message contains +response_id+, +query_result+
|
254
|
+
# and optionally +webhook_status+ if a WebHook was called.
|
255
|
+
# @!attribute [rw] response_id
|
256
|
+
# @return [String]
|
257
|
+
# The unique identifier of the response. It can be used to
|
258
|
+
# locate a response in the training example set or for reporting issues.
|
259
|
+
# @!attribute [rw] recognition_result
|
260
|
+
# @return [Google::Cloud::Dialogflow::V2::StreamingRecognitionResult]
|
261
|
+
# The result of speech recognition.
|
262
|
+
# @!attribute [rw] query_result
|
263
|
+
# @return [Google::Cloud::Dialogflow::V2::QueryResult]
|
264
|
+
# The result of the conversational query or event processing.
|
265
|
+
# @!attribute [rw] webhook_status
|
266
|
+
# @return [Google::Rpc::Status]
|
267
|
+
# Specifies the status of the webhook request.
|
268
|
+
class StreamingDetectIntentResponse; end
|
269
|
+
|
270
|
+
# Contains a speech recognition result corresponding to a portion of the audio
|
271
|
+
# that is currently being processed or an indication that this is the end
|
272
|
+
# of the single requested utterance.
|
273
|
+
#
|
274
|
+
# Example:
|
275
|
+
#
|
276
|
+
# 1. transcript: "tube"
|
277
|
+
#
|
278
|
+
# 2. transcript: "to be a"
|
279
|
+
#
|
280
|
+
# 3. transcript: "to be"
|
281
|
+
#
|
282
|
+
# 4. transcript: "to be or not to be"
|
283
|
+
# is_final: true
|
284
|
+
#
|
285
|
+
# 5. transcript: " that's"
|
286
|
+
#
|
287
|
+
# 6. transcript: " that is"
|
288
|
+
#
|
289
|
+
# 7. recognition_event_type: +RECOGNITION_EVENT_END_OF_SINGLE_UTTERANCE+
|
290
|
+
#
|
291
|
+
# 8. transcript: " that is the question"
|
292
|
+
# is_final: true
|
293
|
+
#
|
294
|
+
# Only two of the responses contain final results (#4 and #8 indicated by
|
295
|
+
# +is_final: true+). Concatenating these generates the full transcript: "to be
|
296
|
+
# or not to be that is the question".
|
297
|
+
#
|
298
|
+
# In each response we populate:
|
299
|
+
#
|
300
|
+
# * for +MESSAGE_TYPE_TRANSCRIPT+: +transcript+ and possibly +is_final+.
|
301
|
+
#
|
302
|
+
# * for +MESSAGE_TYPE_END_OF_SINGLE_UTTERANCE+: only +event_type+.
|
303
|
+
# @!attribute [rw] message_type
|
304
|
+
# @return [Google::Cloud::Dialogflow::V2::StreamingRecognitionResult::MessageType]
|
305
|
+
# Type of the result message.
|
306
|
+
# @!attribute [rw] transcript
|
307
|
+
# @return [String]
|
308
|
+
# Transcript text representing the words that the user spoke.
|
309
|
+
# Populated if and only if +event_type+ = +RECOGNITION_EVENT_TRANSCRIPT+.
|
310
|
+
# @!attribute [rw] is_final
|
311
|
+
# @return [true, false]
|
312
|
+
# The default of 0.0 is a sentinel value indicating +confidence+ was not set.
|
313
|
+
# If +false+, the +StreamingRecognitionResult+ represents an
|
314
|
+
# interim result that may change. If +true+, the recognizer will not return
|
315
|
+
# any further hypotheses about this piece of the audio. May only be populated
|
316
|
+
# for +event_type+ = +RECOGNITION_EVENT_TRANSCRIPT+.
|
317
|
+
# @!attribute [rw] confidence
|
318
|
+
# @return [Float]
|
319
|
+
# The Speech confidence between 0.0 and 1.0 for the current portion of audio.
|
320
|
+
# A higher number indicates an estimated greater likelihood that the
|
321
|
+
# recognized words are correct. The default of 0.0 is a sentinel value
|
322
|
+
# indicating that confidence was not set.
|
323
|
+
#
|
324
|
+
# This field is typically only provided if +is_final+ is true and you should
|
325
|
+
# not rely on it being accurate or even set.
|
326
|
+
class StreamingRecognitionResult
|
327
|
+
# Type of the response message.
|
328
|
+
module MessageType
|
329
|
+
# Not specified. Should never be used.
|
330
|
+
MESSAGE_TYPE_UNSPECIFIED = 0
|
331
|
+
|
332
|
+
# Message contains a (possibly partial) transcript.
|
333
|
+
TRANSCRIPT = 1
|
334
|
+
|
335
|
+
# Event indicates that the server has detected the end of the user's speech
|
336
|
+
# utterance and expects no additional speech. Therefore, the server will
|
337
|
+
# not process additional audio (although it may subsequently return
|
338
|
+
# additional results). The client should stop sending additional audio
|
339
|
+
# data, half-close the gRPC connection, and wait for any additional results
|
340
|
+
# until the server closes the gRPC connection. This message is only sent if
|
341
|
+
# +single_utterance+ was set to +true+, and is not used otherwise.
|
342
|
+
END_OF_SINGLE_UTTERANCE = 2
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
# Instructs the speech recognizer how to process the audio content.
|
347
|
+
# @!attribute [rw] audio_encoding
|
348
|
+
# @return [Google::Cloud::Dialogflow::V2::AudioEncoding]
|
349
|
+
# Required. Audio encoding of the audio content to process.
|
350
|
+
# @!attribute [rw] sample_rate_hertz
|
351
|
+
# @return [Integer]
|
352
|
+
# Required. Sample rate (in Hertz) of the audio content sent in the query.
|
353
|
+
# Refer to [Cloud Speech API documentation](https://cloud.google.com/speech/docs/basics) for more
|
354
|
+
# details.
|
355
|
+
# @!attribute [rw] language_code
|
356
|
+
# @return [String]
|
357
|
+
# Required. The language of the supplied audio. Dialogflow does not do
|
358
|
+
# translations. See [Language
|
359
|
+
# Support](https://dialogflow.com/docs/languages) for a list of the
|
360
|
+
# currently supported language codes. Note that queries in the same session
|
361
|
+
# do not necessarily need to specify the same language.
|
362
|
+
# @!attribute [rw] phrase_hints
|
363
|
+
# @return [Array<String>]
|
364
|
+
# Optional. The collection of phrase hints which are used to boost accuracy
|
365
|
+
# of speech recognition.
|
366
|
+
# Refer to [Cloud Speech API documentation](https://cloud.google.com/speech/docs/basics#phrase-hints)
|
367
|
+
# for more details.
|
368
|
+
class InputAudioConfig; end
|
369
|
+
|
370
|
+
# Represents the natural language text to be processed.
|
371
|
+
# @!attribute [rw] text
|
372
|
+
# @return [String]
|
373
|
+
# Required. The UTF-8 encoded natural language text to be processed.
|
374
|
+
# Text length must not exceed 256 bytes.
|
375
|
+
# @!attribute [rw] language_code
|
376
|
+
# @return [String]
|
377
|
+
# Required. The language of this conversational query. See [Language
|
378
|
+
# Support](https://dialogflow.com/docs/languages) for a list of the
|
379
|
+
# currently supported language codes. Note that queries in the same session
|
380
|
+
# do not necessarily need to specify the same language.
|
381
|
+
class TextInput; end
|
382
|
+
|
383
|
+
# Events allow for matching intents by event name instead of the natural
|
384
|
+
# language input. For instance, input +<event: { name: “welcome_event”,
|
385
|
+
# parameters: { name: “Sam” } }>+ can trigger a personalized welcome response.
|
386
|
+
# The parameter +name+ may be used by the agent in the response:
|
387
|
+
# +“Hello #welcome_event.name! What can I do for you today?”+.
|
388
|
+
# @!attribute [rw] name
|
389
|
+
# @return [String]
|
390
|
+
# Required. The unique identifier of the event.
|
391
|
+
# @!attribute [rw] parameters
|
392
|
+
# @return [Google::Protobuf::Struct]
|
393
|
+
# Optional. The collection of parameters associated with the event.
|
394
|
+
# @!attribute [rw] language_code
|
395
|
+
# @return [String]
|
396
|
+
# Required. The language of this query. See [Language
|
397
|
+
# Support](https://dialogflow.com/docs/languages) for a list of the
|
398
|
+
# currently supported language codes. Note that queries in the same session
|
399
|
+
# do not necessarily need to specify the same language.
|
400
|
+
class EventInput; end
|
401
|
+
|
402
|
+
# Audio encoding of the audio content sent in the conversational query request.
|
403
|
+
# Refer to the [Cloud Speech API documentation](https://cloud.google.com/speech/docs/basics) for more
|
404
|
+
# details.
|
405
|
+
module AudioEncoding
|
406
|
+
# Not specified.
|
407
|
+
AUDIO_ENCODING_UNSPECIFIED = 0
|
408
|
+
|
409
|
+
# Uncompressed 16-bit signed little-endian samples (Linear PCM).
|
410
|
+
AUDIO_ENCODING_LINEAR_16 = 1
|
411
|
+
|
412
|
+
# [+FLAC+](https://xiph.org/flac/documentation.html) (Free Lossless Audio
|
413
|
+
# Codec) is the recommended encoding because it is lossless (therefore
|
414
|
+
# recognition is not compromised) and requires only about half the
|
415
|
+
# bandwidth of +LINEAR16+. +FLAC+ stream encoding supports 16-bit and
|
416
|
+
# 24-bit samples, however, not all fields in +STREAMINFO+ are supported.
|
417
|
+
AUDIO_ENCODING_FLAC = 2
|
418
|
+
|
419
|
+
# 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.
|
420
|
+
AUDIO_ENCODING_MULAW = 3
|
421
|
+
|
422
|
+
# Adaptive Multi-Rate Narrowband codec. +sample_rate_hertz+ must be 8000.
|
423
|
+
AUDIO_ENCODING_AMR = 4
|
424
|
+
|
425
|
+
# Adaptive Multi-Rate Wideband codec. +sample_rate_hertz+ must be 16000.
|
426
|
+
AUDIO_ENCODING_AMR_WB = 5
|
427
|
+
|
428
|
+
# Opus encoded audio frames in Ogg container
|
429
|
+
# ([OggOpus](https://wiki.xiph.org/OggOpus)).
|
430
|
+
# +sample_rate_hertz+ must be 16000.
|
431
|
+
AUDIO_ENCODING_OGG_OPUS = 6
|
432
|
+
|
433
|
+
# Although the use of lossy encodings is not recommended, if a very low
|
434
|
+
# bitrate encoding is required, +OGG_OPUS+ is highly preferred over
|
435
|
+
# Speex encoding. The [Speex](https://speex.org/) encoding supported by
|
436
|
+
# Dialogflow API has a header byte in each block, as in MIME type
|
437
|
+
# +audio/x-speex-with-header-byte+.
|
438
|
+
# It is a variant of the RTP Speex encoding defined in
|
439
|
+
# [RFC 5574](https://tools.ietf.org/html/rfc5574).
|
440
|
+
# The stream is a sequence of blocks, one block per RTP packet. Each block
|
441
|
+
# starts with a byte containing the length of the block, in bytes, followed
|
442
|
+
# by one or more frames of Speex data, padded to an integral number of
|
443
|
+
# bytes (octets) as specified in RFC 5574. In other words, each RTP header
|
444
|
+
# is replaced with a single byte containing the block length. Only Speex
|
445
|
+
# wideband is supported. +sample_rate_hertz+ must be 16000.
|
446
|
+
AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7
|
447
|
+
end
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|
451
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
# Copyright 2018 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
|
+
# https://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
|
+
|
15
|
+
module Google
|
16
|
+
module Cloud
|
17
|
+
module Dialogflow
|
18
|
+
##
|
19
|
+
# # Dialogflow API Contents
|
20
|
+
#
|
21
|
+
# | Class | Description |
|
22
|
+
# | ----- | ----------- |
|
23
|
+
# | [SessionEntityTypesClient][] | Entities are extracted from user input and represent parameters that are meaningful to your application. |
|
24
|
+
# | [Data Types][] | Data types for Google::Cloud::Dialogflow::V2 |
|
25
|
+
#
|
26
|
+
# [SessionEntityTypesClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-dialogflow/latest/google/cloud/dialogflow/v2/sessionentitytypesclient
|
27
|
+
# [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-dialogflow/latest/google/cloud/dialogflow/v2/datatypes
|
28
|
+
#
|
29
|
+
module V2
|
30
|
+
# Represents a session entity type.
|
31
|
+
#
|
32
|
+
# Extends or replaces a developer entity type at the user session level (we
|
33
|
+
# refer to the entity types defined at the agent level as "developer entity
|
34
|
+
# types").
|
35
|
+
#
|
36
|
+
# Note: session entity types apply to all queries, regardless of the language.
|
37
|
+
# @!attribute [rw] name
|
38
|
+
# @return [String]
|
39
|
+
# Required. The unique identifier of this session entity type. Format:
|
40
|
+
# +projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
41
|
+
# Display Name>+.
|
42
|
+
# @!attribute [rw] entity_override_mode
|
43
|
+
# @return [Google::Cloud::Dialogflow::V2::SessionEntityType::EntityOverrideMode]
|
44
|
+
# Required. Indicates whether the additional data should override or
|
45
|
+
# supplement the developer entity type definition.
|
46
|
+
# @!attribute [rw] entities
|
47
|
+
# @return [Array<Google::Cloud::Dialogflow::V2::EntityType::Entity>]
|
48
|
+
# Required. The collection of entities associated with this session entity
|
49
|
+
# type.
|
50
|
+
class SessionEntityType
|
51
|
+
# The types of modifications for a session entity type.
|
52
|
+
module EntityOverrideMode
|
53
|
+
# Not specified. This value should be never used.
|
54
|
+
ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0
|
55
|
+
|
56
|
+
# The collection of session entities overrides the collection of entities
|
57
|
+
# in the corresponding developer entity type.
|
58
|
+
ENTITY_OVERRIDE_MODE_OVERRIDE = 1
|
59
|
+
|
60
|
+
# The collection of session entities extends the collection of entities in
|
61
|
+
# the corresponding developer entity type.
|
62
|
+
# Calls to +ListSessionEntityTypes+, +GetSessionEntityType+,
|
63
|
+
# +CreateSessionEntityType+ and +UpdateSessionEntityType+ return the full
|
64
|
+
# collection of entities from the developer entity type in the agent's
|
65
|
+
# default language and the session entity type.
|
66
|
+
ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# The request message for {Google::Cloud::Dialogflow::V2::SessionEntityTypes::ListSessionEntityTypes SessionEntityTypes::ListSessionEntityTypes}.
|
71
|
+
# @!attribute [rw] parent
|
72
|
+
# @return [String]
|
73
|
+
# Required. The session to list all session entity types from.
|
74
|
+
# Format: +projects/<Project ID>/agent/sessions/<Session ID>+.
|
75
|
+
# @!attribute [rw] page_size
|
76
|
+
# @return [Integer]
|
77
|
+
# Optional. The maximum number of items to return in a single page. By
|
78
|
+
# default 100 and at most 1000.
|
79
|
+
# @!attribute [rw] page_token
|
80
|
+
# @return [String]
|
81
|
+
# Optional. The next_page_token value returned from a previous list request.
|
82
|
+
class ListSessionEntityTypesRequest; end
|
83
|
+
|
84
|
+
# The response message for {Google::Cloud::Dialogflow::V2::SessionEntityTypes::ListSessionEntityTypes SessionEntityTypes::ListSessionEntityTypes}.
|
85
|
+
# @!attribute [rw] session_entity_types
|
86
|
+
# @return [Array<Google::Cloud::Dialogflow::V2::SessionEntityType>]
|
87
|
+
# The list of session entity types. There will be a maximum number of items
|
88
|
+
# returned based on the page_size field in the request.
|
89
|
+
# @!attribute [rw] next_page_token
|
90
|
+
# @return [String]
|
91
|
+
# Token to retrieve the next page of results, or empty if there are no
|
92
|
+
# more results in the list.
|
93
|
+
class ListSessionEntityTypesResponse; end
|
94
|
+
|
95
|
+
# The request message for {Google::Cloud::Dialogflow::V2::SessionEntityTypes::GetSessionEntityType SessionEntityTypes::GetSessionEntityType}.
|
96
|
+
# @!attribute [rw] name
|
97
|
+
# @return [String]
|
98
|
+
# Required. The name of the session entity type. Format:
|
99
|
+
# +projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
100
|
+
# Display Name>+.
|
101
|
+
class GetSessionEntityTypeRequest; end
|
102
|
+
|
103
|
+
# The request message for {Google::Cloud::Dialogflow::V2::SessionEntityTypes::CreateSessionEntityType SessionEntityTypes::CreateSessionEntityType}.
|
104
|
+
# @!attribute [rw] parent
|
105
|
+
# @return [String]
|
106
|
+
# Required. The session to create a session entity type for.
|
107
|
+
# Format: +projects/<Project ID>/agent/sessions/<Session ID>+.
|
108
|
+
# @!attribute [rw] session_entity_type
|
109
|
+
# @return [Google::Cloud::Dialogflow::V2::SessionEntityType]
|
110
|
+
# Required. The session entity type to create.
|
111
|
+
class CreateSessionEntityTypeRequest; end
|
112
|
+
|
113
|
+
# The request message for {Google::Cloud::Dialogflow::V2::SessionEntityTypes::UpdateSessionEntityType SessionEntityTypes::UpdateSessionEntityType}.
|
114
|
+
# @!attribute [rw] session_entity_type
|
115
|
+
# @return [Google::Cloud::Dialogflow::V2::SessionEntityType]
|
116
|
+
# Required. The entity type to update. Format:
|
117
|
+
# +projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
118
|
+
# Display Name>+.
|
119
|
+
# @!attribute [rw] update_mask
|
120
|
+
# @return [Google::Protobuf::FieldMask]
|
121
|
+
# Optional. The mask to control which fields get updated.
|
122
|
+
class UpdateSessionEntityTypeRequest; end
|
123
|
+
|
124
|
+
# The request message for {Google::Cloud::Dialogflow::V2::SessionEntityTypes::DeleteSessionEntityType SessionEntityTypes::DeleteSessionEntityType}.
|
125
|
+
# @!attribute [rw] name
|
126
|
+
# @return [String]
|
127
|
+
# Required. The name of the entity type to delete. Format:
|
128
|
+
# +projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
|
129
|
+
# Display Name>+.
|
130
|
+
class DeleteSessionEntityTypeRequest; end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|