google-cloud-dialogflow-v2 0.13.0 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/dialogflow/v2/agents/client.rb +18 -0
  4. data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +0 -1
  5. data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +0 -2
  6. data/lib/google/cloud/dialogflow/v2/conversation_dataset_pb.rb +92 -0
  7. data/lib/google/cloud/dialogflow/v2/conversation_dataset_services_pb.rb +81 -0
  8. data/lib/google/cloud/dialogflow/v2/conversation_datasets/client.rb +849 -0
  9. data/lib/google/cloud/dialogflow/v2/conversation_datasets/credentials.rb +52 -0
  10. data/lib/google/cloud/dialogflow/v2/conversation_datasets/operations.rb +767 -0
  11. data/lib/google/cloud/dialogflow/v2/conversation_datasets/paths.rb +69 -0
  12. data/lib/google/cloud/dialogflow/v2/conversation_datasets.rb +53 -0
  13. data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +0 -1
  14. data/lib/google/cloud/dialogflow/v2/conversation_model_pb.rb +205 -0
  15. data/lib/google/cloud/dialogflow/v2/conversation_model_services_pb.rb +98 -0
  16. data/lib/google/cloud/dialogflow/v2/conversation_models/client.rb +1257 -0
  17. data/lib/google/cloud/dialogflow/v2/conversation_models/credentials.rb +52 -0
  18. data/lib/google/cloud/dialogflow/v2/conversation_models/operations.rb +767 -0
  19. data/lib/google/cloud/dialogflow/v2/conversation_models/paths.rb +179 -0
  20. data/lib/google/cloud/dialogflow/v2/conversation_models.rb +50 -0
  21. data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +0 -1
  22. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +31 -1
  23. data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +27 -0
  24. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +250 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_profiles/operations.rb +767 -0
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +31 -9
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +1 -0
  28. data/lib/google/cloud/dialogflow/v2/document_pb.rb +38 -0
  29. data/lib/google/cloud/dialogflow/v2/document_services_pb.rb +11 -0
  30. data/lib/google/cloud/dialogflow/v2/documents/client.rb +123 -0
  31. data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +4 -1
  32. data/lib/google/cloud/dialogflow/v2/human_agent_assistant_event_pb.rb +0 -1
  33. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +0 -2
  34. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +22 -3
  35. data/lib/google/cloud/dialogflow/v2/participant_services_pb.rb +3 -0
  36. data/lib/google/cloud/dialogflow/v2/participants/client.rb +113 -4
  37. data/lib/google/cloud/dialogflow/v2/session_pb.rb +0 -1
  38. data/lib/google/cloud/dialogflow/v2/validation_result_pb.rb +0 -1
  39. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  40. data/lib/google/cloud/dialogflow/v2/webhook_pb.rb +0 -1
  41. data/lib/google/cloud/dialogflow/v2.rb +4 -0
  42. data/proto_docs/google/cloud/dialogflow/v2/agent.rb +18 -0
  43. data/proto_docs/google/cloud/dialogflow/v2/conversation_dataset.rb +211 -0
  44. data/proto_docs/google/cloud/dialogflow/v2/conversation_model.rb +522 -0
  45. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +100 -2
  46. data/proto_docs/google/cloud/dialogflow/v2/document.rb +104 -0
  47. data/proto_docs/google/cloud/dialogflow/v2/gcs.rb +11 -0
  48. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +88 -6
  49. data/proto_docs/google/cloud/dialogflow/v2/session.rb +5 -0
  50. metadata +20 -3
@@ -82,20 +82,42 @@ module Google
82
82
  ##
83
83
  # Create a fully-qualified ConversationModel resource string.
84
84
  #
85
- # The resource will be in the following format:
85
+ # @overload conversation_model_path(project:, location:, conversation_model:)
86
+ # The resource will be in the following format:
86
87
  #
87
- # `projects/{project}/locations/{location}/conversationModels/{conversation_model}`
88
+ # `projects/{project}/locations/{location}/conversationModels/{conversation_model}`
88
89
  #
89
- # @param project [String]
90
- # @param location [String]
91
- # @param conversation_model [String]
90
+ # @param project [String]
91
+ # @param location [String]
92
+ # @param conversation_model [String]
93
+ #
94
+ # @overload conversation_model_path(project:, conversation_model:)
95
+ # The resource will be in the following format:
96
+ #
97
+ # `projects/{project}/conversationModels/{conversation_model}`
98
+ #
99
+ # @param project [String]
100
+ # @param conversation_model [String]
92
101
  #
