google-cloud-dialogflow-v2 1.8.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/dialogflow/v2/agents/client.rb +2 -2
  3. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +2 -2
  4. data/lib/google/cloud/dialogflow/v2/agents/rest/client.rb +1 -1
  5. data/lib/google/cloud/dialogflow/v2/agents/rest/operations.rb +1 -1
  6. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +2 -2
  7. data/lib/google/cloud/dialogflow/v2/answer_records/rest/client.rb +1 -1
  8. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +2 -2
  9. data/lib/google/cloud/dialogflow/v2/contexts/rest/client.rb +1 -1
  10. data/lib/google/cloud/dialogflow/v2/conversation_datasets/client.rb +2 -2
  11. data/lib/google/cloud/dialogflow/v2/conversation_datasets/operations.rb +2 -2
  12. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/client.rb +1 -1
  13. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/operations.rb +1 -1
  14. data/lib/google/cloud/dialogflow/v2/conversation_models/client.rb +2 -2
  15. data/lib/google/cloud/dialogflow/v2/conversation_models/operations.rb +2 -2
  16. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/client.rb +1 -1
  17. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/operations.rb +1 -1
  18. data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +8 -1
  19. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +2 -2
  20. data/lib/google/cloud/dialogflow/v2/conversation_profiles/operations.rb +2 -2
  21. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/client.rb +1 -1
  22. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/operations.rb +1 -1
  23. data/lib/google/cloud/dialogflow/v2/conversation_services_pb.rb +7 -0
  24. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +214 -3
  25. data/lib/google/cloud/dialogflow/v2/conversations/rest/client.rb +199 -2
  26. data/lib/google/cloud/dialogflow/v2/conversations/rest/service_stub.rb +132 -0
  27. data/lib/google/cloud/dialogflow/v2/documents/client.rb +2 -2
  28. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +2 -2
  29. data/lib/google/cloud/dialogflow/v2/documents/rest/client.rb +1 -1
  30. data/lib/google/cloud/dialogflow/v2/documents/rest/operations.rb +1 -1
  31. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/client.rb +2 -2
  32. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/operations.rb +2 -2
  33. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/client.rb +1 -1
  34. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/operations.rb +1 -1
  35. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +2 -2
  36. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +2 -2
  37. data/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb +1 -1
  38. data/lib/google/cloud/dialogflow/v2/entity_types/rest/operations.rb +1 -1
  39. data/lib/google/cloud/dialogflow/v2/environments/client.rb +2 -2
  40. data/lib/google/cloud/dialogflow/v2/environments/rest/client.rb +1 -1
  41. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +2 -2
  42. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/client.rb +1 -1
  43. data/lib/google/cloud/dialogflow/v2/generator_pb.rb +3 -1
  44. data/lib/google/cloud/dialogflow/v2/generators/client.rb +2 -2
  45. data/lib/google/cloud/dialogflow/v2/generators/rest/client.rb +1 -1
  46. data/lib/google/cloud/dialogflow/v2/intents/client.rb +2 -2
  47. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +2 -2
  48. data/lib/google/cloud/dialogflow/v2/intents/rest/client.rb +1 -1
  49. data/lib/google/cloud/dialogflow/v2/intents/rest/operations.rb +1 -1
  50. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +2 -2
  51. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/client.rb +1 -1
  52. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +5 -1
  53. data/lib/google/cloud/dialogflow/v2/participants/client.rb +2 -2
  54. data/lib/google/cloud/dialogflow/v2/participants/rest/client.rb +1 -1
  55. data/lib/google/cloud/dialogflow/v2/rest.rb +1 -1
  56. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +2 -2
  57. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/client.rb +1 -1
  58. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +2 -2
  59. data/lib/google/cloud/dialogflow/v2/sessions/rest/client.rb +1 -1
  60. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  61. data/lib/google/cloud/dialogflow/v2/versions/client.rb +2 -2
  62. data/lib/google/cloud/dialogflow/v2/versions/rest/client.rb +1 -1
  63. data/lib/google/cloud/dialogflow/v2.rb +1 -1
  64. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +2 -0
  65. data/proto_docs/google/cloud/dialogflow/v2/conversation.rb +154 -0
  66. data/proto_docs/google/cloud/dialogflow/v2/generator.rb +53 -0
  67. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +46 -5
  68. metadata +3 -3
