google-cloud-dialogflow-v2 0.6.4 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +188 -190
  3. data/README.md +66 -2
  4. data/lib/google/cloud/dialogflow/v2.rb +13 -2
  5. data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +26 -15
  6. data/lib/google/cloud/dialogflow/v2/agents/client.rb +40 -23
  7. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +96 -11
  8. data/lib/google/cloud/dialogflow/v2/agents/paths.rb +42 -3
  9. data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +100 -0
  10. data/lib/google/cloud/dialogflow/v2/answer_record_services_pb.rb +48 -0
  11. data/lib/google/cloud/dialogflow/v2/answer_records.rb +49 -0
  12. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +478 -0
  13. data/lib/google/cloud/dialogflow/v2/answer_records/credentials.rb +52 -0
  14. data/lib/google/cloud/dialogflow/v2/answer_records/paths.rb +105 -0
  15. data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +7 -0
  16. data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +8 -25
  17. data/lib/google/cloud/dialogflow/v2/contexts.rb +1 -18
  18. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +22 -33
  19. data/lib/google/cloud/dialogflow/v2/contexts/paths.rb +74 -2
  20. data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +39 -0
  21. data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +89 -0
  22. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +182 -0
  23. data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +61 -0
  24. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +49 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +699 -0
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/credentials.rb +52 -0
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +246 -0
  28. data/lib/google/cloud/dialogflow/v2/conversation_services_pb.rb +75 -0
  29. data/lib/google/cloud/dialogflow/v2/conversations.rb +49 -0
  30. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +757 -0
  31. data/lib/google/cloud/dialogflow/v2/conversations/credentials.rb +52 -0
  32. data/lib/google/cloud/dialogflow/v2/conversations/paths.rb +146 -0
  33. data/lib/google/cloud/dialogflow/v2/document_pb.rb +99 -0
  34. data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +73 -0
  35. data/lib/google/cloud/dialogflow/v2/documents.rb +50 -0
  36. data/lib/google/cloud/dialogflow/v2/documents/client.rb +810 -0
  37. data/lib/google/cloud/dialogflow/v2/documents/credentials.rb +52 -0
  38. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +655 -0
  39. data/lib/google/cloud/dialogflow/v2/documents/paths.rb +119 -0
  40. data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +40 -46
  41. data/lib/google/cloud/dialogflow/v2/entity_types.rb +1 -28
  42. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +54 -54
  43. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +96 -11
  44. data/lib/google/cloud/dialogflow/v2/entity_types/paths.rb +58 -12
  45. data/lib/google/cloud/dialogflow/v2/environment_pb.rb +50 -1
  46. data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +24 -3
  47. data/lib/google/cloud/dialogflow/v2/environments.rb +1 -1
  48. data/lib/google/cloud/dialogflow/v2/environments/client.rb +428 -12
  49. data/lib/google/cloud/dialogflow/v2/environments/paths.rb +145 -5
  50. data/lib/google/cloud/dialogflow/v2/fulfillment_pb.rb +59 -0
  51. data/lib/google/cloud/dialogflow/v2/fulfillment_services_pb.rb +47 -0
  52. data/lib/google/cloud/dialogflow/v2/fulfillments.rb +49 -0
  53. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +460 -0
  54. data/lib/google/cloud/dialogflow/v2/fulfillments/credentials.rb +52 -0
  55. data/lib/google/cloud/dialogflow/v2/fulfillments/paths.rb +69 -0
  56. data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +20 -0
  57. data/lib/google/cloud/dialogflow/v2/human_agent_assistant_event_pb.rb +26 -0
  58. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +2 -0
  59. data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +29 -42
  60. data/lib/google/cloud/dialogflow/v2/intents.rb +1 -32
  61. data/lib/google/cloud/dialogflow/v2/intents/client.rb +52 -51
  62. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +96 -11
  63. data/lib/google/cloud/dialogflow/v2/intents/paths.rb +97 -13
  64. data/lib/google/cloud/dialogflow/v2/knowledge_base_pb.rb +60 -0
  65. data/lib/google/cloud/dialogflow/v2/knowledge_base_services_pb.rb +53 -0
  66. data/lib/google/cloud/dialogflow/v2/knowledge_bases.rb +49 -0
  67. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +696 -0
  68. data/lib/google/cloud/dialogflow/v2/knowledge_bases/credentials.rb +52 -0
  69. data/lib/google/cloud/dialogflow/v2/knowledge_bases/paths.rb +105 -0
  70. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +181 -0
  71. data/lib/google/cloud/dialogflow/v2/participant_services_pb.rb +64 -0
  72. data/lib/google/cloud/dialogflow/v2/participants.rb +49 -0
  73. data/lib/google/cloud/dialogflow/v2/participants/client.rb +894 -0
  74. data/lib/google/cloud/dialogflow/v2/participants/credentials.rb +52 -0
  75. data/lib/google/cloud/dialogflow/v2/participants/paths.rb +334 -0
  76. data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +7 -23
  77. data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +1 -17
  78. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +21 -31
  79. data/lib/google/cloud/dialogflow/v2/session_entity_types/paths.rb +74 -2
  80. data/lib/google/cloud/dialogflow/v2/session_pb.rb +2 -0
  81. data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +15 -7
  82. data/lib/google/cloud/dialogflow/v2/sessions.rb +4 -4
  83. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +43 -21
  84. data/lib/google/cloud/dialogflow/v2/sessions/paths.rb +113 -3
  85. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  86. data/lib/google/cloud/dialogflow/v2/version_pb.rb +69 -0
  87. data/lib/google/cloud/dialogflow/v2/version_services_pb.rb +59 -0
  88. data/lib/google/cloud/dialogflow/v2/versions.rb +49 -0
  89. data/lib/google/cloud/dialogflow/v2/versions/client.rb +709 -0
  90. data/lib/google/cloud/dialogflow/v2/versions/credentials.rb +52 -0
  91. data/lib/google/cloud/dialogflow/v2/versions/paths.rb +110 -0
  92. data/proto_docs/google/api/field_behavior.rb +6 -0
  93. data/proto_docs/google/api/resource.rb +50 -14
  94. data/proto_docs/google/cloud/dialogflow/v2/agent.rb +1 -2
  95. data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +252 -0
  96. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +25 -0
  97. data/proto_docs/google/cloud/dialogflow/v2/context.rb +17 -2
  98. data/proto_docs/google/cloud/dialogflow/v2/conversation.rb +253 -0
  99. data/proto_docs/google/cloud/dialogflow/v2/conversation_event.rb +83 -0
  100. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +522 -0
  101. data/proto_docs/google/cloud/dialogflow/v2/document.rb +267 -0
  102. data/proto_docs/google/cloud/dialogflow/v2/entity_type.rb +12 -3
  103. data/proto_docs/google/cloud/dialogflow/v2/environment.rb +188 -6
  104. data/proto_docs/google/cloud/dialogflow/v2/fulfillment.rb +144 -0
  105. data/proto_docs/google/cloud/dialogflow/v2/human_agent_assistant_event.rb +45 -0
  106. data/proto_docs/google/cloud/dialogflow/v2/intent.rb +29 -4
  107. data/proto_docs/google/cloud/dialogflow/v2/knowledge_base.rb +139 -0
  108. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +525 -0
  109. data/proto_docs/google/cloud/dialogflow/v2/session.rb +56 -7
  110. data/proto_docs/google/cloud/dialogflow/v2/session_entity_type.rb +7 -6
  111. data/proto_docs/google/cloud/dialogflow/v2/validation_result.rb +1 -1
  112. data/proto_docs/google/cloud/dialogflow/v2/version.rb +176 -0
  113. data/proto_docs/google/cloud/dialogflow/v2/webhook.rb +2 -2
  114. data/proto_docs/google/longrunning/operations.rb +17 -3
  115. data/proto_docs/google/protobuf/any.rb +5 -2
  116. data/proto_docs/google/protobuf/timestamp.rb +10 -1
  117. data/proto_docs/google/type/latlng.rb +2 -2
  118. metadata +81 -11
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Dialogflow
24
+ module V2
25
+ module Fulfillments
26
+ # Credentials for the Fulfillments API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform",
30
+ "https://www.googleapis.com/auth/dialogflow"
31
+ ]
32
+ self.env_vars = [
33
+ "DIALOGFLOW_CREDENTIALS",
34
+ "DIALOGFLOW_KEYFILE",
35
+ "GOOGLE_CLOUD_CREDENTIALS",
36
+ "GOOGLE_CLOUD_KEYFILE",
37
+ "GCLOUD_KEYFILE",
38
+ "DIALOGFLOW_CREDENTIALS_JSON",
39
+ "DIALOGFLOW_KEYFILE_JSON",
40
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
41
+ "GOOGLE_CLOUD_KEYFILE_JSON",
42
+ "GCLOUD_KEYFILE_JSON"
43
+ ]
44
+ self.paths = [
45
+ "~/.config/google_cloud/application_default_credentials.json"
46
+ ]
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module Dialogflow
23
+ module V2
24
+ module Fulfillments
25
+ # Path helper methods for the Fulfillments API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified Fulfillment resource string.
29
+ #
30
+ # @overload fulfillment_path(project:)
31
+ # The resource will be in the following format:
32
+ #
33
+ # `projects/{project}/agent/fulfillment`
34
+ #
35
+ # @param project [String]
36
+ #
37
+ # @overload fulfillment_path(project:, location:)
38
+ # The resource will be in the following format:
39
+ #
40
+ # `projects/{project}/locations/{location}/agent/fulfillment`
41
+ #
42
+ # @param project [String]
43
+ # @param location [String]
44
+ #
45
+ # @return [::String]
46
+ def fulfillment_path **args
47
+ resources = {
48
+ "project" => (proc do |project:|
49
+ "projects/#{project}/agent/fulfillment"
50
+ end),
51
+ "location:project" => (proc do |project:, location:|
52
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
53
+
54
+ "projects/#{project}/locations/#{location}/agent/fulfillment"
55
+ end)
56
+ }
57
+
58
+ resource = resources[args.keys.sort.join(":")]
59
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
60
+ resource.call(**args)
61
+ end
62
+
63
+ extend self
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -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,64 +24,51 @@ module Google
24
24
  module Dialogflow