93
102
  # @return [::String]
94
- def conversation_model_path project:, location:, conversation_model:
95
- raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
96
- raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
103
+ def conversation_model_path **args
104
+ resources = {
105
+ "conversation_model:location:project" => (proc do |project:, location:, conversation_model:|
106
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
107
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
108
+
109
+ "projects/#{project}/locations/#{location}/conversationModels/#{conversation_model}"
110
+ end),
111
+ "conversation_model:project" => (proc do |project:, conversation_model:|
112
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
97
113
 
98
- "projects/#{project}/locations/#{location}/conversationModels/#{conversation_model}"
114
+ "projects/#{project}/conversationModels/#{conversation_model}"
115
+ end)
116
+ }
117
+
118
+ resource = resources[args.keys.sort.join(":")]
119
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
120
+ resource.call(**args)
99
121
  end
100
122
 
101
123
  ##
@@ -24,6 +24,7 @@ require "google/cloud/dialogflow/v2/version"
24
24
 
25
25
  require "google/cloud/dialogflow/v2/conversation_profiles/credentials"
26
26
  require "google/cloud/dialogflow/v2/conversation_profiles/paths"
27
+ require "google/cloud/dialogflow/v2/conversation_profiles/operations"
27
28
  require "google/cloud/dialogflow/v2/conversation_profiles/client"
28
29
 
29
30
  module Google
@@ -22,6 +22,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
22
22
  optional :enable_auto_reload, :bool, 11
23
23
  optional :latest_reload_status, :message, 12, "google.cloud.dialogflow.v2.Document.ReloadStatus"
24
24
  map :metadata, :string, :string, 7
25
+ optional :state, :enum, 13, "google.cloud.dialogflow.v2.Document.State"
25
26
  oneof :source do
26
27
  optional :content_uri, :string, 5
27
28
  optional :raw_content, :bytes, 9
@@ -36,6 +37,15 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
36
37
  value :FAQ, 1
37
38
  value :EXTRACTIVE_QA, 2
38
39
  value :ARTICLE_SUGGESTION, 3
40
+ value :AGENT_FACING_SMART_REPLY, 4
41
+ end
42
+ add_enum "google.cloud.dialogflow.v2.Document.State" do
43
+ value :STATE_UNSPECIFIED, 0
44
+ value :CREATING, 1
45
+ value :ACTIVE, 2
46
+ value :UPDATING, 3
47
+ value :RELOADING, 4
48
+ value :DELETING, 5
39
49
  end
40
50
  add_message "google.cloud.dialogflow.v2.GetDocumentRequest" do
41
51
  optional :name, :string, 1
@@ -54,6 +64,22 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
54
64
  optional :parent, :string, 1
55
65
  optional :document, :message, 2, "google.cloud.dialogflow.v2.Document"
56
66
  end
67
+ add_message "google.cloud.dialogflow.v2.ImportDocumentsRequest" do
68
+ optional :parent, :string, 1
69
+ optional :document_template, :message, 3, "google.cloud.dialogflow.v2.ImportDocumentTemplate"
70
+ optional :import_gcs_custom_metadata, :bool, 4
71
+ oneof :source do
72
+ optional :gcs_source, :message, 2, "google.cloud.dialogflow.v2.GcsSources"
73
+ end
74
+ end
75
+ add_message "google.cloud.dialogflow.v2.ImportDocumentTemplate" do
76
+ optional :mime_type, :string, 1
77
+ repeated :knowledge_types, :enum, 2, "google.cloud.dialogflow.v2.Document.KnowledgeType"
78
+ map :metadata, :string, :string, 3
79
+ end
80
+ add_message "google.cloud.dialogflow.v2.ImportDocumentsResponse" do
81
+ repeated :warnings, :message, 1, "google.rpc.Status"
82
+ end
57
83
  add_message "google.cloud.dialogflow.v2.DeleteDocumentRequest" do
58
84
  optional :name, :string, 1
59
85
  end
@@ -77,8 +103,15 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
77
103
  optional :gcs_destination, :message, 2, "google.cloud.dialogflow.v2.GcsDestination"
78
104
  end
79
105
  end