@@ -605,6 +605,99 @@ module Google
605
605
  raise ::Google::Cloud::Error.from_error(e)
606
606
  end
607
607
 
608
+ ##
609
+ # Data ingestion API.
610
+ # Ingests context references for an existing conversation.
611
+ #
612
+ # @overload ingest_context_references(request, options = nil)
613
+ # Pass arguments to `ingest_context_references` via a request object, either of type
614
+ # {::Google::Cloud::Dialogflow::V2::IngestContextReferencesRequest} or an equivalent Hash.
615
+ #
616
+ # @param request [::Google::Cloud::Dialogflow::V2::IngestContextReferencesRequest, ::Hash]
617
+ # A request object representing the call parameters. Required. To specify no
618
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
619
+ # @param options [::Gapic::CallOptions, ::Hash]
620
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
621
+ #
622
+ # @overload ingest_context_references(conversation: nil, context_references: nil)
623
+ # Pass arguments to `ingest_context_references` via keyword arguments. Note that at
624
+ # least one keyword argument is required. To specify no parameters, or to keep all
625
+ # the default parameter values, pass an empty Hash as a request object (see above).
626
+ #
627
+ # @param conversation [::String]
628
+ # Required. Resource identifier of the conversation to ingest context
629
+ # information for. Format: `projects/<Project ID>/locations/<Location
630
+ # ID>/conversations/<Conversation ID>`.
631
+ # @param context_references [::Hash{::String => ::Google::Cloud::Dialogflow::V2::Conversation::ContextReference, ::Hash}]
632
+ # Required. The context references to ingest. The key is the name of the
633
+ # context reference and the value contains the contents of the context
634
+ # reference. The key is used to incorporate ingested context references to
635
+ # enhance the generator.
636
+ #
637
+ # @yield [response, operation] Access the result along with the RPC operation
638
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::IngestContextReferencesResponse]
639
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
640
+ #
641
+ # @return [::Google::Cloud::Dialogflow::V2::IngestContextReferencesResponse]
642
+ #
643
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
644
+ #
645
+ # @example Basic example
646
+ # require "google/cloud/dialogflow/v2"
647
+ #
648
+ # # Create a client object. The client can be reused for multiple calls.
649
+ # client = Google::Cloud::Dialogflow::V2::Conversations::Client.new
650
+ #
651
+ # # Create a request. To set request fields, pass in keyword arguments.
652
+ # request = Google::Cloud::Dialogflow::V2::IngestContextReferencesRequest.new
653
+ #
654
+ # # Call the ingest_context_references method.
655
+ # result = client.ingest_context_references request
656
+ #
657
+ # # The returned object is of type Google::Cloud::Dialogflow::V2::IngestContextReferencesResponse.
658
+ # p result
659
+ #
660
+ def ingest_context_references request, options = nil
661
+ raise ::ArgumentError, "request must be provided" if request.nil?
662
+
663
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::IngestContextReferencesRequest
664
+
665
+ # Converts hash and nil to an options object
666
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
667
+
668
+ # Customize the options with defaults
669
+ metadata = @config.rpcs.ingest_context_references.metadata.to_h
670
+
671
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
672
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
673
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
674
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
675
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
676
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
677
+
678
+ header_params = {}
679
+ if request.conversation
680
+ header_params["conversation"] = request.conversation
681
+ end
682
+
683
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
684
+ metadata[:"x-goog-request-params"] ||= request_params_header
685
+
686
+ options.apply_defaults timeout: @config.rpcs.ingest_context_references.timeout,
687
+ metadata: metadata,
688
+ retry_policy: @config.rpcs.ingest_context_references.retry_policy
689
+
690
+ options.apply_defaults timeout: @config.timeout,
691
+ metadata: @config.metadata,
692
+ retry_policy: @config.retry_policy
693
+
694
+ @conversations_stub.call_rpc :ingest_context_references, request, options: options do |response, operation|
695
+ yield response, operation if block_given?
696
+ end
697
+ rescue ::GRPC::BadStatus => e
698
+ raise ::Google::Cloud::Error.from_error(e)
699
+ end
700
+
608
701
  ##