25
25
  module V2
26
26
  module Intents
27
- # An intent represents a mapping between input from a user and an action to
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
- include GRPC::GenericService
30
+ include ::GRPC::GenericService
62
31
 
63
32
  self.marshal_class_method = :encode
64
33
  self.unmarshal_class_method = :decode
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
+ #
42
+ # Note: You should always train an agent prior to sending it queries. See the
43
+ # [training
44
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
45
+ rpc :CreateIntent, ::Google::Cloud::Dialogflow::V2::CreateIntentRequest, ::Google::Cloud::Dialogflow::V2::Intent
73
46
  # Updates the specified intent.
74
- rpc :UpdateIntent, UpdateIntentRequest, Intent
47
+ #
48
+ # Note: You should always train an agent prior to sending it queries. See the
49
+ # [training
50
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
51
+ rpc :UpdateIntent, ::Google::Cloud::Dialogflow::V2::UpdateIntentRequest, ::Google::Cloud::Dialogflow::V2::Intent
75
52
  # Deletes the specified intent and its direct or indirect followup intents.
76
- rpc :DeleteIntent, DeleteIntentRequest, Google::Protobuf::Empty
53
+ #
54
+ # Note: You should always train an agent prior to sending it queries. See the
55
+ # [training
56
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
57
+ rpc :DeleteIntent, ::Google::Cloud::Dialogflow::V2::DeleteIntentRequest, ::Google::Protobuf::Empty
77
58
  # Updates/Creates multiple intents in the specified agent.