106
+ add_message "google.cloud.dialogflow.v2.ExportOperationMetadata" do
107
+ optional :exported_gcs_destination, :message, 1, "google.cloud.dialogflow.v2.GcsDestination"
108
+ end
80
109
  add_message "google.cloud.dialogflow.v2.KnowledgeOperationMetadata" do
81
110
  optional :state, :enum, 1, "google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State"
111
+ optional :knowledge_base, :string, 3
112
+ oneof :operation_metadata do
113
+ optional :export_operation_metadata, :message, 4, "google.cloud.dialogflow.v2.ExportOperationMetadata"
114
+ end
82
115
  end
83
116
  add_enum "google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State" do
84
117
  value :STATE_UNSPECIFIED, 0
@@ -96,14 +129,19 @@ module Google
96
129
  Document = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Document").msgclass
97
130
  Document::ReloadStatus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Document.ReloadStatus").msgclass
98
131
  Document::KnowledgeType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Document.KnowledgeType").enummodule
132
+ Document::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.Document.State").enummodule
99
133
  GetDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GetDocumentRequest").msgclass
100
134
  ListDocumentsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListDocumentsRequest").msgclass
101
135
  ListDocumentsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ListDocumentsResponse").msgclass
102
136
  CreateDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.CreateDocumentRequest").msgclass
137
+ ImportDocumentsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ImportDocumentsRequest").msgclass
138
+ ImportDocumentTemplate = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ImportDocumentTemplate").msgclass
139
+ ImportDocumentsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ImportDocumentsResponse").msgclass
103
140
  DeleteDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.DeleteDocumentRequest").msgclass
104
141
  UpdateDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.UpdateDocumentRequest").msgclass
105
142
  ReloadDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ReloadDocumentRequest").msgclass
106
143
  ExportDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ExportDocumentRequest").msgclass
144
+ ExportOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ExportOperationMetadata").msgclass
107
145
  KnowledgeOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.KnowledgeOperationMetadata").msgclass
108
146
  KnowledgeOperationMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State").enummodule
109
147
  end
@@ -46,6 +46,17 @@ module Google
46
46
  # - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
47
47
  # - `response`: [Document][google.cloud.dialogflow.v2.Document]
48
48
  rpc :CreateDocument, ::Google::Cloud::Dialogflow::V2::CreateDocumentRequest, ::Google::Longrunning::Operation
49
+ # Creates documents by importing data from external sources.
50
+ # Dialogflow supports up to 350 documents in each request. If you try to
51
+ # import more, Dialogflow will return an error.
52
+ #
53
+ # This method is a [long-running
54
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
55
+ # The returned `Operation` type has the following method-specific fields:
56
+ #
57
+ # - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
58
+ # - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]
59
+ rpc :ImportDocuments, ::Google::Cloud::Dialogflow::V2::ImportDocumentsRequest, ::Google::Longrunning::Operation
49
60
  # Deletes the specified document.
50
61
  #
51
62
  # This method is a [long-running
@@ -474,6 +474,122 @@ module Google
474
474
  raise ::Google::Cloud::Error.from_error(e)
475
475
  end
476
476
 