609
702
  # Lists messages that belong to a given conversation.
610
703
  # `messages` are ordered by `create_time` in descending order. To fetch
@@ -933,7 +1026,7 @@ module Google
933
1026
  # @param options [::Gapic::CallOptions, ::Hash]
934
1027
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
935
1028
  #
936
- # @overload generate_stateless_suggestion(parent: nil, generator: nil, generator_name: nil, conversation_context: nil, trigger_events: nil)
1029
+ # @overload generate_stateless_suggestion(parent: nil, generator: nil, generator_name: nil, context_references: nil, conversation_context: nil, trigger_events: nil)
937
1030
  # Pass arguments to `generate_stateless_suggestion` via keyword arguments. Note that at
938
1031
  # least one keyword argument is required. To specify no parameters, or to keep all
939
1032
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -951,6 +1044,11 @@ module Google
951
1044
  # `projects/<Project ID>/locations/<Location ID>/generators/<Generator ID>`
952
1045
  #
953
1046
  # Note: The following fields are mutually exclusive: `generator_name`, `generator`. If a field in that set is populated, all other fields in the set will automatically be cleared.
1047
+ # @param context_references [::Hash{::String => ::Google::Cloud::Dialogflow::V2::Conversation::ContextReference, ::Hash}]
1048
+ # Optional. A section of ingested context information. The key is the name of
1049
+ # the context reference and the value contains the contents of the context
1050
+ # reference. The key is used to incorporate ingested context references to
1051
+ # enhance the generator.
954
1052
  # @param conversation_context [::Google::Cloud::Dialogflow::V2::ConversationContext, ::Hash]
955
1053
  # Optional. Context of the conversation, including transcripts.
956
1054
  # @param trigger_events [::Array<::Google::Cloud::Dialogflow::V2::TriggerEvent>]
@@ -1155,6 +1253,105 @@ module Google
1155
1253
  raise ::Google::Cloud::Error.from_error(e)
1156
1254
  end
1157
1255
 