78
59
  #
79
- # Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]>
80
- rpc :BatchUpdateIntents, BatchUpdateIntentsRequest, Google::Longrunning::Operation
60
+ #
61
+ # Note: You should always train an agent prior to sending it queries. See the
62
+ # [training
63
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
64
+ rpc :BatchUpdateIntents, ::Google::Cloud::Dialogflow::V2::BatchUpdateIntentsRequest, ::Google::Longrunning::Operation
81
65
  # Deletes intents in the specified agent.
82
66
  #
83
- # Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
84
- rpc :BatchDeleteIntents, BatchDeleteIntentsRequest, Google::Longrunning::Operation
67
+ #
68
+ # Note: You should always train an agent prior to sending it queries. See the
69
+ # [training
70
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
71
+ rpc :BatchDeleteIntents, ::Google::Cloud::Dialogflow::V2::BatchDeleteIntentsRequest, ::Google::Longrunning::Operation
85
72
  end
86
73
 
87
74
  Stub = Service.rpc_stub_class
@@ -32,38 +32,7 @@ module Google
32
32
  module Dialogflow
33
33
  module V2
34
34
  ##
35
- # An intent represents a mapping between input from a user and an action to
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
- # An intent represents a mapping between input from a user and an action to
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&.respond_to? :configure
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
- max_delay: 60.0,
103
- multiplier: 1.3,
104
- retry_codes: ["UNAVAILABLE"]
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
- credentials ||= Credentials.default scope: @config.scope
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
@@ -215,7 +190,15 @@ module Google
215
190
  #