477
+ ##
478
+ # Creates documents by importing data from external sources.
479
+ # Dialogflow supports up to 350 documents in each request. If you try to
480
+ # import more, Dialogflow will return an error.
481
+ #
482
+ # This method is a [long-running
483
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
484
+ # The returned `Operation` type has the following method-specific fields:
485
+ #
486
+ # - `metadata`: {::Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata KnowledgeOperationMetadata}
487
+ # - `response`: {::Google::Cloud::Dialogflow::V2::ImportDocumentsResponse ImportDocumentsResponse}
488
+ #
489
+ # @overload import_documents(request, options = nil)
490
+ # Pass arguments to `import_documents` via a request object, either of type
491
+ # {::Google::Cloud::Dialogflow::V2::ImportDocumentsRequest} or an equivalent Hash.
492
+ #
493
+ # @param request [::Google::Cloud::Dialogflow::V2::ImportDocumentsRequest, ::Hash]
494
+ # A request object representing the call parameters. Required. To specify no
495
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
496
+ # @param options [::Gapic::CallOptions, ::Hash]
497
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
498
+ #
499
+ # @overload import_documents(parent: nil, gcs_source: nil, document_template: nil, import_gcs_custom_metadata: nil)
500
+ # Pass arguments to `import_documents` via keyword arguments. Note that at
501
+ # least one keyword argument is required. To specify no parameters, or to keep all
502
+ # the default parameter values, pass an empty Hash as a request object (see above).
503
+ #
504
+ # @param parent [::String]
505
+ # Required. The knowledge base to import documents into.
506
+ # Format: `projects/<Project ID>/locations/<Location
507
+ # ID>/knowledgeBases/<Knowledge Base ID>`.
508
+ # @param gcs_source [::Google::Cloud::Dialogflow::V2::GcsSources, ::Hash]
509
+ # The Google Cloud Storage location for the documents.
510
+ # The path can include a wildcard.
511
+ #
512
+ # These URIs may have the forms
513
+ # `gs://<bucket-name>/<object-name>`.
514
+ # `gs://<bucket-name>/<object-path>/*.<extension>`.
515
+ # @param document_template [::Google::Cloud::Dialogflow::V2::ImportDocumentTemplate, ::Hash]
516
+ # Required. Document template used for importing all the documents.
517
+ # @param import_gcs_custom_metadata [::Boolean]
518
+ # Whether to import custom metadata from Google Cloud Storage.
519
+ # Only valid when the document source is Google Cloud Storage URI.
520
+ #
521
+ # @yield [response, operation] Access the result along with the RPC operation
522
+ # @yieldparam response [::Gapic::Operation]
523
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
524
+ #
525
+ # @return [::Gapic::Operation]
526
+ #
527
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
528
+ #
529
+ # @example Basic example
530
+ # require "google/cloud/dialogflow/v2"
531
+ #
532
+ # # Create a client object. The client can be reused for multiple calls.
533
+ # client = Google::Cloud::Dialogflow::V2::Documents::Client.new
534
+ #
535
+ # # Create a request. To set request fields, pass in keyword arguments.
536
+ # request = Google::Cloud::Dialogflow::V2::ImportDocumentsRequest.new
537
+ #
538
+ # # Call the import_documents method.
539
+ # result = client.import_documents request
540
+ #
541
+ # # The returned object is of type Gapic::Operation. You can use this
542
+ # # object to check the status of an operation, cancel it, or wait
543
+ # # for results. Here is how to block until completion:
544
+ # result.wait_until_done! timeout: 60
545
+ # if result.response?
546
+ # p result.response
547
+ # else
548
+ # puts "Error!"
549
+ # end
550
+ #
551
+ def import_documents request, options = nil
552
+ raise ::ArgumentError, "request must be provided" if request.nil?
553
+
554
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ImportDocumentsRequest
555
+
556
+ # Converts hash and nil to an options object
557
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
558
+
559
+ # Customize the options with defaults
560
+ metadata = @config.rpcs.import_documents.metadata.to_h
561
+
562
+ # Set x-goog-api-client and x-goog-user-project headers
563
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
564
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
565
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
566
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
567
+
568
+ header_params = {}
569
+ if request.parent
570
+ header_params["parent"] = request.parent
571
+ end
572
+
573
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
574
+ metadata[:"x-goog-request-params"] ||= request_params_header
575
+
576
+ options.apply_defaults timeout: @config.rpcs.import_documents.timeout,
577
+ metadata: metadata,
578
+ retry_policy: @config.rpcs.import_documents.retry_policy
579
+
580
+ options.apply_defaults timeout: @config.timeout,
581
+ metadata: @config.metadata,
582
+ retry_policy: @config.retry_policy
583
+
584
+ @documents_stub.call_rpc :import_documents, request, options: options do |response, operation|
585
+ response = ::Gapic::Operation.new response, @operations_client, options: options
586
+ yield response, operation if block_given?
587
+ return response
588
+ end
589
+ rescue ::GRPC::BadStatus => e
590
+ raise ::Google::Cloud::Error.from_error(e)
591
+ end
592
+
477
593
  ##
478
594
  # Deletes the specified document.
479
595
  #
@@ -1063,6 +1179,11 @@ module Google
1063
1179
  #
1064
1180
  attr_reader :create_document
1065
1181
  ##
1182
+ # RPC-specific configuration for `import_documents`
1183
+ # @return [::Gapic::Config::Method]
1184
+ #
1185
+ attr_reader :import_documents
1186
+ ##
1066
1187
  # RPC-specific configuration for `delete_document`
1067
1188
  # @return [::Gapic::Config::Method]
1068
1189
  #
@@ -1091,6 +1212,8 @@ module Google
1091
1212
  @get_document = ::Gapic::Config::Method.new get_document_config