1256
+ ##
1257
+ # Generates all the suggestions using generators configured in the
1258
+ # conversation profile. A generator is used only if its trigger event is
1259
+ # matched.
1260
+ #
1261
+ # @overload generate_suggestions(request, options = nil)
1262
+ # Pass arguments to `generate_suggestions` via a request object, either of type
1263
+ # {::Google::Cloud::Dialogflow::V2::GenerateSuggestionsRequest} or an equivalent Hash.
1264
+ #
1265
+ # @param request [::Google::Cloud::Dialogflow::V2::GenerateSuggestionsRequest, ::Hash]
1266
+ # A request object representing the call parameters. Required. To specify no
1267
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1268
+ # @param options [::Gapic::CallOptions, ::Hash]
1269
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1270
+ #
1271
+ # @overload generate_suggestions(conversation: nil, latest_message: nil, trigger_events: nil)
1272
+ # Pass arguments to `generate_suggestions` via keyword arguments. Note that at
1273
+ # least one keyword argument is required. To specify no parameters, or to keep all
1274
+ # the default parameter values, pass an empty Hash as a request object (see above).
1275
+ #
1276
+ # @param conversation [::String]
1277
+ # Required. The conversation for which the suggestions are generated. Format:
1278
+ # `projects/<Project ID>/locations/<Location
1279
+ # ID>/conversations/<Conversation ID>`.
1280
+ #
1281
+ # The conversation must be created with a conversation profile which has
1282
+ # generators configured in it to be able to get suggestions.
1283
+ # @param latest_message [::String]
1284
+ # Optional. The name of the latest conversation message for which the request
1285
+ # is triggered. Format: `projects/<Project ID>/locations/<Location
1286
+ # ID>/conversations/<Conversation ID>/messages/<Message ID>`.
1287
+ # @param trigger_events [::Array<::Google::Cloud::Dialogflow::V2::TriggerEvent>]
1288
+ # Optional. A list of trigger events. Only generators configured in the
1289
+ # conversation_profile whose trigger_event is listed here will be triggered.
1290
+ #
1291
+ # @yield [response, operation] Access the result along with the RPC operation
1292
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::GenerateSuggestionsResponse]
1293
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1294
+ #
1295
+ # @return [::Google::Cloud::Dialogflow::V2::GenerateSuggestionsResponse]
1296
+ #
1297
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1298
+ #
1299
+ # @example Basic example
1300
+ # require "google/cloud/dialogflow/v2"
1301
+ #
1302
+ # # Create a client object. The client can be reused for multiple calls.
1303
+ # client = Google::Cloud::Dialogflow::V2::Conversations::Client.new
1304
+ #
1305
+ # # Create a request. To set request fields, pass in keyword arguments.
1306
+ # request = Google::Cloud::Dialogflow::V2::GenerateSuggestionsRequest.new
1307
+ #
1308
+ # # Call the generate_suggestions method.
1309
+ # result = client.generate_suggestions request
1310
+ #
1311
+ # # The returned object is of type Google::Cloud::Dialogflow::V2::GenerateSuggestionsResponse.
1312
+ # p result
1313
+ #
1314
+ def generate_suggestions request, options = nil
1315
+ raise ::ArgumentError, "request must be provided" if request.nil?
1316
+
1317
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GenerateSuggestionsRequest
1318
+
1319
+ # Converts hash and nil to an options object
1320
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1321
+
1322
+ # Customize the options with defaults
1323
+ metadata = @config.rpcs.generate_suggestions.metadata.to_h
1324
+
1325
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1326
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1327
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1328
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
1329
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1330
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1331
+
1332
+ header_params = {}
1333
+ if request.conversation
1334
+ header_params["conversation"] = request.conversation
1335
+ end
1336
+
1337
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1338
+ metadata[:"x-goog-request-params"] ||= request_params_header
1339
+
1340
+ options.apply_defaults timeout: @config.rpcs.generate_suggestions.timeout,
1341
+ metadata: metadata,
1342
+ retry_policy: @config.rpcs.generate_suggestions.retry_policy
1343
+
1344
+ options.apply_defaults timeout: @config.timeout,
1345
+ metadata: @config.metadata,
1346
+ retry_policy: @config.retry_policy
1347
+
1348
+ @conversations_stub.call_rpc :generate_suggestions, request, options: options do |response, operation|
1349
+ yield response, operation if block_given?
1350
+ end
1351
+ rescue ::GRPC::BadStatus => e
1352
+ raise ::Google::Cloud::Error.from_error(e)
1353
+ end
1354
+
1158
1355
  ##
1159
1356
  # Configuration class for the Conversations API.
1160
1357
  #
@@ -1260,8 +1457,8 @@ module Google
1260
1457
 
1261
1458
  config_attr :endpoint, nil, ::String, nil
1262
1459
  config_attr :credentials, nil do |value|
1263
- allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1264
- allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1460
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
1461
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
1265
1462
  allowed.any? { |klass| klass === value }
1266
1463
  end
1267
1464
  config_attr :scope, nil, ::String, ::Array, nil
@@ -1342,6 +1539,11 @@ module Google
1342
1539
  #
1343
1540
  attr_reader :complete_conversation
1344
1541
  ##
1542
+ # RPC-specific configuration for `ingest_context_references`
1543
+ # @return [::Gapic::Config::Method]
1544
+ #
1545
+ attr_reader :ingest_context_references
1546
+ ##
1345
1547
  # RPC-specific configuration for `list_messages`
