google-cloud-dialogflow-v2 0.6.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +188 -190
- data/README.md +66 -2
- data/lib/google/cloud/dialogflow/v2.rb +11 -2
- data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +9 -9
- data/lib/google/cloud/dialogflow/v2/agents/client.rb +24 -18
- data/lib/google/cloud/dialogflow/v2/agents/operations.rb +96 -11
- data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +100 -0
- data/lib/google/cloud/dialogflow/v2/answer_record_services_pb.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/answer_records.rb +50 -0
- data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +479 -0
- data/lib/google/cloud/dialogflow/v2/answer_records/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/answer_records/paths.rb +105 -0
- data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +7 -0
- data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +7 -24
- data/lib/google/cloud/dialogflow/v2/contexts.rb +1 -18
- data/lib/google/cloud/dialogflow/v2/contexts/client.rb +22 -33
- data/lib/google/cloud/dialogflow/v2/contexts/paths.rb +2 -2
- data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +39 -0
- data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +89 -0
- data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +182 -0
- data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +61 -0
- data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +699 -0
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +205 -0
- data/lib/google/cloud/dialogflow/v2/conversation_services_pb.rb +75 -0
- data/lib/google/cloud/dialogflow/v2/conversations.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/conversations/client.rb +757 -0
- data/lib/google/cloud/dialogflow/v2/conversations/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/conversations/paths.rb +146 -0
- data/lib/google/cloud/dialogflow/v2/document_pb.rb +99 -0
- data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +73 -0
- data/lib/google/cloud/dialogflow/v2/documents.rb +50 -0
- data/lib/google/cloud/dialogflow/v2/documents/client.rb +810 -0
- data/lib/google/cloud/dialogflow/v2/documents/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/documents/operations.rb +655 -0
- data/lib/google/cloud/dialogflow/v2/documents/paths.rb +119 -0
- data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +11 -38
- data/lib/google/cloud/dialogflow/v2/entity_types.rb +1 -28
- data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +26 -47
- data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +96 -11
- data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +2 -2
- data/lib/google/cloud/dialogflow/v2/environments.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/environments/client.rb +17 -11
- data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +20 -0
- data/lib/google/cloud/dialogflow/v2/human_agent_assistant_event_pb.rb +26 -0
- data/lib/google/cloud/dialogflow/v2/intent_pb.rb +2 -0
- data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +8 -39
- data/lib/google/cloud/dialogflow/v2/intents.rb +1 -32
- data/lib/google/cloud/dialogflow/v2/intents/client.rb +23 -48
- data/lib/google/cloud/dialogflow/v2/intents/operations.rb +96 -11
- data/lib/google/cloud/dialogflow/v2/intents/paths.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/knowledge_base_pb.rb +60 -0
- data/lib/google/cloud/dialogflow/v2/knowledge_base_services_pb.rb +53 -0
- data/lib/google/cloud/dialogflow/v2/knowledge_bases.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +696 -0
- data/lib/google/cloud/dialogflow/v2/knowledge_bases/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/knowledge_bases/paths.rb +105 -0
- data/lib/google/cloud/dialogflow/v2/participant_pb.rb +172 -0
- data/lib/google/cloud/dialogflow/v2/participant_services_pb.rb +64 -0
- data/lib/google/cloud/dialogflow/v2/participants.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/participants/client.rb +894 -0
- data/lib/google/cloud/dialogflow/v2/participants/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/participants/paths.rb +258 -0
- data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +6 -22
- data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +1 -17
- data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +21 -31
- data/lib/google/cloud/dialogflow/v2/session_entity_types/paths.rb +2 -2
- data/lib/google/cloud/dialogflow/v2/session_pb.rb +1 -0
- data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +14 -6
- data/lib/google/cloud/dialogflow/v2/sessions.rb +4 -4
- data/lib/google/cloud/dialogflow/v2/sessions/client.rb +43 -21
- data/lib/google/cloud/dialogflow/v2/sessions/paths.rb +3 -3
- data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +6 -0
- data/proto_docs/google/api/resource.rb +50 -14
- data/proto_docs/google/cloud/dialogflow/v2/agent.rb +1 -2
- data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +259 -0
- data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +25 -0
- data/proto_docs/google/cloud/dialogflow/v2/context.rb +17 -2
- data/proto_docs/google/cloud/dialogflow/v2/conversation.rb +253 -0
- data/proto_docs/google/cloud/dialogflow/v2/conversation_event.rb +83 -0
- data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +510 -0
- data/proto_docs/google/cloud/dialogflow/v2/document.rb +267 -0
- data/proto_docs/google/cloud/dialogflow/v2/entity_type.rb +12 -3
- data/proto_docs/google/cloud/dialogflow/v2/environment.rb +18 -1
- data/proto_docs/google/cloud/dialogflow/v2/human_agent_assistant_event.rb +45 -0
- data/proto_docs/google/cloud/dialogflow/v2/intent.rb +20 -3
- data/proto_docs/google/cloud/dialogflow/v2/knowledge_base.rb +139 -0
- data/proto_docs/google/cloud/dialogflow/v2/participant.rb +503 -0
- data/proto_docs/google/cloud/dialogflow/v2/session.rb +52 -7
- data/proto_docs/google/cloud/dialogflow/v2/session_entity_type.rb +7 -6
- data/proto_docs/google/cloud/dialogflow/v2/validation_result.rb +1 -1
- data/proto_docs/google/cloud/dialogflow/v2/webhook.rb +2 -2
- data/proto_docs/google/longrunning/operations.rb +17 -3
- data/proto_docs/google/protobuf/any.rb +5 -2
- data/proto_docs/google/protobuf/timestamp.rb +10 -1
- data/proto_docs/google/type/latlng.rb +2 -2
- metadata +59 -9
@@ -24,7 +24,7 @@ module Google
|
|
24
24
|
module Dialogflow
|
25
25
|
module V2
|
26
26
|
module Environments
|
27
|
-
#
|
27
|
+
# Service for managing [Environments][google.cloud.dialogflow.v2.Environment].
|
28
28
|
class Service
|
29
29
|
|
30
30
|
include GRPC::GenericService
|
@@ -34,7 +34,7 @@ module Google
|
|
34
34
|
self.service_name = 'google.cloud.dialogflow.v2.Environments'
|
35
35
|
|
36
36
|
# Returns the list of all non-draft environments of the specified agent.
|
37
|
-
rpc :ListEnvironments, ListEnvironmentsRequest, ListEnvironmentsResponse
|
37
|
+
rpc :ListEnvironments, ::Google::Cloud::Dialogflow::V2::ListEnvironmentsRequest, ::Google::Cloud::Dialogflow::V2::ListEnvironmentsResponse
|
38
38
|
end
|
39
39
|
|
40
40
|
Stub = Service.rpc_stub_class
|
@@ -27,7 +27,7 @@ module Google
|
|
27
27
|
##
|
28
28
|
# Client for the Environments service.
|
29
29
|
#
|
30
|
-
#
|
30
|
+
# Service for managing {::Google::Cloud::Dialogflow::V2::Environment Environments}.
|
31
31
|
#
|
32
32
|
class Client
|
33
33
|
include Paths
|
@@ -60,7 +60,7 @@ module Google
|
|
60
60
|
parent_config = while namespace.any?
|
61
61
|
parent_name = namespace.join "::"
|
62
62
|
parent_const = const_get parent_name
|
63
|
-
break parent_const.configure if parent_const
|
63
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
64
64
|
namespace.pop
|
65
65
|
end
|
66
66
|
default_config = Client::Configuration.new parent_config
|
@@ -68,9 +68,9 @@ module Google
|
|
68
68
|
default_config.timeout = 60.0
|
69
69
|
default_config.retry_policy = {
|
70
70
|
initial_delay: 0.1,
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
max_delay: 60.0,
|
72
|
+
multiplier: 1.3,
|
73
|
+
retry_codes: [14]
|
74
74
|
}
|
75
75
|
|
76
76
|
default_config
|
@@ -134,7 +134,13 @@ module Google
|
|
134
134
|
|
135
135
|
# Create credentials
|
136
136
|
credentials = @config.credentials
|
137
|
-
|
137
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
138
|
+
# but only if the default endpoint does not have a region prefix.
|
139
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
140
|
+
@config.endpoint == Client.configure.endpoint &&
|
141
|
+
!@config.endpoint.split(".").first.include?("-")
|
142
|
+
credentials ||= Credentials.default scope: @config.scope,
|
143
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
138
144
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
139
145
|
credentials = Credentials.new credentials, scope: @config.scope
|
140
146
|
end
|
@@ -310,14 +316,14 @@ module Google
|
|
310
316
|
|
311
317
|
config_attr :endpoint, "dialogflow.googleapis.com", ::String
|
312
318
|
config_attr :credentials, nil do |value|
|
313
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
319
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
314
320
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
315
321
|
allowed.any? { |klass| klass === value }
|
316
322
|
end
|
317
323
|
config_attr :scope, nil, ::String, ::Array, nil
|
318
324
|
config_attr :lib_name, nil, ::String, nil
|
319
325
|
config_attr :lib_version, nil, ::String, nil
|
320
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
326
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
321
327
|
config_attr :interceptors, nil, ::Array, nil
|
322
328
|
config_attr :timeout, nil, ::Numeric, nil
|
323
329
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -338,7 +344,7 @@ module Google
|
|
338
344
|
def rpcs
|
339
345
|
@rpcs ||= begin
|
340
346
|
parent_rpcs = nil
|
341
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
347
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
342
348
|
Rpcs.new parent_rpcs
|
343
349
|
end
|
344
350
|
end
|
@@ -350,7 +356,7 @@ module Google
|
|
350
356
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
351
357
|
# the following configuration fields:
|
352
358
|
#
|
353
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
359
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
354
360
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
355
361
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
356
362
|
# include the following keys:
|
@@ -369,7 +375,7 @@ module Google
|
|
369
375
|
|
370
376
|
# @private
|
371
377
|
def initialize parent_rpcs = nil
|
372
|
-
list_environments_config = parent_rpcs
|
378
|
+
list_environments_config = parent_rpcs.list_environments if parent_rpcs.respond_to? :list_environments
|
373
379
|
@list_environments = ::Gapic::Config::Method.new list_environments_config
|
374
380
|
|
375
381
|
yield self if block_given?
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/dialogflow/v2/gcs.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/field_behavior_pb'
|
7
|
+
require 'google/api/annotations_pb'
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_file("google/cloud/dialogflow/v2/gcs.proto", :syntax => :proto3) do
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module Google
|
14
|
+
module Cloud
|
15
|
+
module Dialogflow
|
16
|
+
module V2
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/dialogflow/v2/human_agent_assistant_event.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/cloud/dialogflow/v2/participant_pb'
|
7
|
+
require 'google/api/annotations_pb'
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_file("google/cloud/dialogflow/v2/human_agent_assistant_event.proto", :syntax => :proto3) do
|
10
|
+
add_message "google.cloud.dialogflow.v2.HumanAgentAssistantEvent" do
|
11
|
+
optional :conversation, :string, 1
|
12
|
+
optional :participant, :string, 3
|
13
|
+
repeated :suggestion_results, :message, 5, "google.cloud.dialogflow.v2.SuggestionResult"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module Google
|
19
|
+
module Cloud
|
20
|
+
module Dialogflow
|
21
|
+
module V2
|
22
|
+
HumanAgentAssistantEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.HumanAgentAssistantEvent").msgclass
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -23,6 +23,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
23
23
|
optional :priority, :int32, 3
|
24
24
|
optional :is_fallback, :bool, 4
|
25
25
|
optional :ml_disabled, :bool, 19
|
26
|
+
optional :live_agent_handoff, :bool, 20
|
27
|
+
optional :end_interaction, :bool, 21
|
26
28
|
repeated :input_context_names, :string, 7
|
27
29
|
repeated :events, :string, 8
|
28
30
|
repeated :training_phrases, :message, 9, "google.cloud.dialogflow.v2.Intent.TrainingPhrase"
|
@@ -24,38 +24,7 @@ module Google
|
|
24
24
|
module Dialogflow
|
25
25
|
module V2
|
26
26
|
module Intents
|
27
|
-
#
|
28
|
-
# be taken by your application. When you pass user input to the
|
29
|
-
# [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or
|
30
|
-
# [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) method, the
|
31
|
-
# Dialogflow API analyzes the input and searches
|
32
|
-
# for a matching intent. If no match is found, the Dialogflow API returns a
|
33
|
-
# fallback intent (`is_fallback` = true).
|
34
|
-
#
|
35
|
-
# You can provide additional information for the Dialogflow API to use to
|
36
|
-
# match user input to an intent by adding the following to your intent.
|
37
|
-
#
|
38
|
-
# * **Contexts** - provide additional context for intent analysis. For
|
39
|
-
# example, if an intent is related to an object in your application that
|
40
|
-
# plays music, you can provide a context to determine when to match the
|
41
|
-
# intent if the user input is "turn it off". You can include a context
|
42
|
-
# that matches the intent when there is previous user input of
|
43
|
-
# "play music", and not when there is previous user input of
|
44
|
-
# "turn on the light".
|
45
|
-
#
|
46
|
-
# * **Events** - allow for matching an intent by using an event name
|
47
|
-
# instead of user input. Your application can provide an event name and
|
48
|
-
# related parameters to the Dialogflow API to match an intent. For
|
49
|
-
# example, when your application starts, you can send a welcome event
|
50
|
-
# with a user name parameter to the Dialogflow API to match an intent with
|
51
|
-
# a personalized welcome message for the user.
|
52
|
-
#
|
53
|
-
# * **Training phrases** - provide examples of user input to train the
|
54
|
-
# Dialogflow API agent to better match intents.
|
55
|
-
#
|
56
|
-
# For more information about intents, see the
|
57
|
-
# [Dialogflow
|
58
|
-
# documentation](https://cloud.google.com/dialogflow/docs/intents-overview).
|
27
|
+
# Service for managing [Intents][google.cloud.dialogflow.v2.Intent].
|
59
28
|
class Service
|
60
29
|
|
61
30
|
include GRPC::GenericService
|
@@ -65,23 +34,23 @@ module Google
|
|
65
34
|
self.service_name = 'google.cloud.dialogflow.v2.Intents'
|
66
35
|
|
67
36
|
# Returns the list of all intents in the specified agent.
|
68
|
-
rpc :ListIntents, ListIntentsRequest, ListIntentsResponse
|
37
|
+
rpc :ListIntents, ::Google::Cloud::Dialogflow::V2::ListIntentsRequest, ::Google::Cloud::Dialogflow::V2::ListIntentsResponse
|
69
38
|
# Retrieves the specified intent.
|
70
|
-
rpc :GetIntent, GetIntentRequest, Intent
|
39
|
+
rpc :GetIntent, ::Google::Cloud::Dialogflow::V2::GetIntentRequest, ::Google::Cloud::Dialogflow::V2::Intent
|
71
40
|
# Creates an intent in the specified agent.
|
72
|
-
rpc :CreateIntent, CreateIntentRequest, Intent
|
41
|
+
rpc :CreateIntent, ::Google::Cloud::Dialogflow::V2::CreateIntentRequest, ::Google::Cloud::Dialogflow::V2::Intent
|
73
42
|
# Updates the specified intent.
|
74
|
-
rpc :UpdateIntent, UpdateIntentRequest, Intent
|
43
|
+
rpc :UpdateIntent, ::Google::Cloud::Dialogflow::V2::UpdateIntentRequest, ::Google::Cloud::Dialogflow::V2::Intent
|
75
44
|
# Deletes the specified intent and its direct or indirect followup intents.
|
76
|
-
rpc :DeleteIntent, DeleteIntentRequest, Google::Protobuf::Empty
|
45
|
+
rpc :DeleteIntent, ::Google::Cloud::Dialogflow::V2::DeleteIntentRequest, ::Google::Protobuf::Empty
|
77
46
|
# Updates/Creates multiple intents in the specified agent.
|
78
47
|
#
|
79
48
|
# Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]>
|
80
|
-
rpc :BatchUpdateIntents, BatchUpdateIntentsRequest, Google::Longrunning::Operation
|
49
|
+
rpc :BatchUpdateIntents, ::Google::Cloud::Dialogflow::V2::BatchUpdateIntentsRequest, ::Google::Longrunning::Operation
|
81
50
|
# Deletes intents in the specified agent.
|
82
51
|
#
|
83
52
|
# Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
|
84
|
-
rpc :BatchDeleteIntents, BatchDeleteIntentsRequest, Google::Longrunning::Operation
|
53
|
+
rpc :BatchDeleteIntents, ::Google::Cloud::Dialogflow::V2::BatchDeleteIntentsRequest, ::Google::Longrunning::Operation
|
85
54
|
end
|
86
55
|
|
87
56
|
Stub = Service.rpc_stub_class
|
@@ -32,38 +32,7 @@ module Google
|
|
32
32
|
module Dialogflow
|
33
33
|
module V2
|
34
34
|
##
|
35
|
-
#
|
36
|
-
# be taken by your application. When you pass user input to the
|
37
|
-
# {::Google::Cloud::Dialogflow::V2::Sessions::Client#detect_intent DetectIntent} (or
|
38
|
-
# {::Google::Cloud::Dialogflow::V2::Sessions::Client#streaming_detect_intent StreamingDetectIntent}) method, the
|
39
|
-
# Dialogflow API analyzes the input and searches
|
40
|
-
# for a matching intent. If no match is found, the Dialogflow API returns a
|
41
|
-
# fallback intent (`is_fallback` = true).
|
42
|
-
#
|
43
|
-
# You can provide additional information for the Dialogflow API to use to
|
44
|
-
# match user input to an intent by adding the following to your intent.
|
45
|
-
#
|
46
|
-
# * **Contexts** - provide additional context for intent analysis. For
|
47
|
-
# example, if an intent is related to an object in your application that
|
48
|
-
# plays music, you can provide a context to determine when to match the
|
49
|
-
# intent if the user input is "turn it off". You can include a context
|
50
|
-
# that matches the intent when there is previous user input of
|
51
|
-
# "play music", and not when there is previous user input of
|
52
|
-
# "turn on the light".
|
53
|
-
#
|
54
|
-
# * **Events** - allow for matching an intent by using an event name
|
55
|
-
# instead of user input. Your application can provide an event name and
|
56
|
-
# related parameters to the Dialogflow API to match an intent. For
|
57
|
-
# example, when your application starts, you can send a welcome event
|
58
|
-
# with a user name parameter to the Dialogflow API to match an intent with
|
59
|
-
# a personalized welcome message for the user.
|
60
|
-
#
|
61
|
-
# * **Training phrases** - provide examples of user input to train the
|
62
|
-
# Dialogflow API agent to better match intents.
|
63
|
-
#
|
64
|
-
# For more information about intents, see the
|
65
|
-
# [Dialogflow
|
66
|
-
# documentation](https://cloud.google.com/dialogflow/docs/intents-overview).
|
35
|
+
# Service for managing {::Google::Cloud::Dialogflow::V2::Intent Intents}.
|
67
36
|
#
|
68
37
|
# To load this service and instantiate a client:
|
69
38
|
#
|
@@ -27,38 +27,7 @@ module Google
|
|
27
27
|
##
|
28
28
|
# Client for the Intents service.
|
29
29
|
#
|
30
|
-
#
|
31
|
-
# be taken by your application. When you pass user input to the
|
32
|
-
# {::Google::Cloud::Dialogflow::V2::Sessions::Client#detect_intent DetectIntent} (or
|
33
|
-
# {::Google::Cloud::Dialogflow::V2::Sessions::Client#streaming_detect_intent StreamingDetectIntent}) method, the
|
34
|
-
# Dialogflow API analyzes the input and searches
|
35
|
-
# for a matching intent. If no match is found, the Dialogflow API returns a
|
36
|
-
# fallback intent (`is_fallback` = true).
|
37
|
-
#
|
38
|
-
# You can provide additional information for the Dialogflow API to use to
|
39
|
-
# match user input to an intent by adding the following to your intent.
|
40
|
-
#
|
41
|
-
# * **Contexts** - provide additional context for intent analysis. For
|
42
|
-
# example, if an intent is related to an object in your application that
|
43
|
-
# plays music, you can provide a context to determine when to match the
|
44
|
-
# intent if the user input is "turn it off". You can include a context
|
45
|
-
# that matches the intent when there is previous user input of
|
46
|
-
# "play music", and not when there is previous user input of
|
47
|
-
# "turn on the light".
|
48
|
-
#
|
49
|
-
# * **Events** - allow for matching an intent by using an event name
|
50
|
-
# instead of user input. Your application can provide an event name and
|
51
|
-
# related parameters to the Dialogflow API to match an intent. For
|
52
|
-
# example, when your application starts, you can send a welcome event
|
53
|
-
# with a user name parameter to the Dialogflow API to match an intent with
|
54
|
-
# a personalized welcome message for the user.
|
55
|
-
#
|
56
|
-
# * **Training phrases** - provide examples of user input to train the
|
57
|
-
# Dialogflow API agent to better match intents.
|
58
|
-
#
|
59
|
-
# For more information about intents, see the
|
60
|
-
# [Dialogflow
|
61
|
-
# documentation](https://cloud.google.com/dialogflow/docs/intents-overview).
|
30
|
+
# Service for managing {::Google::Cloud::Dialogflow::V2::Intent Intents}.
|
62
31
|
#
|
63
32
|
class Client
|
64
33
|
include Paths
|
@@ -91,7 +60,7 @@ module Google
|
|
91
60
|
parent_config = while namespace.any?
|
92
61
|
parent_name = namespace.join "::"
|
93
62
|
parent_const = const_get parent_name
|
94
|
-
break parent_const.configure if parent_const
|
63
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
95
64
|
namespace.pop
|
96
65
|
end
|
97
66
|
default_config = Client::Configuration.new parent_config
|
@@ -99,9 +68,9 @@ module Google
|
|
99
68
|
default_config.timeout = 60.0
|
100
69
|
default_config.retry_policy = {
|
101
70
|
initial_delay: 0.1,
|
102
|
-
|
103
|
-
|
104
|
-
|
71
|
+
max_delay: 60.0,
|
72
|
+
multiplier: 1.3,
|
73
|
+
retry_codes: [14]
|
105
74
|
}
|
106
75
|
|
107
76
|
default_config
|
@@ -165,7 +134,13 @@ module Google
|
|
165
134
|
|
166
135
|
# Create credentials
|
167
136
|
credentials = @config.credentials
|
168
|
-
|
137
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
138
|
+
# but only if the default endpoint does not have a region prefix.
|
139
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
140
|
+
@config.endpoint == Client.configure.endpoint &&
|
141
|
+
!@config.endpoint.split(".").first.include?("-")
|
142
|
+
credentials ||= Credentials.default scope: @config.scope,
|
143
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
169
144
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
170
145
|
credentials = Credentials.new credentials, scope: @config.scope
|
171
146
|
end
|
@@ -816,14 +791,14 @@ module Google
|
|
816
791
|
|
817
792
|
config_attr :endpoint, "dialogflow.googleapis.com", ::String
|
818
793
|
config_attr :credentials, nil do |value|
|
819
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
794
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
820
795
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
821
796
|
allowed.any? { |klass| klass === value }
|
822
797
|
end
|
823
798
|
config_attr :scope, nil, ::String, ::Array, nil
|
824
799
|
config_attr :lib_name, nil, ::String, nil
|
825
800
|
config_attr :lib_version, nil, ::String, nil
|
826
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
801
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
827
802
|
config_attr :interceptors, nil, ::Array, nil
|
828
803
|
config_attr :timeout, nil, ::Numeric, nil
|
829
804
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -844,7 +819,7 @@ module Google
|
|
844
819
|
def rpcs
|
845
820
|
@rpcs ||= begin
|
846
821
|
parent_rpcs = nil
|
847
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
822
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
848
823
|
Rpcs.new parent_rpcs
|
849
824
|
end
|
850
825
|
end
|
@@ -856,7 +831,7 @@ module Google
|
|
856
831
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
857
832
|
# the following configuration fields:
|
858
833
|
#
|
859
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
834
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
860
835
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
861
836
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
862
837
|
# include the following keys:
|
@@ -905,19 +880,19 @@ module Google
|
|
905
880
|
|
906
881
|
# @private
|
907
882
|
def initialize parent_rpcs = nil
|
908
|
-
list_intents_config = parent_rpcs
|
883
|
+
list_intents_config = parent_rpcs.list_intents if parent_rpcs.respond_to? :list_intents
|
909
884
|
@list_intents = ::Gapic::Config::Method.new list_intents_config
|
910
|
-
get_intent_config = parent_rpcs
|
885
|
+
get_intent_config = parent_rpcs.get_intent if parent_rpcs.respond_to? :get_intent
|
911
886
|
@get_intent = ::Gapic::Config::Method.new get_intent_config
|
912
|
-
create_intent_config = parent_rpcs
|
887
|
+
create_intent_config = parent_rpcs.create_intent if parent_rpcs.respond_to? :create_intent
|
913
888
|
@create_intent = ::Gapic::Config::Method.new create_intent_config
|
914
|
-
update_intent_config = parent_rpcs
|
889
|
+
update_intent_config = parent_rpcs.update_intent if parent_rpcs.respond_to? :update_intent
|
915
890
|
@update_intent = ::Gapic::Config::Method.new update_intent_config
|
916
|
-
delete_intent_config = parent_rpcs
|
891
|
+
delete_intent_config = parent_rpcs.delete_intent if parent_rpcs.respond_to? :delete_intent
|
917
892
|
@delete_intent = ::Gapic::Config::Method.new delete_intent_config
|
918
|
-
batch_update_intents_config = parent_rpcs
|
893
|
+
batch_update_intents_config = parent_rpcs.batch_update_intents if parent_rpcs.respond_to? :batch_update_intents
|
919
894
|
@batch_update_intents = ::Gapic::Config::Method.new batch_update_intents_config
|
920
|
-
batch_delete_intents_config = parent_rpcs
|
895
|
+
batch_delete_intents_config = parent_rpcs.batch_delete_intents if parent_rpcs.respond_to? :batch_delete_intents
|
921
896
|
@batch_delete_intents = ::Gapic::Config::Method.new batch_delete_intents_config
|
922
897
|
|
923
898
|
yield self if block_given?
|
@@ -103,8 +103,13 @@ module Google
|
|
103
103
|
# Lists operations that match the specified filter in the request. If the
|
104
104
|
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
105
105
|
#
|
106
|
-
# NOTE: the `name` binding
|
107
|
-
# to use different resource name schemes, such as `users/*/operations`.
|
106
|
+
# NOTE: the `name` binding allows API services to override the binding
|
107
|
+
# to use different resource name schemes, such as `users/*/operations`. To
|
108
|
+
# override the binding, API services can add a binding such as
|
109
|
+
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
110
|
+
# For backwards compatibility, the default name includes the operations
|
111
|
+
# collection id, however overriding users must ensure the name binding
|
112
|
+
# is the parent resource, without the operations collection id.
|
108
113
|
#
|
109
114
|
# @overload list_operations(request, options = nil)
|
110
115
|
# Pass arguments to `list_operations` via a request object, either of type
|
@@ -122,7 +127,7 @@ module Google
|
|
122
127
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
123
128
|
#
|
124
129
|
# @param name [::String]
|
125
|
-
# The name of the operation
|
130
|
+
# The name of the operation's parent resource.
|
126
131
|
# @param filter [::String]
|
127
132
|
# The standard list filter.
|
128
133
|
# @param page_size [::Integer]
|
@@ -390,6 +395,79 @@ module Google
|
|
390
395
|
raise ::Google::Cloud::Error.from_error(e)
|
391
396
|
end
|
392
397
|
|
398
|
+
##
|
399
|
+
# Waits for the specified long-running operation until it is done or reaches
|
400
|
+
# at most a specified timeout, returning the latest state. If the operation
|
401
|
+
# is already done, the latest state is immediately returned. If the timeout
|
402
|
+
# specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
|
403
|
+
# timeout is used. If the server does not support this method, it returns
|
404
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
405
|
+
# Note that this method is on a best-effort basis. It may return the latest
|
406
|
+
# state before the specified timeout (including immediately), meaning even an
|
407
|
+
# immediate response is no guarantee that the operation is done.
|
408
|
+
#
|
409
|
+
# @overload wait_operation(request, options = nil)
|
410
|
+
# Pass arguments to `wait_operation` via a request object, either of type
|
411
|
+
# {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
|
412
|
+
#
|
413
|
+
# @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
|
414
|
+
# A request object representing the call parameters. Required. To specify no
|
415
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
416
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
417
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
418
|
+
#
|
419
|
+
# @overload wait_operation(name: nil, timeout: nil)
|
420
|
+
# Pass arguments to `wait_operation` via keyword arguments. Note that at
|
421
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
422
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
423
|
+
#
|
424
|
+
# @param name [::String]
|
425
|
+
# The name of the operation resource to wait on.
|
426
|
+
# @param timeout [::Google::Protobuf::Duration, ::Hash]
|
427
|
+
# The maximum duration to wait before timing out. If left blank, the wait
|
428
|
+
# will be at most the time permitted by the underlying HTTP/RPC protocol.
|
429
|
+
# If RPC context deadline is also specified, the shorter one will be used.
|
430
|
+
#
|
431
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
432
|
+
# @yieldparam response [::Gapic::Operation]
|
433
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
434
|
+
#
|
435
|
+
# @return [::Gapic::Operation]
|
436
|
+
#
|
437
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
438
|
+
#
|
439
|
+
def wait_operation request, options = nil
|
440
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
441
|
+
|
442
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
|
443
|
+
|
444
|
+
# Converts hash and nil to an options object
|
445
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
446
|
+
|
447
|
+
# Customize the options with defaults
|
448
|
+
metadata = @config.rpcs.wait_operation.metadata.to_h
|
449
|
+
|
450
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
451
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
452
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
453
|
+
gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
|
454
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
455
|
+
|
456
|
+
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
|
457
|
+
metadata: metadata,
|
458
|
+
retry_policy: @config.rpcs.wait_operation.retry_policy
|
459
|
+
options.apply_defaults metadata: @config.metadata,
|
460
|
+
retry_policy: @config.retry_policy
|
461
|
+
|
462
|
+
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
463
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
464
|
+
yield response, operation if block_given?
|
465
|
+
return response
|
466
|
+
end
|
467
|
+
rescue ::GRPC::BadStatus => e
|
468
|
+
raise ::Google::Cloud::Error.from_error(e)
|
469
|
+
end
|
470
|
+
|
393
471
|
##
|
394
472
|
# Configuration class for the Operations API.
|
395
473
|
#
|
@@ -475,14 +553,14 @@ module Google
|
|
475
553
|
|
476
554
|
config_attr :endpoint, "dialogflow.googleapis.com", ::String
|
477
555
|
config_attr :credentials, nil do |value|
|
478
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
556
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
479
557
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
480
558
|
allowed.any? { |klass| klass === value }
|
481
559
|
end
|
482
560
|
config_attr :scope, nil, ::String, ::Array, nil
|
483
561
|
config_attr :lib_name, nil, ::String, nil
|
484
562
|
config_attr :lib_version, nil, ::String, nil
|
485
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
563
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
486
564
|
config_attr :interceptors, nil, ::Array, nil
|
487
565
|
config_attr :timeout, nil, ::Numeric, nil
|
488
566
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -503,7 +581,7 @@ module Google
|
|
503
581
|
def rpcs
|
504
582
|
@rpcs ||= begin
|
505
583
|
parent_rpcs = nil
|
506
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
584
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
507
585
|
Rpcs.new parent_rpcs
|
508
586
|
end
|
509
587
|
end
|
@@ -515,7 +593,7 @@ module Google
|
|
515
593
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
516
594
|
# the following configuration fields:
|
517
595
|
#
|
518
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
596
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
519
597
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
520
598
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
521
599
|
# include the following keys:
|
@@ -546,17 +624,24 @@ module Google
|
|
546
624
|
# @return [::Gapic::Config::Method]
|
547
625
|
#
|
548
626
|
attr_reader :cancel_operation
|
627
|
+
##
|
628
|
+
# RPC-specific configuration for `wait_operation`
|
629
|
+
# @return [::Gapic::Config::Method]
|
630
|
+
#
|
631
|
+
attr_reader :wait_operation
|
549
632
|
|
550
633
|
# @private
|
551
634
|
def initialize parent_rpcs = nil
|
552
|
-
list_operations_config = parent_rpcs
|
635
|
+
list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
|
553
636
|
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
554
|
-
get_operation_config = parent_rpcs
|
637
|
+
get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
|
555
638
|
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
556
|
-
delete_operation_config = parent_rpcs
|
639
|
+
delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
|
557
640
|
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
558
|
-
cancel_operation_config = parent_rpcs
|
641
|
+
cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
|
559
642
|
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
643
|
+
wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
|
644
|
+
@wait_operation = ::Gapic::Config::Method.new wait_operation_config
|
560
645
|
|
561
646
|
yield self if block_given?
|
562
647
|
end
|