1092
1213
  create_document_config = parent_rpcs.create_document if parent_rpcs.respond_to? :create_document
1093
1214
  @create_document = ::Gapic::Config::Method.new create_document_config
1215
+ import_documents_config = parent_rpcs.import_documents if parent_rpcs.respond_to? :import_documents
1216
+ @import_documents = ::Gapic::Config::Method.new import_documents_config
1094
1217
  delete_document_config = parent_rpcs.delete_document if parent_rpcs.respond_to? :delete_document
1095
1218
  @delete_document = ::Gapic::Config::Method.new delete_document_config
1096
1219
  update_document_config = parent_rpcs.update_document if parent_rpcs.respond_to? :update_document
@@ -2,11 +2,13 @@
2
2
  # source: google/cloud/dialogflow/v2/gcs.proto
3
3
 
4
4
  require 'google/api/field_behavior_pb'
5
- require 'google/api/annotations_pb'
6
5
  require 'google/protobuf'
7
6
 
8
7
  Google::Protobuf::DescriptorPool.generated_pool.build do
9
8
  add_file("google/cloud/dialogflow/v2/gcs.proto", :syntax => :proto3) do
9
+ add_message "google.cloud.dialogflow.v2.GcsSources" do
10
+ repeated :uris, :string, 2
11
+ end
10
12
  add_message "google.cloud.dialogflow.v2.GcsDestination" do
11
13
  optional :uri, :string, 1
12
14
  end
@@ -17,6 +19,7 @@ module Google
17
19
  module Cloud
18
20
  module Dialogflow
19
21
  module V2
22
+ GcsSources = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GcsSources").msgclass
20
23
  GcsDestination = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.GcsDestination").msgclass
21
24
  end
22
25
  end
@@ -2,7 +2,6 @@
2
2
  # source: google/cloud/dialogflow/v2/human_agent_assistant_event.proto
3
3
 
4
4
  require 'google/cloud/dialogflow/v2/participant_pb'
5
- require 'google/api/annotations_pb'
6
5
  require 'google/protobuf'
7
6
 
8
7
  Google::Protobuf::DescriptorPool.generated_pool.build do
@@ -5,10 +5,8 @@ require 'google/api/annotations_pb'
5
5
  require 'google/api/client_pb'
6
6
  require 'google/api/field_behavior_pb'
7
7
  require 'google/api/resource_pb'
8
- require 'google/cloud/dialogflow/v2/audio_config_pb'
9
8
  require 'google/cloud/dialogflow/v2/context_pb'
10
9
  require 'google/longrunning/operations_pb'
11
- require 'google/protobuf/duration_pb'
12
10
  require 'google/protobuf/empty_pb'
13
11
  require 'google/protobuf/field_mask_pb'
14
12
  require 'google/protobuf/struct_pb'
@@ -6,10 +6,7 @@ require 'google/api/client_pb'
6
6
  require 'google/api/field_behavior_pb'
7
7
  require 'google/api/resource_pb'
8
8
  require 'google/cloud/dialogflow/v2/audio_config_pb'
9
- require 'google/cloud/dialogflow/v2/gcs_pb'
10
9
  require 'google/cloud/dialogflow/v2/session_pb'
11
- require 'google/protobuf/any_pb'
12
- require 'google/protobuf/duration_pb'
13
10
  require 'google/protobuf/field_mask_pb'
14
11
  require 'google/protobuf/struct_pb'
15
12
  require 'google/protobuf/timestamp_pb'
@@ -37,7 +34,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
37
34
  optional :participant, :string, 4
38
35
  optional :participant_role, :enum, 5, "google.cloud.dialogflow.v2.Participant.Role"
39
36
  optional :create_time, :message, 6, "google.protobuf.Timestamp"
37
+ optional :send_time, :message, 9, "google.protobuf.Timestamp"
40
38
  optional :message_annotation, :message, 7, "google.cloud.dialogflow.v2.MessageAnnotation"
39
+ optional :sentiment_analysis, :message, 8, "google.cloud.dialogflow.v2.SentimentAnalysisResult"
41
40
  end
42
41
  add_message "google.cloud.dialogflow.v2.CreateParticipantRequest" do
43
42
  optional :parent, :string, 1
@@ -104,6 +103,17 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
104
103
  optional :latest_message, :string, 2
105
104
  optional :context_size, :int32, 3
106
105
  end