1346
1548
  # @return [::Gapic::Config::Method]
1347
1549
  #
@@ -1366,6 +1568,11 @@ module Google
1366
1568
  # @return [::Gapic::Config::Method]
1367
1569
  #
1368
1570
  attr_reader :search_knowledge
1571
+ ##
1572
+ # RPC-specific configuration for `generate_suggestions`
1573
+ # @return [::Gapic::Config::Method]
1574
+ #
1575
+ attr_reader :generate_suggestions
1369
1576
 
1370
1577
  # @private
1371
1578
  def initialize parent_rpcs = nil
@@ -1377,6 +1584,8 @@ module Google
1377
1584
  @get_conversation = ::Gapic::Config::Method.new get_conversation_config
1378
1585
  complete_conversation_config = parent_rpcs.complete_conversation if parent_rpcs.respond_to? :complete_conversation
1379
1586
  @complete_conversation = ::Gapic::Config::Method.new complete_conversation_config
1587
+ ingest_context_references_config = parent_rpcs.ingest_context_references if parent_rpcs.respond_to? :ingest_context_references
1588
+ @ingest_context_references = ::Gapic::Config::Method.new ingest_context_references_config
1380
1589
  list_messages_config = parent_rpcs.list_messages if parent_rpcs.respond_to? :list_messages
1381
1590
  @list_messages = ::Gapic::Config::Method.new list_messages_config
1382
1591
  suggest_conversation_summary_config = parent_rpcs.suggest_conversation_summary if parent_rpcs.respond_to? :suggest_conversation_summary
@@ -1387,6 +1596,8 @@ module Google
1387
1596
  @generate_stateless_suggestion = ::Gapic::Config::Method.new generate_stateless_suggestion_config
1388
1597
  search_knowledge_config = parent_rpcs.search_knowledge if parent_rpcs.respond_to? :search_knowledge
1389
1598
  @search_knowledge = ::Gapic::Config::Method.new search_knowledge_config
1599
+ generate_suggestions_config = parent_rpcs.generate_suggestions if parent_rpcs.respond_to? :generate_suggestions
1600
+ @generate_suggestions = ::Gapic::Config::Method.new generate_suggestions_config
1390
1601
 
1391
1602
  yield self if block_given?
1392
1603
  end
@@ -571,6 +571,92 @@ module Google
571
571
  raise ::Google::Cloud::Error.from_error(e)
572
572
  end
573
573
 
