google-cloud-dialogflow-v2 0.6.0 → 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 +70 -2
- data/lib/google/cloud/dialogflow/v2.rb +11 -2
- data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +24 -39
- data/lib/google/cloud/dialogflow/v2/agents.rb +1 -28
- data/lib/google/cloud/dialogflow/v2/agents/client.rb +41 -100
- data/lib/google/cloud/dialogflow/v2/agents/operations.rb +98 -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 +24 -63
- 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 +28 -91
- data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +98 -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 +19 -13
- 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 +25 -80
- data/lib/google/cloud/dialogflow/v2/intents/operations.rb +98 -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 +23 -53
- 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 +51 -15
- 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 +9 -1
- 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 -10
- data/lib/google/cloud/common_resources_pb.rb +0 -15
@@ -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,17 +60,17 @@ 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
|
67
67
|
|
68
|
-
default_config.
|
69
|
-
default_config.
|
68
|
+
default_config.timeout = 60.0
|
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 @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,47 +60,17 @@ 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
|
98
67
|
|
99
|
-
default_config.
|
100
|
-
default_config.
|
101
|
-
initial_delay: 0.1,
|
102
|
-
max_delay: 60.0,
|
103
|
-
multiplier: 1.3,
|
104
|
-
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
105
|
-
}
|
106
|
-
|
107
|
-
default_config.rpcs.get_intent.timeout = 60.0
|
108
|
-
default_config.rpcs.get_intent.retry_policy = {
|
109
|
-
initial_delay: 0.1,
|
110
|
-
max_delay: 60.0,
|
111
|
-
multiplier: 1.3,
|
112
|
-
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
113
|
-
}
|
114
|
-
|
115
|
-
default_config.rpcs.create_intent.timeout = 60.0
|
116
|
-
|
117
|
-
default_config.rpcs.update_intent.timeout = 60.0
|
118
|
-
|
119
|
-
default_config.rpcs.delete_intent.timeout = 60.0
|
120
|
-
default_config.rpcs.delete_intent.retry_policy = {
|
121
|
-
initial_delay: 0.1,
|
122
|
-
max_delay: 60.0,
|
123
|
-
multiplier: 1.3,
|
124
|
-
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
125
|
-
}
|
126
|
-
|
127
|
-
default_config.rpcs.batch_update_intents.timeout = 60.0
|
128
|
-
|
129
|
-
default_config.rpcs.batch_delete_intents.timeout = 60.0
|
130
|
-
default_config.rpcs.batch_delete_intents.retry_policy = {
|
68
|
+
default_config.timeout = 60.0
|
69
|
+
default_config.retry_policy = {
|
131
70
|
initial_delay: 0.1,
|
132
|
-
|
133
|
-
|
134
|
-
|
71
|
+
max_delay: 60.0,
|
72
|
+
multiplier: 1.3,
|
73
|
+
retry_codes: [14]
|
135
74
|
}
|
136
75
|
|
137
76
|
default_config
|
@@ -195,7 +134,13 @@ module Google
|
|
195
134
|
|
196
135
|
# Create credentials
|
197
136
|
credentials = @config.credentials
|
198
|
-
|
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
|
199
144
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
200
145
|
credentials = Credentials.new credentials, scope: @config.scope
|
201
146
|
end
|
@@ -846,14 +791,14 @@ module Google
|
|
846
791
|
|
847
792
|
config_attr :endpoint, "dialogflow.googleapis.com", ::String
|
848
793
|
config_attr :credentials, nil do |value|
|
849
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
794
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
850
795
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
851
796
|
allowed.any? { |klass| klass === value }
|
852
797
|
end
|
853
798
|
config_attr :scope, nil, ::String, ::Array, nil
|
854
799
|
config_attr :lib_name, nil, ::String, nil
|
855
800
|
config_attr :lib_version, nil, ::String, nil
|
856
|
-
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)
|
857
802
|
config_attr :interceptors, nil, ::Array, nil
|
858
803
|
config_attr :timeout, nil, ::Numeric, nil
|
859
804
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -874,7 +819,7 @@ module Google
|
|
874
819
|
def rpcs
|
875
820
|
@rpcs ||= begin
|
876
821
|
parent_rpcs = nil
|
877
|
-
parent_rpcs = @parent_config.rpcs if @parent_config
|
822
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
878
823
|
Rpcs.new parent_rpcs
|
879
824
|
end
|
880
825
|
end
|
@@ -886,7 +831,7 @@ module Google
|
|
886
831
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
887
832
|
# the following configuration fields:
|
888
833
|
#
|
889
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
834
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
890
835
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
891
836
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
892
837
|
# include the following keys:
|
@@ -935,19 +880,19 @@ module Google
|
|
935
880
|
|
936
881
|
# @private
|
937
882
|
def initialize parent_rpcs = nil
|
938
|
-
list_intents_config = parent_rpcs
|
883
|
+
list_intents_config = parent_rpcs.list_intents if parent_rpcs.respond_to? :list_intents
|
939
884
|
@list_intents = ::Gapic::Config::Method.new list_intents_config
|
940
|
-
get_intent_config = parent_rpcs
|
885
|
+
get_intent_config = parent_rpcs.get_intent if parent_rpcs.respond_to? :get_intent
|
941
886
|
@get_intent = ::Gapic::Config::Method.new get_intent_config
|
942
|
-
create_intent_config = parent_rpcs
|
887
|
+
create_intent_config = parent_rpcs.create_intent if parent_rpcs.respond_to? :create_intent
|
943
888
|
@create_intent = ::Gapic::Config::Method.new create_intent_config
|
944
|
-
update_intent_config = parent_rpcs
|
889
|
+
update_intent_config = parent_rpcs.update_intent if parent_rpcs.respond_to? :update_intent
|
945
890
|
@update_intent = ::Gapic::Config::Method.new update_intent_config
|
946
|
-
delete_intent_config = parent_rpcs
|
891
|
+
delete_intent_config = parent_rpcs.delete_intent if parent_rpcs.respond_to? :delete_intent
|
947
892
|
@delete_intent = ::Gapic::Config::Method.new delete_intent_config
|
948
|
-
batch_update_intents_config = parent_rpcs
|
893
|
+
batch_update_intents_config = parent_rpcs.batch_update_intents if parent_rpcs.respond_to? :batch_update_intents
|
949
894
|
@batch_update_intents = ::Gapic::Config::Method.new batch_update_intents_config
|
950
|
-
batch_delete_intents_config = parent_rpcs
|
895
|
+
batch_delete_intents_config = parent_rpcs.batch_delete_intents if parent_rpcs.respond_to? :batch_delete_intents
|
951
896
|
@batch_delete_intents = ::Gapic::Config::Method.new batch_delete_intents_config
|
952
897
|
|
953
898
|
yield self if block_given?
|