216
191
  # @param parent [::String]
217
192
  # Required. The agent to list all intents from.
218
- # Format: `projects/<Project ID>/agent`.
193
+ # Format: `projects/<Project ID>/agent` or `projects/<Project
194
+ # ID>/locations/<Location ID>/agent`.
195
+ #
196
+ # Alternatively, you can specify the environment to list intents for.
197
+ # Format: `projects/<Project ID>/agent/environments/<Environment ID>`
198
+ # or `projects/<Project ID>/locations/<Location
199
+ # ID>/agent/environments/<Environment ID>`.
200
+ # Note: training phrases of the intents will not be returned for non-draft
201
+ # environment.
219
202
  # @param language_code [::String]
220
203
  # Optional. The language used to access language-specific data.
221
204
  # If not specified, the agent's default language is used.
@@ -354,6 +337,10 @@ module Google
354
337
  ##
355
338
  # Creates an intent in the specified agent.
356
339
  #
340
+ # Note: You should always train an agent prior to sending it queries. See the
341
+ # [training
342
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
343
+ #
357
344
  # @overload create_intent(request, options = nil)
358
345
  # Pass arguments to `create_intent` via a request object, either of type
359
346
  # {::Google::Cloud::Dialogflow::V2::CreateIntentRequest} or an equivalent Hash.
@@ -431,6 +418,10 @@ module Google
431
418
  ##
432
419
  # Updates the specified intent.
433
420
  #
421
+ # Note: You should always train an agent prior to sending it queries. See the
422
+ # [training
423
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
424
+ #
434
425
  # @overload update_intent(request, options = nil)
435
426
  # Pass arguments to `update_intent` via a request object, either of type
436
427
  # {::Google::Cloud::Dialogflow::V2::UpdateIntentRequest} or an equivalent Hash.
@@ -507,6 +498,10 @@ module Google
507
498
  ##
508
499
  # Deletes the specified intent and its direct or indirect followup intents.
509
500
  #
501
+ # Note: You should always train an agent prior to sending it queries. See the
502
+ # [training
503
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
504
+ #
510
505
  # @overload delete_intent(request, options = nil)
511
506
  # Pass arguments to `delete_intent` via a request object, either of type
512
507
  # {::Google::Cloud::Dialogflow::V2::DeleteIntentRequest} or an equivalent Hash.
@@ -575,7 +570,10 @@ module Google
575
570
  ##
576
571
  # Updates/Creates multiple intents in the specified agent.
577
572
  #
578
- # Operation <response: {::Google::Cloud::Dialogflow::V2::BatchUpdateIntentsResponse BatchUpdateIntentsResponse}>
573
+ #
574
+ # Note: You should always train an agent prior to sending it queries. See the
575
+ # [training
576
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
579
577
  #
580
578
  # @overload batch_update_intents(request, options = nil)
581
579
  # Pass arguments to `batch_update_intents` via a request object, either of type
@@ -661,7 +659,10 @@ module Google
661
659
  ##