574
+ ##
575
+ # Data ingestion API.
576
+ # Ingests context references for an existing conversation.
577
+ #
578
+ # @overload ingest_context_references(request, options = nil)
579
+ # Pass arguments to `ingest_context_references` via a request object, either of type
580
+ # {::Google::Cloud::Dialogflow::V2::IngestContextReferencesRequest} or an equivalent Hash.
581
+ #
582
+ # @param request [::Google::Cloud::Dialogflow::V2::IngestContextReferencesRequest, ::Hash]
583
+ # A request object representing the call parameters. Required. To specify no
584
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
585
+ # @param options [::Gapic::CallOptions, ::Hash]
586
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
587
+ #
588
+ # @overload ingest_context_references(conversation: nil, context_references: nil)
589
+ # Pass arguments to `ingest_context_references` via keyword arguments. Note that at
590
+ # least one keyword argument is required. To specify no parameters, or to keep all
591
+ # the default parameter values, pass an empty Hash as a request object (see above).
592
+ #
593
+ # @param conversation [::String]
594
+ # Required. Resource identifier of the conversation to ingest context
595
+ # information for. Format: `projects/<Project ID>/locations/<Location
596
+ # ID>/conversations/<Conversation ID>`.
597
+ # @param context_references [::Hash{::String => ::Google::Cloud::Dialogflow::V2::Conversation::ContextReference, ::Hash}]
598
+ # Required. The context references to ingest. The key is the name of the
599
+ # context reference and the value contains the contents of the context
600
+ # reference. The key is used to incorporate ingested context references to
601
+ # enhance the generator.
602
+ # @yield [result, operation] Access the result along with the TransportOperation object
603
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::IngestContextReferencesResponse]
604
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
605
+ #
606
+ # @return [::Google::Cloud::Dialogflow::V2::IngestContextReferencesResponse]
607
+ #
608
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
609
+ #
610
+ # @example Basic example
611
+ # require "google/cloud/dialogflow/v2"
612
+ #
613
+ # # Create a client object. The client can be reused for multiple calls.
614
+ # client = Google::Cloud::Dialogflow::V2::Conversations::Rest::Client.new
615
+ #
616
+ # # Create a request. To set request fields, pass in keyword arguments.
617
+ # request = Google::Cloud::Dialogflow::V2::IngestContextReferencesRequest.new
618
+ #
619
+ # # Call the ingest_context_references method.
620
+ # result = client.ingest_context_references request
621
+ #
622
+ # # The returned object is of type Google::Cloud::Dialogflow::V2::IngestContextReferencesResponse.
623
+ # p result
624
+ #
625
+ def ingest_context_references request, options = nil
626
+ raise ::ArgumentError, "request must be provided" if request.nil?
627
+
628
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::IngestContextReferencesRequest
629
+
630
+ # Converts hash and nil to an options object
631
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
632
+
633
+ # Customize the options with defaults
634
+ call_metadata = @config.rpcs.ingest_context_references.metadata.to_h
635
+
636
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
637
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
638
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
639
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
640
+ transports_version_send: [:rest]
641
+
642
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
643
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
644
+
645
+ options.apply_defaults timeout: @config.rpcs.ingest_context_references.timeout,
646
+ metadata: call_metadata,
647
+ retry_policy: @config.rpcs.ingest_context_references.retry_policy
648
+
649
+ options.apply_defaults timeout: @config.timeout,
650
+ metadata: @config.metadata,
651
+ retry_policy: @config.retry_policy
652
+
653
+ @conversations_stub.ingest_context_references request, options do |result, operation|
654
+ yield result, operation if block_given?
655
+ end
656
+ rescue ::Gapic::Rest::Error => e
657
+ raise ::Google::Cloud::Error.from_error(e)
658
+ end
659
+
574
660
  ##
575
661
  # Lists messages that belong to a given conversation.
576
662
  # `messages` are ordered by `create_time` in descending order. To fetch
@@ -878,7 +964,7 @@ module Google
878
964
  # @param options [::Gapic::CallOptions, ::Hash]
879
965
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
880
966
  #
881
- # @overload generate_stateless_suggestion(parent: nil, generator: nil, generator_name: nil, conversation_context: nil, trigger_events: nil)
967
+ # @overload generate_stateless_suggestion(parent: nil, generator: nil, generator_name: nil, context_references: nil, conversation_context: nil, trigger_events: nil)
882
968
  # Pass arguments to `generate_stateless_suggestion` via keyword arguments. Note that at
883
969
  # least one keyword argument is required. To specify no parameters, or to keep all
884
970
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -896,6 +982,11 @@ module Google
896
982
  # `projects/<Project ID>/locations/<Location ID>/generators/<Generator ID>`
897
983
  #
898
984
  # Note: The following fields are mutually exclusive: `generator_name`, `generator`. If a field in that set is populated, all other fields in the set will automatically be cleared.
985
+ # @param context_references [::Hash{::String => ::Google::Cloud::Dialogflow::V2::Conversation::ContextReference, ::Hash}]
986
+ # Optional. A section of ingested context information. The key is the name of
987
+ # the context reference and the value contains the contents of the context
988
+ # reference. The key is used to incorporate ingested context references to
989
+ # enhance the generator.
899
990
  # @param conversation_context [::Google::Cloud::Dialogflow::V2::ConversationContext, ::Hash]