106
+ add_message "google.cloud.dialogflow.v2.SuggestSmartRepliesRequest" do
107
+ optional :parent, :string, 1
108
+ optional :current_text_input, :message, 4, "google.cloud.dialogflow.v2.TextInput"
109
+ optional :latest_message, :string, 2
110
+ optional :context_size, :int32, 3
111
+ end
112
+ add_message "google.cloud.dialogflow.v2.SuggestSmartRepliesResponse" do
113
+ repeated :smart_reply_answers, :message, 1, "google.cloud.dialogflow.v2.SmartReplyAnswer"
114
+ optional :latest_message, :string, 2
115
+ optional :context_size, :int32, 3
116
+ end
107
117
  add_message "google.cloud.dialogflow.v2.OutputAudio" do
108
118
  optional :config, :message, 1, "google.cloud.dialogflow.v2.OutputAudioConfig"
109
119
  optional :audio, :bytes, 2
@@ -134,11 +144,17 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
134
144
  map :metadata, :string, :string, 5
135
145
  optional :answer_record, :string, 6
136
146
  end
147
+ add_message "google.cloud.dialogflow.v2.SmartReplyAnswer" do
148
+ optional :reply, :string, 1
149
+ optional :confidence, :float, 2
150
+ optional :answer_record, :string, 3
151
+ end
137
152
  add_message "google.cloud.dialogflow.v2.SuggestionResult" do
138
153
  oneof :suggestion_response do
139
154
  optional :error, :message, 1, "google.rpc.Status"
140
155
  optional :suggest_articles_response, :message, 2, "google.cloud.dialogflow.v2.SuggestArticlesResponse"
141
156
  optional :suggest_faq_answers_response, :message, 3, "google.cloud.dialogflow.v2.SuggestFaqAnswersResponse"
157
+ optional :suggest_smart_replies_response, :message, 4, "google.cloud.dialogflow.v2.SuggestSmartRepliesResponse"
142
158
  end
143
159
  end
144
160
  add_message "google.cloud.dialogflow.v2.AnnotatedMessagePart" do
@@ -175,11 +191,14 @@ module Google
175
191
  SuggestArticlesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SuggestArticlesResponse").msgclass
176
192
  SuggestFaqAnswersRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SuggestFaqAnswersRequest").msgclass
177
193
  SuggestFaqAnswersResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SuggestFaqAnswersResponse").msgclass
194
+ SuggestSmartRepliesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SuggestSmartRepliesRequest").msgclass
195
+ SuggestSmartRepliesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SuggestSmartRepliesResponse").msgclass
178
196
  OutputAudio = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.OutputAudio").msgclass
179
197
  AutomatedAgentReply = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.AutomatedAgentReply").msgclass
180
198
  AutomatedAgentReply::AutomatedAgentReplyType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.AutomatedAgentReply.AutomatedAgentReplyType").enummodule
181
199
  ArticleAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.ArticleAnswer").msgclass
182
200
  FaqAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.FaqAnswer").msgclass
201
+ SmartReplyAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SmartReplyAnswer").msgclass
183
202
  SuggestionResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SuggestionResult").msgclass
184
203
  AnnotatedMessagePart = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.AnnotatedMessagePart").msgclass
185
204
  MessageAnnotation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.MessageAnnotation").msgclass
@@ -54,6 +54,9 @@ module Google
54
54
  # Gets suggested faq answers for a participant based on specific historical
55
55
  # messages.
56
56
  rpc :SuggestFaqAnswers, ::Google::Cloud::Dialogflow::V2::SuggestFaqAnswersRequest, ::Google::Cloud::Dialogflow::V2::SuggestFaqAnswersResponse
57
+ # Gets smart replies for a participant based on specific historical
58
+ # messages.
59
+ rpc :SuggestSmartReplies, ::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesRequest, ::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesResponse
57
60
  end
58
61
 
59
62
  Stub = Service.rpc_stub_class
@@ -650,13 +650,13 @@ module Google
650
650
  # Format: `projects/<Project ID>/locations/<Location
651
651
  # ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
652
652
  # @param latest_message [::String]
653
- # The name of the latest conversation message to compile suggestion
653
+ # Optional. The name of the latest conversation message to compile suggestion
654
654
  # for. If empty, it will be the latest message of the conversation.
655
655
  #
656
656
  # Format: `projects/<Project ID>/locations/<Location