662
660
  # Deletes intents in the specified agent.
663
661
  #
664
- # Operation <response: {::Google::Protobuf::Empty google.protobuf.Empty}>
662
+ #
663
+ # Note: You should always train an agent prior to sending it queries. See the
664
+ # [training
665
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
665
666
  #
666
667
  # @overload batch_delete_intents(request, options = nil)
667
668
  # Pass arguments to `batch_delete_intents` via a request object, either of type
@@ -816,14 +817,14 @@ module Google
816
817
 
817
818
  config_attr :endpoint, "dialogflow.googleapis.com", ::String
818
819
  config_attr :credentials, nil do |value|
819
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
820
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
820
821
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
821
822
  allowed.any? { |klass| klass === value }
822
823
  end
823
824
  config_attr :scope, nil, ::String, ::Array, nil
824
825
  config_attr :lib_name, nil, ::String, nil
825
826
  config_attr :lib_version, nil, ::String, nil
826
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
827
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
827
828
  config_attr :interceptors, nil, ::Array, nil
828
829
  config_attr :timeout, nil, ::Numeric, nil
829
830
  config_attr :metadata, nil, ::Hash, nil
@@ -844,7 +845,7 @@ module Google
844
845
  def rpcs
845
846
  @rpcs ||= begin
846
847
  parent_rpcs = nil
847
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
848
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
848
849
  Rpcs.new parent_rpcs
849
850
  end
850
851
  end
@@ -856,7 +857,7 @@ module Google
856
857
  # Each configuration object is of type `Gapic::Config::Method` and includes
857
858
  # the following configuration fields:
858
859
  #
859
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
860
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
860
861
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
861
862
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
862
863
  # include the following keys:
@@ -905,19 +906,19 @@ module Google
905
906
 
906
907
  # @private
907
908
  def initialize parent_rpcs = nil
908
- list_intents_config = parent_rpcs&.list_intents if parent_rpcs&.respond_to? :list_intents
909
+ list_intents_config = parent_rpcs.list_intents if parent_rpcs.respond_to? :list_intents
909
910
  @list_intents = ::Gapic::Config::Method.new list_intents_config
910
- get_intent_config = parent_rpcs&.get_intent if parent_rpcs&.respond_to? :get_intent
911
+ get_intent_config = parent_rpcs.get_intent if parent_rpcs.respond_to? :get_intent
911
912
  @get_intent = ::Gapic::Config::Method.new get_intent_config
912
- create_intent_config = parent_rpcs&.create_intent if parent_rpcs&.respond_to? :create_intent
913
+ create_intent_config = parent_rpcs.create_intent if parent_rpcs.respond_to? :create_intent
913
914
  @create_intent = ::Gapic::Config::Method.new create_intent_config
914
- update_intent_config = parent_rpcs&.update_intent if parent_rpcs&.respond_to? :update_intent
915
+ update_intent_config = parent_rpcs.update_intent if parent_rpcs.respond_to? :update_intent
915
916
  @update_intent = ::Gapic::Config::Method.new update_intent_config
916
- delete_intent_config = parent_rpcs&.delete_intent if parent_rpcs&.respond_to? :delete_intent
917
+ delete_intent_config = parent_rpcs.delete_intent if parent_rpcs.respond_to? :delete_intent
917
918
  @delete_intent = ::Gapic::Config::Method.new delete_intent_config
918
- batch_update_intents_config = parent_rpcs&.batch_update_intents if parent_rpcs&.respond_to? :batch_update_intents
919
+ batch_update_intents_config = parent_rpcs.batch_update_intents if parent_rpcs.respond_to? :batch_update_intents
919
920
  @batch_update_intents = ::Gapic::Config::Method.new batch_update_intents_config
920
- batch_delete_intents_config = parent_rpcs&.batch_delete_intents if parent_rpcs&.respond_to? :batch_delete_intents
921
+ batch_delete_intents_config = parent_rpcs.batch_delete_intents if parent_rpcs.respond_to? :batch_delete_intents
921
922
  @batch_delete_intents = ::Gapic::Config::Method.new batch_delete_intents_config
922
923
 
923
924
  yield self if block_given?