900
991
  # Optional. Context of the conversation, including transcripts.
901
992
  # @param trigger_events [::Array<::Google::Cloud::Dialogflow::V2::TriggerEvent>]
@@ -1086,6 +1177,98 @@ module Google
1086
1177
  raise ::Google::Cloud::Error.from_error(e)
1087
1178
  end
1088
1179
 
1180
+ ##
1181
+ # Generates all the suggestions using generators configured in the
1182
+ # conversation profile. A generator is used only if its trigger event is
1183
+ # matched.
1184
+ #
1185
+ # @overload generate_suggestions(request, options = nil)
1186
+ # Pass arguments to `generate_suggestions` via a request object, either of type
1187
+ # {::Google::Cloud::Dialogflow::V2::GenerateSuggestionsRequest} or an equivalent Hash.
1188
+ #
1189
+ # @param request [::Google::Cloud::Dialogflow::V2::GenerateSuggestionsRequest, ::Hash]
1190
+ # A request object representing the call parameters. Required. To specify no
1191
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1192
+ # @param options [::Gapic::CallOptions, ::Hash]
1193
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1194
+ #
1195
+ # @overload generate_suggestions(conversation: nil, latest_message: nil, trigger_events: nil)
1196
+ # Pass arguments to `generate_suggestions` via keyword arguments. Note that at
1197
+ # least one keyword argument is required. To specify no parameters, or to keep all
1198
+ # the default parameter values, pass an empty Hash as a request object (see above).
1199
+ #
1200
+ # @param conversation [::String]
1201
+ # Required. The conversation for which the suggestions are generated. Format:
1202
+ # `projects/<Project ID>/locations/<Location
1203
+ # ID>/conversations/<Conversation ID>`.
1204
+ #
1205
+ # The conversation must be created with a conversation profile which has
1206
+ # generators configured in it to be able to get suggestions.
1207
+ # @param latest_message [::String]
1208
+ # Optional. The name of the latest conversation message for which the request
1209
+ # is triggered. Format: `projects/<Project ID>/locations/<Location
1210
+ # ID>/conversations/<Conversation ID>/messages/<Message ID>`.
1211
+ # @param trigger_events [::Array<::Google::Cloud::Dialogflow::V2::TriggerEvent>]
1212
+ # Optional. A list of trigger events. Only generators configured in the
1213
+ # conversation_profile whose trigger_event is listed here will be triggered.
1214
+ # @yield [result, operation] Access the result along with the TransportOperation object
1215
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::GenerateSuggestionsResponse]
1216
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1217
+ #
1218
+ # @return [::Google::Cloud::Dialogflow::V2::GenerateSuggestionsResponse]
1219
+ #
1220
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1221
+ #
1222
+ # @example Basic example
1223
+ # require "google/cloud/dialogflow/v2"
1224
+ #
1225
+ # # Create a client object. The client can be reused for multiple calls.
1226
+ # client = Google::Cloud::Dialogflow::V2::Conversations::Rest::Client.new
1227
+ #
1228
+ # # Create a request. To set request fields, pass in keyword arguments.
1229
+ # request = Google::Cloud::Dialogflow::V2::GenerateSuggestionsRequest.new
1230
+ #
1231
+ # # Call the generate_suggestions method.
1232
+ # result = client.generate_suggestions request
1233
+ #
1234
+ # # The returned object is of type Google::Cloud::Dialogflow::V2::GenerateSuggestionsResponse.
1235
+ # p result
1236
+ #
1237
+ def generate_suggestions request, options = nil
1238
+ raise ::ArgumentError, "request must be provided" if request.nil?
1239
+
1240
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GenerateSuggestionsRequest
1241
+
1242
+ # Converts hash and nil to an options object
1243
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1244
+
1245
+ # Customize the options with defaults
1246
+ call_metadata = @config.rpcs.generate_suggestions.metadata.to_h
1247
+
1248
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1249
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1250
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1251
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
1252
+ transports_version_send: [:rest]
1253
+
1254
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1255
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1256
+
1257
+ options.apply_defaults timeout: @config.rpcs.generate_suggestions.timeout,
1258
+ metadata: call_metadata,
1259
+ retry_policy: @config.rpcs.generate_suggestions.retry_policy
1260
+
1261
+ options.apply_defaults timeout: @config.timeout,
1262
+ metadata: @config.metadata,
1263
+ retry_policy: @config.retry_policy
1264
+
1265
+ @conversations_stub.generate_suggestions request, options do |result, operation|
1266
+ yield result, operation if block_given?
1267
+ end
1268
+ rescue ::Gapic::Rest::Error => e
1269
+ raise ::Google::Cloud::Error.from_error(e)
1270
+ end
1271
+
1089
1272
  ##