657
657
  # ID>/conversations/<Conversation ID>/messages/<Message ID>`.
658
658
  # @param context_size [::Integer]
659
- # Max number of messages prior to and including
659
+ # Optional. Max number of messages prior to and including
660
660
  # {::Google::Cloud::Dialogflow::V2::SuggestArticlesRequest#latest_message latest_message} to use as context
661
661
  # when compiling the suggestion. By default 20 and at most 50.
662
662
  # @param assist_query_params [::Google::Cloud::Dialogflow::V2::AssistQueryParameters, ::Hash]
@@ -750,13 +750,13 @@ module Google
750
750
  # Format: `projects/<Project ID>/locations/<Location
751
751
  # ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
752
752
  # @param latest_message [::String]
753
- # The name of the latest conversation message to compile suggestion
753
+ # Optional. The name of the latest conversation message to compile suggestion
754
754
  # for. If empty, it will be the latest message of the conversation.
755
755
  #
756
756
  # Format: `projects/<Project ID>/locations/<Location
757
757
  # ID>/conversations/<Conversation ID>/messages/<Message ID>`.
758
758
  # @param context_size [::Integer]
759
- # Max number of messages prior to and including
759
+ # Optional. Max number of messages prior to and including
760
760
  # [latest_message] to use as context when compiling the
761
761
  # suggestion. By default 20 and at most 50.
762
762
  # @param assist_query_params [::Google::Cloud::Dialogflow::V2::AssistQueryParameters, ::Hash]
@@ -826,6 +826,108 @@ module Google
826
826
  raise ::Google::Cloud::Error.from_error(e)
827
827
  end
828
828
 
829
+ ##
830
+ # Gets smart replies for a participant based on specific historical
831
+ # messages.
832
+ #
833
+ # @overload suggest_smart_replies(request, options = nil)
834
+ # Pass arguments to `suggest_smart_replies` via a request object, either of type
835
+ # {::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesRequest} or an equivalent Hash.
836
+ #
837
+ # @param request [::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesRequest, ::Hash]
838
+ # A request object representing the call parameters. Required. To specify no
839
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
840
+ # @param options [::Gapic::CallOptions, ::Hash]
841
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
842
+ #
843
+ # @overload suggest_smart_replies(parent: nil, current_text_input: nil, latest_message: nil, context_size: nil)
844
+ # Pass arguments to `suggest_smart_replies` via keyword arguments. Note that at
845
+ # least one keyword argument is required. To specify no parameters, or to keep all
846
+ # the default parameter values, pass an empty Hash as a request object (see above).
847
+ #
848
+ # @param parent [::String]
849
+ # Required. The name of the participant to fetch suggestion for.
850
+ # Format: `projects/<Project ID>/locations/<Location
851
+ # ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
852
+ # @param current_text_input [::Google::Cloud::Dialogflow::V2::TextInput, ::Hash]
853
+ # The current natural language text segment to compile suggestion
854
+ # for. This provides a way for user to get follow up smart reply suggestion
855
+ # after a smart reply selection, without sending a text message.
856
+ # @param latest_message [::String]
857
+ # The name of the latest conversation message to compile suggestion
858
+ # for. If empty, it will be the latest message of the conversation.
859
+ #
860
+ # Format: `projects/<Project ID>/locations/<Location
861
+ # ID>/conversations/<Conversation ID>/messages/<Message ID>`.
862
+ # @param context_size [::Integer]
863
+ # Max number of messages prior to and including
864
+ # [latest_message] to use as context when compiling the
865
+ # suggestion. By default 20 and at most 50.
866
+ #
867
+ # @yield [response, operation] Access the result along with the RPC operation
868
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesResponse]
869
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
870
+ #
871
+ # @return [::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesResponse]
872
+ #
873
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
874
+ #
875
+ # @example Basic example
876
+ # require "google/cloud/dialogflow/v2"
877
+ #
878
+ # # Create a client object. The client can be reused for multiple calls.
879
+ # client = Google::Cloud::Dialogflow::V2::Participants::Client.new
880
+ #
881
+ # # Create a request. To set request fields, pass in keyword arguments.
882
+ # request = Google::Cloud::Dialogflow::V2::SuggestSmartRepliesRequest.new
883
+ #
884
+ # # Call the suggest_smart_replies method.
885
+ # result = client.suggest_smart_replies request
886
+ #
887
+ # # The returned object is of type Google::Cloud::Dialogflow::V2::SuggestSmartRepliesResponse.
888
+ # p result
889
+ #
890
+ def suggest_smart_replies request, options = nil
891
+ raise ::ArgumentError, "request must be provided" if request.nil?
892
+
893
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesRequest
894
+
895
+ # Converts hash and nil to an options object
896
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
897
+
898
+ # Customize the options with defaults
899
+ metadata = @config.rpcs.suggest_smart_replies.metadata.to_h
900
+
901
+ # Set x-goog-api-client and x-goog-user-project headers
902
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
903
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
904
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
905
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
906
+
907
+ header_params = {}
908
+ if request.parent
909
+ header_params["parent"] = request.parent
910
+ end
911
+
912
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
913
+ metadata[:"x-goog-request-params"] ||= request_params_header
914
+
915
+ options.apply_defaults timeout: @config.rpcs.suggest_smart_replies.timeout,
916
+ metadata: metadata,
917
+ retry_policy: @config.rpcs.suggest_smart_replies.retry_policy
918
+
919
+ options.apply_defaults timeout: @config.timeout,
920
+ metadata: @config.metadata,
921
+ retry_policy: @config.retry_policy
922
+
923
+ @participants_stub.call_rpc :suggest_smart_replies, request, options: options do |response, operation|
924
+ yield response, operation if block_given?
925
+ return response
926
+ end
927
+ rescue ::GRPC::BadStatus => e
928
+ raise ::Google::Cloud::Error.from_error(e)
929
+ end
930
+
829
931
  ##
