google-cloud-dialogflow-v2 0.6.2 → 0.8.1
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 +13 -2
- data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +25 -40
- 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 +96 -11
- data/lib/google/cloud/dialogflow/v2/agents/paths.rb +42 -3
- data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +100 -0
- data/lib/google/cloud/dialogflow/v2/answer_record_services_pb.rb +48 -0
- data/lib/google/cloud/dialogflow/v2/answer_records.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +478 -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 +8 -25
- 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 +74 -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 +246 -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 +12 -39
- 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 +96 -11
- data/lib/google/cloud/dialogflow/v2/entity_types/paths.rb +58 -12
- data/lib/google/cloud/dialogflow/v2/environment_pb.rb +50 -1
- data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +24 -3
- data/lib/google/cloud/dialogflow/v2/environments.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/environments/client.rb +430 -14
- data/lib/google/cloud/dialogflow/v2/environments/paths.rb +104 -5
- data/lib/google/cloud/dialogflow/v2/fulfillment_pb.rb +59 -0
- data/lib/google/cloud/dialogflow/v2/fulfillment_services_pb.rb +47 -0
- data/lib/google/cloud/dialogflow/v2/fulfillments.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +460 -0
- data/lib/google/cloud/dialogflow/v2/fulfillments/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/fulfillments/paths.rb +69 -0
- 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 +9 -40
- data/lib/google/cloud/dialogflow/v2/intents.rb +1 -32
- data/lib/google/cloud/dialogflow/v2/intents/client.rb +34 -81
- data/lib/google/cloud/dialogflow/v2/intents/operations.rb +96 -11
- data/lib/google/cloud/dialogflow/v2/intents/paths.rb +97 -13
- 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 +334 -0
- data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +7 -23
- 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 +74 -2
- data/lib/google/cloud/dialogflow/v2/session_pb.rb +1 -0
- data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +15 -7
- 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 +113 -3
- data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/version_pb.rb +69 -0
- data/lib/google/cloud/dialogflow/v2/version_services_pb.rb +59 -0
- data/lib/google/cloud/dialogflow/v2/versions.rb +49 -0
- data/lib/google/cloud/dialogflow/v2/versions/client.rb +709 -0
- data/lib/google/cloud/dialogflow/v2/versions/credentials.rb +52 -0
- data/lib/google/cloud/dialogflow/v2/versions/paths.rb +110 -0
- 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 +252 -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 +522 -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 +187 -5
- data/proto_docs/google/cloud/dialogflow/v2/fulfillment.rb +144 -0
- data/proto_docs/google/cloud/dialogflow/v2/human_agent_assistant_event.rb +45 -0
- data/proto_docs/google/cloud/dialogflow/v2/intent.rb +29 -4
- 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/version.rb +176 -0
- 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 +73 -9
@@ -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,33 @@ 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
|
-
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
|
+
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 = {
|
68
|
+
default_config.timeout = 60.0
|
69
|
+
default_config.retry_policy = {
|
121
70
|
initial_delay: 0.1,
|
122
|
-
max_delay:
|
123
|
-
multiplier:
|
124
|
-
retry_codes:
|
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 = {
|
131
|
-
initial_delay: 0.1,
|
132
|
-
max_delay: 60.0,
|
133
|
-
multiplier: 1.3,
|
134
|
-
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
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
|
@@ -245,7 +190,15 @@ module Google
|
|
245
190
|
#
|
246
191
|
# @param parent [::String]
|
247
192
|
# Required. The agent to list all intents from.
|
248
|
-
# 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.
|
249
202
|
# @param language_code [::String]
|
250
203
|
# Optional. The language used to access language-specific data.
|
251
204
|
# If not specified, the agent's default language is used.
|
@@ -846,14 +799,14 @@ module Google
|
|
846
799
|
|
847
800
|
config_attr :endpoint, "dialogflow.googleapis.com", ::String
|
848
801
|
config_attr :credentials, nil do |value|
|
849
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
802
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
850
803
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
851
804
|
allowed.any? { |klass| klass === value }
|
852
805
|
end
|
853
806
|
config_attr :scope, nil, ::String, ::Array, nil
|
854
807
|
config_attr :lib_name, nil, ::String, nil
|
855
808
|
config_attr :lib_version, nil, ::String, nil
|
856
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
809
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
857
810
|
config_attr :interceptors, nil, ::Array, nil
|
858
811
|
config_attr :timeout, nil, ::Numeric, nil
|
859
812
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -874,7 +827,7 @@ module Google
|
|
874
827
|
def rpcs
|
875
828
|
@rpcs ||= begin
|
876
829
|
parent_rpcs = nil
|
877
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
830
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
878
831
|
Rpcs.new parent_rpcs
|
879
832
|
end
|
880
833
|
end
|
@@ -886,7 +839,7 @@ module Google
|
|
886
839
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
887
840
|
# the following configuration fields:
|
888
841
|
#
|
889
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
842
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
890
843
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
891
844
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
892
845
|
# include the following keys:
|
@@ -935,19 +888,19 @@ module Google
|
|
935
888
|
|
936
889
|
# @private
|
937
890
|
def initialize parent_rpcs = nil
|
938
|
-
list_intents_config = parent_rpcs
|
891
|
+
list_intents_config = parent_rpcs.list_intents if parent_rpcs.respond_to? :list_intents
|
939
892
|
@list_intents = ::Gapic::Config::Method.new list_intents_config
|
940
|
-
get_intent_config = parent_rpcs
|
893
|
+
get_intent_config = parent_rpcs.get_intent if parent_rpcs.respond_to? :get_intent
|
941
894
|
@get_intent = ::Gapic::Config::Method.new get_intent_config
|
942
|
-
create_intent_config = parent_rpcs
|
895
|
+
create_intent_config = parent_rpcs.create_intent if parent_rpcs.respond_to? :create_intent
|
943
896
|
@create_intent = ::Gapic::Config::Method.new create_intent_config
|
944
|
-
update_intent_config = parent_rpcs
|
897
|
+
update_intent_config = parent_rpcs.update_intent if parent_rpcs.respond_to? :update_intent
|
945
898
|
@update_intent = ::Gapic::Config::Method.new update_intent_config
|
946
|
-
delete_intent_config = parent_rpcs
|
899
|
+
delete_intent_config = parent_rpcs.delete_intent if parent_rpcs.respond_to? :delete_intent
|
947
900
|
@delete_intent = ::Gapic::Config::Method.new delete_intent_config
|
948
|
-
batch_update_intents_config = parent_rpcs
|
901
|
+
batch_update_intents_config = parent_rpcs.batch_update_intents if parent_rpcs.respond_to? :batch_update_intents
|
949
902
|
@batch_update_intents = ::Gapic::Config::Method.new batch_update_intents_config
|
950
|
-
batch_delete_intents_config = parent_rpcs
|
903
|
+
batch_delete_intents_config = parent_rpcs.batch_delete_intents if parent_rpcs.respond_to? :batch_delete_intents
|
951
904
|
@batch_delete_intents = ::Gapic::Config::Method.new batch_delete_intents_config
|
952
905
|
|
953
906
|
yield self if block_given?
|