1090
1273
  # Configuration class for the Conversations REST API.
1091
1274
  #
@@ -1182,7 +1365,7 @@ module Google
1182
1365
 
1183
1366
  config_attr :endpoint, nil, ::String, nil
1184
1367
  config_attr :credentials, nil do |value|
1185
- allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1368
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
1186
1369
  allowed.any? { |klass| klass === value }
1187
1370
  end
1188
1371
  config_attr :scope, nil, ::String, ::Array, nil
@@ -1260,6 +1443,11 @@ module Google
1260
1443
  #
1261
1444
  attr_reader :complete_conversation
1262
1445
  ##
1446
+ # RPC-specific configuration for `ingest_context_references`
1447
+ # @return [::Gapic::Config::Method]
1448
+ #
1449
+ attr_reader :ingest_context_references
1450
+ ##
1263
1451
  # RPC-specific configuration for `list_messages`
1264
1452
  # @return [::Gapic::Config::Method]
1265
1453
  #
@@ -1284,6 +1472,11 @@ module Google
1284
1472
  # @return [::Gapic::Config::Method]
1285
1473
  #
1286
1474
  attr_reader :search_knowledge
1475
+ ##
1476
+ # RPC-specific configuration for `generate_suggestions`
1477
+ # @return [::Gapic::Config::Method]
1478
+ #
1479
+ attr_reader :generate_suggestions
1287
1480
 
1288
1481
  # @private
1289
1482
  def initialize parent_rpcs = nil
@@ -1295,6 +1488,8 @@ module Google
1295
1488
  @get_conversation = ::Gapic::Config::Method.new get_conversation_config
1296
1489
  complete_conversation_config = parent_rpcs.complete_conversation if parent_rpcs.respond_to? :complete_conversation
1297
1490
  @complete_conversation = ::Gapic::Config::Method.new complete_conversation_config
1491
+ ingest_context_references_config = parent_rpcs.ingest_context_references if parent_rpcs.respond_to? :ingest_context_references
1492
+ @ingest_context_references = ::Gapic::Config::Method.new ingest_context_references_config
1298
1493
  list_messages_config = parent_rpcs.list_messages if parent_rpcs.respond_to? :list_messages
1299
1494
  @list_messages = ::Gapic::Config::Method.new list_messages_config
1300
1495
  suggest_conversation_summary_config = parent_rpcs.suggest_conversation_summary if parent_rpcs.respond_to? :suggest_conversation_summary
@@ -1305,6 +1500,8 @@ module Google
1305
1500
  @generate_stateless_suggestion = ::Gapic::Config::Method.new generate_stateless_suggestion_config
1306
1501
  search_knowledge_config = parent_rpcs.search_knowledge if parent_rpcs.respond_to? :search_knowledge
1307
1502
  @search_knowledge = ::Gapic::Config::Method.new search_knowledge_config
1503
+ generate_suggestions_config = parent_rpcs.generate_suggestions if parent_rpcs.respond_to? :generate_suggestions
1504
+ @generate_suggestions = ::Gapic::Config::Method.new generate_suggestions_config
1308
1505
 
1309
1506
  yield self if block_given?
1310
1507
  end