830
932
  # Configuration class for the Participants API.
831
933
  #
@@ -996,6 +1098,11 @@ module Google
996
1098
  # @return [::Gapic::Config::Method]
997
1099
  #
998
1100
  attr_reader :suggest_faq_answers
1101
+ ##
1102
+ # RPC-specific configuration for `suggest_smart_replies`
1103
+ # @return [::Gapic::Config::Method]
1104
+ #
1105
+ attr_reader :suggest_smart_replies
999
1106
 
1000
1107
  # @private
1001
1108
  def initialize parent_rpcs = nil
@@ -1013,6 +1120,8 @@ module Google
1013
1120
  @suggest_articles = ::Gapic::Config::Method.new suggest_articles_config
1014
1121
  suggest_faq_answers_config = parent_rpcs.suggest_faq_answers if parent_rpcs.respond_to? :suggest_faq_answers
1015
1122
  @suggest_faq_answers = ::Gapic::Config::Method.new suggest_faq_answers_config
1123
+ suggest_smart_replies_config = parent_rpcs.suggest_smart_replies if parent_rpcs.respond_to? :suggest_smart_replies
1124
+ @suggest_smart_replies = ::Gapic::Config::Method.new suggest_smart_replies_config
1016
1125
 
1017
1126
  yield self if block_given?
1018
1127
  end
@@ -7,7 +7,6 @@ require 'google/api/field_behavior_pb'
7
7
  require 'google/api/resource_pb'
8
8
  require 'google/cloud/dialogflow/v2/audio_config_pb'
9
9
  require 'google/cloud/dialogflow/v2/context_pb'
10
- require 'google/cloud/dialogflow/v2/gcs_pb'
11
10
  require 'google/cloud/dialogflow/v2/intent_pb'
12
11
  require 'google/cloud/dialogflow/v2/session_entity_type_pb'
13
12
  require 'google/protobuf/duration_pb'
@@ -1,7 +1,6 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/cloud/dialogflow/v2/validation_result.proto
3
3
 
4
- require 'google/api/annotations_pb'
5
4
  require 'google/protobuf'
6
5
 
7
6
  Google::Protobuf::DescriptorPool.generated_pool.build do
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Dialogflow
23
23
  module V2
24
- VERSION = "0.13.0"
24
+ VERSION = "0.15.1"
25
25
  end
26
26
  end
27
27
  end
@@ -6,7 +6,6 @@ require 'google/cloud/dialogflow/v2/intent_pb'
6
6
  require 'google/cloud/dialogflow/v2/session_pb'
7
7
  require 'google/cloud/dialogflow/v2/session_entity_type_pb'
8
8
  require 'google/protobuf/struct_pb'
9
- require 'google/api/annotations_pb'
10
9
  require 'google/protobuf'
11
10
 
12
11
  Google::Protobuf::DescriptorPool.generated_pool.build do