google-cloud-discovery_engine-v1 2.0.0 → 2.1.0

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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +186 -4
  3. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +181 -4
  4. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/service_stub.rb +72 -0
  5. data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +8 -2
  6. data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +8 -2
  7. data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/client.rb +1 -3
  8. data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/rest/client.rb +1 -3
  9. data/lib/google/cloud/discovery_engine/v1/rank_service/client.rb +1 -1
  10. data/lib/google/cloud/discovery_engine/v1/rank_service/rest/client.rb +1 -1
  11. data/lib/google/cloud/discovery_engine/v1/recommendation_service/client.rb +3 -3
  12. data/lib/google/cloud/discovery_engine/v1/recommendation_service/rest/client.rb +3 -3
  13. data/lib/google/cloud/discovery_engine/v1/rest.rb +1 -0
  14. data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +44 -12
  15. data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +44 -12
  16. data/lib/google/cloud/discovery_engine/v1/serving_config_service/client.rb +484 -0
  17. data/lib/google/cloud/discovery_engine/v1/serving_config_service/credentials.rb +47 -0
  18. data/lib/google/cloud/discovery_engine/v1/serving_config_service/paths.rb +101 -0
  19. data/lib/google/cloud/discovery_engine/v1/serving_config_service/rest/client.rb +451 -0
  20. data/lib/google/cloud/discovery_engine/v1/serving_config_service/rest/service_stub.rb +159 -0
  21. data/lib/google/cloud/discovery_engine/v1/serving_config_service/rest.rb +53 -0
  22. data/lib/google/cloud/discovery_engine/v1/serving_config_service.rb +56 -0
  23. data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/client.rb +316 -3
  24. data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/paths.rb +49 -0
  25. data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/rest/client.rb +295 -3
  26. data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/rest/service_stub.rb +206 -0
  27. data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +21 -9
  28. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +21 -9
  29. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/service_stub.rb +8 -0
  30. data/lib/google/cloud/discovery_engine/v1/version.rb +1 -1
  31. data/lib/google/cloud/discovery_engine/v1.rb +1 -0
  32. data/lib/google/cloud/discoveryengine/v1/answer_pb.rb +4 -1
  33. data/lib/google/cloud/discoveryengine/v1/common_pb.rb +4 -1
  34. data/lib/google/cloud/discoveryengine/v1/control_pb.rb +7 -1
  35. data/lib/google/cloud/discoveryengine/v1/conversational_search_service_pb.rb +12 -1
  36. data/lib/google/cloud/discoveryengine/v1/conversational_search_service_services_pb.rb +8 -0
  37. data/lib/google/cloud/discoveryengine/v1/data_store_pb.rb +2 -1
  38. data/lib/google/cloud/discoveryengine/v1/document_pb.rb +1 -1
  39. data/lib/google/cloud/discoveryengine/v1/engine_pb.rb +1 -1
  40. data/lib/google/cloud/discoveryengine/v1/grounded_generation_service_pb.rb +6 -1
  41. data/lib/google/cloud/discoveryengine/v1/import_config_pb.rb +1 -1
  42. data/lib/google/cloud/discoveryengine/v1/safety_pb.rb +47 -0
  43. data/lib/google/cloud/discoveryengine/v1/search_service_pb.rb +5 -1
  44. data/lib/google/cloud/discoveryengine/v1/serving_config_pb.rb +52 -0
  45. data/lib/google/cloud/discoveryengine/v1/serving_config_service_pb.rb +51 -0
  46. data/lib/google/cloud/discoveryengine/v1/serving_config_service_services_pb.rb +48 -0
  47. data/lib/google/cloud/discoveryengine/v1/session_pb.rb +3 -1
  48. data/lib/google/cloud/discoveryengine/v1/site_search_engine_pb.rb +2 -1
  49. data/lib/google/cloud/discoveryengine/v1/site_search_engine_service_pb.rb +10 -1
  50. data/lib/google/cloud/discoveryengine/v1/site_search_engine_service_services_pb.rb +7 -0
  51. data/lib/google/cloud/discoveryengine/v1/user_event_pb.rb +1 -1
  52. data/lib/google/cloud/discoveryengine/v1/user_event_service_pb.rb +1 -1
  53. data/proto_docs/google/api/client.rb +6 -0
  54. data/proto_docs/google/cloud/discoveryengine/v1/answer.rb +53 -2
  55. data/proto_docs/google/cloud/discoveryengine/v1/chunk.rb +2 -1
  56. data/proto_docs/google/cloud/discoveryengine/v1/common.rb +40 -0
  57. data/proto_docs/google/cloud/discoveryengine/v1/control.rb +122 -7
  58. data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +159 -2
  59. data/proto_docs/google/cloud/discoveryengine/v1/data_store.rb +25 -4
  60. data/proto_docs/google/cloud/discoveryengine/v1/document.rb +7 -2
  61. data/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +1 -1
  62. data/proto_docs/google/cloud/discoveryengine/v1/engine.rb +16 -3
  63. data/proto_docs/google/cloud/discoveryengine/v1/grounded_generation_service.rb +90 -12
  64. data/proto_docs/google/cloud/discoveryengine/v1/import_config.rb +19 -1
  65. data/proto_docs/google/cloud/discoveryengine/v1/purge_config.rb +9 -5
  66. data/proto_docs/google/cloud/discoveryengine/v1/rank_service.rb +3 -1
  67. data/proto_docs/google/cloud/discoveryengine/v1/recommendation_service.rb +3 -3
  68. data/proto_docs/google/cloud/discoveryengine/v1/safety.rb +108 -0
  69. data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +109 -8
  70. data/proto_docs/google/cloud/discoveryengine/v1/serving_config.rb +261 -0
  71. data/proto_docs/google/cloud/discoveryengine/v1/serving_config_service.rb +44 -0
  72. data/proto_docs/google/cloud/discoveryengine/v1/session.rb +18 -0
  73. data/proto_docs/google/cloud/discoveryengine/v1/site_search_engine.rb +19 -2
  74. data/proto_docs/google/cloud/discoveryengine/v1/site_search_engine_service.rb +146 -4
  75. data/proto_docs/google/cloud/discoveryengine/v1/user_event.rb +34 -0
  76. data/proto_docs/google/cloud/discoveryengine/v1/user_event_service.rb +12 -4
  77. metadata +17 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 306438ed318930a8ee23b1dd270409ae339a7983ec20e91f80c2cda12c1e1d7b
4
- data.tar.gz: 230071de9c9a8a67101e0966546cee0a744f87e2c2cbf4092107bb1c41c81a02
3
+ metadata.gz: 39f4cfab73f26e066f4715721e27c8b3ee7810b276e05734a31126c14c2be92c
4
+ data.tar.gz: 52b0cfdc1bdd1532479cc6d6d0570a6eb7bcb90c353c3eeed18779f93d213c9a
5
5
  SHA512:
6
- metadata.gz: 7016c29e371de9b2544be90f8269679242fbf0190fe157931fee000c76049fd43251e9cb3329b5dd7a1a1e13270267178153990df0f9a1f1c3e71e32577042da
7
- data.tar.gz: 6d82f54321e189c5d1f84f8d6a7f7f3a081f12ddb21421d03485d939d201fbcdc06699513d7d2dc39d129becd70859445c7cf70d1764e79232a726e7847f3b25
6
+ metadata.gz: '09a3fd20e39261f8218522f5f84a632c92709fea840bda36cdf27c41e3a987cfba09849792f86ff978b824a1f56c27f093858c446c1d61ff989be371bc3552d4'
7
+ data.tar.gz: 5f2b0d690720dcc65fb9c7fe992d9016d0adc19cb0cc9f8db6cfd2a9a20afaff0014b590ad1744e208317b4494ad9f6952d1410ffa62b5f63ffb798e41beb0d7
@@ -840,7 +840,7 @@ module Google
840
840
  # @param options [::Gapic::CallOptions, ::Hash]
841
841
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
842
842
  #
843
- # @overload answer_query(serving_config: nil, query: nil, session: nil, safety_spec: nil, related_questions_spec: nil, answer_generation_spec: nil, search_spec: nil, query_understanding_spec: nil, asynchronous_mode: nil, user_pseudo_id: nil, user_labels: nil)
843
+ # @overload answer_query(serving_config: nil, query: nil, session: nil, safety_spec: nil, related_questions_spec: nil, grounding_spec: nil, answer_generation_spec: nil, search_spec: nil, query_understanding_spec: nil, asynchronous_mode: nil, user_pseudo_id: nil, user_labels: nil, end_user_spec: nil)
844
844
  # Pass arguments to `answer_query` via keyword arguments. Note that at
845
845
  # least one keyword argument is required. To specify no parameters, or to keep all
846
846
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -865,6 +865,8 @@ module Google
865
865
  # Model specification.
866
866
  # @param related_questions_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::RelatedQuestionsSpec, ::Hash]
867
867
  # Related questions specification.
868
+ # @param grounding_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::GroundingSpec, ::Hash]
869
+ # Optional. Grounding specification.
868
870
  # @param answer_generation_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::AnswerGenerationSpec, ::Hash]
869
871
  # Answer generation specification.
870
872
  # @param search_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SearchSpec, ::Hash]
@@ -912,6 +914,8 @@ module Google
912
914
  # See [Google Cloud
913
915
  # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
914
916
  # for more details.
917
+ # @param end_user_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::EndUserSpec, ::Hash]
918
+ # Optional. End user specification.
915
919
  #
916
920
  # @yield [response, operation] Access the result along with the RPC operation
917
921
  # @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryResponse]
@@ -977,6 +981,169 @@ module Google
977
981
  raise ::Google::Cloud::Error.from_error(e)
978
982
  end
979
983
 
984
+ ##
985
+ # Answer query method (streaming).
986
+ #
987
+ # It takes one
988
+ # {::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest AnswerQueryRequest}
989
+ # and returns multiple
990
+ # {::Google::Cloud::DiscoveryEngine::V1::AnswerQueryResponse AnswerQueryResponse}
991
+ # messages in a stream.
992
+ #
993
+ # @overload stream_answer_query(request, options = nil)
994
+ # Pass arguments to `stream_answer_query` via a request object, either of type
995
+ # {::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest} or an equivalent Hash.
996
+ #
997
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest, ::Hash]
998
+ # A request object representing the call parameters. Required. To specify no
999
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1000
+ # @param options [::Gapic::CallOptions, ::Hash]
1001
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1002
+ #
1003
+ # @overload stream_answer_query(serving_config: nil, query: nil, session: nil, safety_spec: nil, related_questions_spec: nil, grounding_spec: nil, answer_generation_spec: nil, search_spec: nil, query_understanding_spec: nil, asynchronous_mode: nil, user_pseudo_id: nil, user_labels: nil, end_user_spec: nil)
1004
+ # Pass arguments to `stream_answer_query` via keyword arguments. Note that at
1005
+ # least one keyword argument is required. To specify no parameters, or to keep all
1006
+ # the default parameter values, pass an empty Hash as a request object (see above).
1007
+ #
1008
+ # @param serving_config [::String]
1009
+ # Required. The resource name of the Search serving config, such as
1010
+ # `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`,
1011
+ # or
1012
+ # `projects/*/locations/global/collections/default_collection/dataStores/*/servingConfigs/default_serving_config`.
1013
+ # This field is used to identify the serving configuration name, set
1014
+ # of models used to make the search.
1015
+ # @param query [::Google::Cloud::DiscoveryEngine::V1::Query, ::Hash]
1016
+ # Required. Current user query.
1017
+ # @param session [::String]
1018
+ # The session resource name. Not required.
1019
+ #
1020
+ # When session field is not set, the API is in sessionless mode.
1021
+ #
1022
+ # We support auto session mode: users can use the wildcard symbol `-` as
1023
+ # session ID. A new ID will be automatically generated and assigned.
1024
+ # @param safety_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SafetySpec, ::Hash]
1025
+ # Model specification.
1026
+ # @param related_questions_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::RelatedQuestionsSpec, ::Hash]
1027
+ # Related questions specification.
1028
+ # @param grounding_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::GroundingSpec, ::Hash]
1029
+ # Optional. Grounding specification.
1030
+ # @param answer_generation_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::AnswerGenerationSpec, ::Hash]
1031
+ # Answer generation specification.
1032
+ # @param search_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SearchSpec, ::Hash]
1033
+ # Search specification.
1034
+ # @param query_understanding_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::QueryUnderstandingSpec, ::Hash]
1035
+ # Query understanding specification.
1036
+ # @param asynchronous_mode [::Boolean]
1037
+ # Deprecated: This field is deprecated. Streaming Answer API will be
1038
+ # supported.
1039
+ #
1040
+ # Asynchronous mode control.
1041
+ #
1042
+ # If enabled, the response will be returned with answer/session resource
1043
+ # name without final answer. The API users need to do the polling to get
1044
+ # the latest status of answer/session by calling
1045
+ # {::Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client#get_answer ConversationalSearchService.GetAnswer}
1046
+ # or
1047
+ # {::Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client#get_session ConversationalSearchService.GetSession}
1048
+ # method.
1049
+ # @param user_pseudo_id [::String]
1050
+ # A unique identifier for tracking visitors. For example, this could be
1051
+ # implemented with an HTTP cookie, which should be able to uniquely identify
1052
+ # a visitor on a single device. This unique identifier should not change if
1053
+ # the visitor logs in or out of the website.
1054
+ #
1055
+ # This field should NOT have a fixed value such as `unknown_visitor`.
1056
+ #
1057
+ # The field must be a UTF-8 encoded string with a length limit of 128
1058
+ # characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
1059
+ # @param user_labels [::Hash{::String => ::String}]
1060
+ # The user labels applied to a resource must meet the following requirements:
1061
+ #
1062
+ # * Each resource can have multiple labels, up to a maximum of 64.
1063
+ # * Each label must be a key-value pair.
1064
+ # * Keys have a minimum length of 1 character and a maximum length of 63
1065
+ # characters and cannot be empty. Values can be empty and have a maximum
1066
+ # length of 63 characters.
1067
+ # * Keys and values can contain only lowercase letters, numeric characters,
1068
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
1069
+ # international characters are allowed.
1070
+ # * The key portion of a label must be unique. However, you can use the same
1071
+ # key with multiple resources.
1072
+ # * Keys must start with a lowercase letter or international character.
1073
+ #
1074
+ # See [Google Cloud
1075
+ # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
1076
+ # for more details.
1077
+ # @param end_user_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::EndUserSpec, ::Hash]
1078
+ # Optional. End user specification.
1079
+ #
1080
+ # @yield [response, operation] Access the result along with the RPC operation
1081
+ # @yieldparam response [::Enumerable<::Google::Cloud::DiscoveryEngine::V1::AnswerQueryResponse>]
1082
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1083
+ #
1084
+ # @return [::Enumerable<::Google::Cloud::DiscoveryEngine::V1::AnswerQueryResponse>]
1085
+ #
1086
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1087
+ #
1088
+ # @example Basic example
1089
+ # require "google/cloud/discovery_engine/v1"
1090
+ #
1091
+ # # Create a client object. The client can be reused for multiple calls.
1092
+ # client = Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Client.new
1093
+ #
1094
+ # # Create a request. To set request fields, pass in keyword arguments.
1095
+ # request = Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest.new
1096
+ #
1097
+ # # Call the stream_answer_query method to start streaming.
1098
+ # output = client.stream_answer_query request
1099
+ #
1100
+ # # The returned object is a streamed enumerable yielding elements of type
1101
+ # # ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryResponse
1102
+ # output.each do |current_response|
1103
+ # p current_response
1104
+ # end
1105
+ #
1106
+ def stream_answer_query request, options = nil
1107
+ raise ::ArgumentError, "request must be provided" if request.nil?
1108
+
1109
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest
1110
+
1111
+ # Converts hash and nil to an options object
1112
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1113
+
1114
+ # Customize the options with defaults
1115
+ metadata = @config.rpcs.stream_answer_query.metadata.to_h
1116
+
1117
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1118
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1119
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1120
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
1121
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1122
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1123
+
1124
+ header_params = {}
1125
+ if request.serving_config
1126
+ header_params["serving_config"] = request.serving_config
1127
+ end
1128
+
1129
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1130
+ metadata[:"x-goog-request-params"] ||= request_params_header
1131
+
1132
+ options.apply_defaults timeout: @config.rpcs.stream_answer_query.timeout,
1133
+ metadata: metadata,
1134
+ retry_policy: @config.rpcs.stream_answer_query.retry_policy
1135
+
1136
+ options.apply_defaults timeout: @config.timeout,
1137
+ metadata: @config.metadata,
1138
+ retry_policy: @config.retry_policy
1139
+
1140
+ @conversational_search_service_stub.call_rpc :stream_answer_query, request, options: options do |response, operation|
1141
+ yield response, operation if block_given?
1142
+ end
1143
+ rescue ::GRPC::BadStatus => e
1144
+ raise ::Google::Cloud::Error.from_error(e)
1145
+ end
1146
+
980
1147
  ##
981
1148
  # Gets a Answer.
982
1149
  #
@@ -1353,7 +1520,7 @@ module Google
1353
1520
  # @param options [::Gapic::CallOptions, ::Hash]
1354
1521
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1355
1522
  #
1356
- # @overload get_session(name: nil)
1523
+ # @overload get_session(name: nil, include_answer_details: nil)
1357
1524
  # Pass arguments to `get_session` via keyword arguments. Note that at
1358
1525
  # least one keyword argument is required. To specify no parameters, or to keep all
1359
1526
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -1361,6 +1528,9 @@ module Google
1361
1528
  # @param name [::String]
1362
1529
  # Required. The resource name of the Session to get. Format:
1363
1530
  # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}`
1531
+ # @param include_answer_details [::Boolean]
1532
+ # Optional. If set to true, the full session including all answer details
1533
+ # will be returned.
1364
1534
  #
1365
1535
  # @yield [response, operation] Access the result along with the RPC operation
1366
1536
  # @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::Session]
@@ -1464,13 +1634,18 @@ module Google
1464
1634
  # A comma-separated list of fields to order by, sorted in ascending order.
1465
1635
  # Use "desc" after a field name for descending.
1466
1636
  # Supported fields:
1637
+ #
1467
1638
  # * `update_time`
1468
1639
  # * `create_time`
1469
1640
  # * `session_name`
1641
+ # * `is_pinned`
1470
1642
  #
1471
1643
  # Example:
1472
- # "update_time desc"
1473
- # "create_time"
1644
+ #
1645
+ # * "update_time desc"
1646
+ # * "create_time"
1647
+ # * "is_pinned desc,update_time desc": list sessions by is_pinned first, then
1648
+ # by update_time.
1474
1649
  #
1475
1650
  # @yield [response, operation] Access the result along with the RPC operation
1476
1651
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Session>]
@@ -1744,6 +1919,11 @@ module Google
1744
1919
  #
1745
1920
  attr_reader :answer_query
1746
1921
  ##
1922
+ # RPC-specific configuration for `stream_answer_query`
1923
+ # @return [::Gapic::Config::Method]
1924
+ #
1925
+ attr_reader :stream_answer_query
1926
+ ##
1747
1927
  # RPC-specific configuration for `get_answer`
1748
1928
  # @return [::Gapic::Config::Method]
1749
1929
  #
@@ -1790,6 +1970,8 @@ module Google
1790
1970
  @list_conversations = ::Gapic::Config::Method.new list_conversations_config
1791
1971
  answer_query_config = parent_rpcs.answer_query if parent_rpcs.respond_to? :answer_query
1792
1972
  @answer_query = ::Gapic::Config::Method.new answer_query_config
1973
+ stream_answer_query_config = parent_rpcs.stream_answer_query if parent_rpcs.respond_to? :stream_answer_query
1974
+ @stream_answer_query = ::Gapic::Config::Method.new stream_answer_query_config
1793
1975
  get_answer_config = parent_rpcs.get_answer if parent_rpcs.respond_to? :get_answer
1794
1976
  @get_answer = ::Gapic::Config::Method.new get_answer_config
1795
1977
  create_session_config = parent_rpcs.create_session if parent_rpcs.respond_to? :create_session
@@ -791,7 +791,7 @@ module Google
791
791
  # @param options [::Gapic::CallOptions, ::Hash]
792
792
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
793
793
  #
794
- # @overload answer_query(serving_config: nil, query: nil, session: nil, safety_spec: nil, related_questions_spec: nil, answer_generation_spec: nil, search_spec: nil, query_understanding_spec: nil, asynchronous_mode: nil, user_pseudo_id: nil, user_labels: nil)
794
+ # @overload answer_query(serving_config: nil, query: nil, session: nil, safety_spec: nil, related_questions_spec: nil, grounding_spec: nil, answer_generation_spec: nil, search_spec: nil, query_understanding_spec: nil, asynchronous_mode: nil, user_pseudo_id: nil, user_labels: nil, end_user_spec: nil)
795
795
  # Pass arguments to `answer_query` via keyword arguments. Note that at
796
796
  # least one keyword argument is required. To specify no parameters, or to keep all
797
797
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -816,6 +816,8 @@ module Google
816
816
  # Model specification.
817
817
  # @param related_questions_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::RelatedQuestionsSpec, ::Hash]
818
818
  # Related questions specification.
819
+ # @param grounding_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::GroundingSpec, ::Hash]
820
+ # Optional. Grounding specification.
819
821
  # @param answer_generation_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::AnswerGenerationSpec, ::Hash]
820
822
  # Answer generation specification.
821
823
  # @param search_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SearchSpec, ::Hash]
@@ -863,6 +865,8 @@ module Google
863
865
  # See [Google Cloud
864
866
  # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
865
867
  # for more details.
868
+ # @param end_user_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::EndUserSpec, ::Hash]
869
+ # Optional. End user specification.
866
870
  # @yield [result, operation] Access the result along with the TransportOperation object
867
871
  # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryResponse]
868
872
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -921,6 +925,164 @@ module Google
921
925
  raise ::Google::Cloud::Error.from_error(e)
922
926
  end
923
927
 
928
+ ##
929
+ # Answer query method (streaming).
930
+ #
931
+ # It takes one
932
+ # {::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest AnswerQueryRequest}
933
+ # and returns multiple
934
+ # {::Google::Cloud::DiscoveryEngine::V1::AnswerQueryResponse AnswerQueryResponse}
935
+ # messages in a stream.
936
+ #
937
+ # @overload stream_answer_query(request, options = nil)
938
+ # Pass arguments to `stream_answer_query` via a request object, either of type
939
+ # {::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest} or an equivalent Hash.
940
+ #
941
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest, ::Hash]
942
+ # A request object representing the call parameters. Required. To specify no
943
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
944
+ # @param options [::Gapic::CallOptions, ::Hash]
945
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
946
+ #
947
+ # @overload stream_answer_query(serving_config: nil, query: nil, session: nil, safety_spec: nil, related_questions_spec: nil, grounding_spec: nil, answer_generation_spec: nil, search_spec: nil, query_understanding_spec: nil, asynchronous_mode: nil, user_pseudo_id: nil, user_labels: nil, end_user_spec: nil)
948
+ # Pass arguments to `stream_answer_query` via keyword arguments. Note that at
949
+ # least one keyword argument is required. To specify no parameters, or to keep all
950
+ # the default parameter values, pass an empty Hash as a request object (see above).
951
+ #
952
+ # @param serving_config [::String]
953
+ # Required. The resource name of the Search serving config, such as
954
+ # `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`,
955
+ # or
956
+ # `projects/*/locations/global/collections/default_collection/dataStores/*/servingConfigs/default_serving_config`.
957
+ # This field is used to identify the serving configuration name, set
958
+ # of models used to make the search.
959
+ # @param query [::Google::Cloud::DiscoveryEngine::V1::Query, ::Hash]
960
+ # Required. Current user query.
961
+ # @param session [::String]
962
+ # The session resource name. Not required.
963
+ #
964
+ # When session field is not set, the API is in sessionless mode.
965
+ #
966
+ # We support auto session mode: users can use the wildcard symbol `-` as
967
+ # session ID. A new ID will be automatically generated and assigned.
968
+ # @param safety_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SafetySpec, ::Hash]
969
+ # Model specification.
970
+ # @param related_questions_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::RelatedQuestionsSpec, ::Hash]
971
+ # Related questions specification.
972
+ # @param grounding_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::GroundingSpec, ::Hash]
973
+ # Optional. Grounding specification.
974
+ # @param answer_generation_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::AnswerGenerationSpec, ::Hash]
975
+ # Answer generation specification.
976
+ # @param search_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::SearchSpec, ::Hash]
977
+ # Search specification.
978
+ # @param query_understanding_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::QueryUnderstandingSpec, ::Hash]
979
+ # Query understanding specification.
980
+ # @param asynchronous_mode [::Boolean]
981
+ # Deprecated: This field is deprecated. Streaming Answer API will be
982
+ # supported.
983
+ #
984
+ # Asynchronous mode control.
985
+ #
986
+ # If enabled, the response will be returned with answer/session resource
987
+ # name without final answer. The API users need to do the polling to get
988
+ # the latest status of answer/session by calling
989
+ # {::Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Rest::Client#get_answer ConversationalSearchService.GetAnswer}
990
+ # or
991
+ # {::Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Rest::Client#get_session ConversationalSearchService.GetSession}
992
+ # method.
993
+ # @param user_pseudo_id [::String]
994
+ # A unique identifier for tracking visitors. For example, this could be
995
+ # implemented with an HTTP cookie, which should be able to uniquely identify
996
+ # a visitor on a single device. This unique identifier should not change if
997
+ # the visitor logs in or out of the website.
998
+ #
999
+ # This field should NOT have a fixed value such as `unknown_visitor`.
1000
+ #
1001
+ # The field must be a UTF-8 encoded string with a length limit of 128
1002
+ # characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
1003
+ # @param user_labels [::Hash{::String => ::String}]
1004
+ # The user labels applied to a resource must meet the following requirements:
1005
+ #
1006
+ # * Each resource can have multiple labels, up to a maximum of 64.
1007
+ # * Each label must be a key-value pair.
1008
+ # * Keys have a minimum length of 1 character and a maximum length of 63
1009
+ # characters and cannot be empty. Values can be empty and have a maximum
1010
+ # length of 63 characters.
1011
+ # * Keys and values can contain only lowercase letters, numeric characters,
1012
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
1013
+ # international characters are allowed.
1014
+ # * The key portion of a label must be unique. However, you can use the same
1015
+ # key with multiple resources.
1016
+ # * Keys must start with a lowercase letter or international character.
1017
+ #
1018
+ # See [Google Cloud
1019
+ # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
1020
+ # for more details.
1021
+ # @param end_user_spec [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest::EndUserSpec, ::Hash]
1022
+ # Optional. End user specification.
1023
+ # @return [::Enumerable<::Google::Cloud::DiscoveryEngine::V1::AnswerQueryResponse>]
1024
+ #
1025
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1026
+ #
1027
+ # @example Basic example
1028
+ # require "google/cloud/discovery_engine/v1"
1029
+ #
1030
+ # # Create a client object. The client can be reused for multiple calls.
1031
+ # client = Google::Cloud::DiscoveryEngine::V1::ConversationalSearchService::Rest::Client.new
1032
+ #
1033
+ # # Create a request. To set request fields, pass in keyword arguments.
1034
+ # request = Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest.new
1035
+ #
1036
+ # # Call the stream_answer_query method to start streaming.
1037
+ # output = client.stream_answer_query request
1038
+ #
1039
+ # # The returned object is a streamed enumerable yielding elements of type
1040
+ # # ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryResponse
1041
+ # output.each do |current_response|
1042
+ # p current_response
1043
+ # end
1044
+ #
1045
+ def stream_answer_query request, options = nil
1046
+ raise ::ArgumentError, "request must be provided" if request.nil?
1047
+
1048
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest
1049
+
1050
+ # Converts hash and nil to an options object
1051
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1052
+
1053
+ # Customize the options with defaults
1054
+ call_metadata = @config.rpcs.stream_answer_query.metadata.to_h
1055
+
1056
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1057
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1058
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1059
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
1060
+ transports_version_send: [:rest]
1061
+
1062
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1063
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1064
+
1065
+ options.apply_defaults timeout: @config.rpcs.stream_answer_query.timeout,
1066
+ metadata: call_metadata,
1067
+ retry_policy: @config.rpcs.stream_answer_query.retry_policy
1068
+
1069
+ options.apply_defaults timeout: @config.timeout,
1070
+ metadata: @config.metadata,
1071
+ retry_policy: @config.retry_policy
1072
+
1073
+ ::Gapic::Rest::ServerStream.new(
1074
+ ::Google::Cloud::DiscoveryEngine::V1::AnswerQueryResponse,
1075
+ ::Gapic::Rest::ThreadedEnumerator.new do |in_q, out_q|
1076
+ @conversational_search_service_stub.stream_answer_query request, options do |chunk|
1077
+ in_q.deq
1078
+ out_q.enq chunk
1079
+ end
1080
+ end
1081
+ )
1082
+ rescue ::Gapic::Rest::Error => e
1083
+ raise ::Google::Cloud::Error.from_error(e)
1084
+ end
1085
+
924
1086
  ##
925
1087
  # Gets a Answer.
926
1088
  #
@@ -1269,7 +1431,7 @@ module Google
1269
1431
  # @param options [::Gapic::CallOptions, ::Hash]
1270
1432
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1271
1433
  #
1272
- # @overload get_session(name: nil)
1434
+ # @overload get_session(name: nil, include_answer_details: nil)
1273
1435
  # Pass arguments to `get_session` via keyword arguments. Note that at
1274
1436
  # least one keyword argument is required. To specify no parameters, or to keep all
1275
1437
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -1277,6 +1439,9 @@ module Google
1277
1439
  # @param name [::String]
1278
1440
  # Required. The resource name of the Session to get. Format:
1279
1441
  # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}`
1442
+ # @param include_answer_details [::Boolean]
1443
+ # Optional. If set to true, the full session including all answer details
1444
+ # will be returned.
1280
1445
  # @yield [result, operation] Access the result along with the TransportOperation object
1281
1446
  # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::Session]
1282
1447
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1373,13 +1538,18 @@ module Google
1373
1538
  # A comma-separated list of fields to order by, sorted in ascending order.
1374
1539
  # Use "desc" after a field name for descending.
1375
1540
  # Supported fields:
1541
+ #
1376
1542
  # * `update_time`
1377
1543
  # * `create_time`
1378
1544
  # * `session_name`
1545
+ # * `is_pinned`
1379
1546
  #
1380
1547
  # Example:
1381
- # "update_time desc"
1382
- # "create_time"
1548
+ #
1549
+ # * "update_time desc"
1550
+ # * "create_time"
1551
+ # * "is_pinned desc,update_time desc": list sessions by is_pinned first, then
1552
+ # by update_time.
1383
1553
  # @yield [result, operation] Access the result along with the TransportOperation object
1384
1554
  # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Session>]
1385
1555
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1626,6 +1796,11 @@ module Google
1626
1796
  #
1627
1797
  attr_reader :answer_query
1628
1798
  ##
1799
+ # RPC-specific configuration for `stream_answer_query`
1800
+ # @return [::Gapic::Config::Method]
1801
+ #
1802
+ attr_reader :stream_answer_query
1803
+ ##
1629
1804
  # RPC-specific configuration for `get_answer`
1630
1805
  # @return [::Gapic::Config::Method]
1631
1806
  #
@@ -1672,6 +1847,8 @@ module Google
1672
1847
  @list_conversations = ::Gapic::Config::Method.new list_conversations_config
1673
1848
  answer_query_config = parent_rpcs.answer_query if parent_rpcs.respond_to? :answer_query
1674
1849
  @answer_query = ::Gapic::Config::Method.new answer_query_config
1850
+ stream_answer_query_config = parent_rpcs.stream_answer_query if parent_rpcs.respond_to? :stream_answer_query
1851
+ @stream_answer_query = ::Gapic::Config::Method.new stream_answer_query_config
1675
1852
  get_answer_config = parent_rpcs.get_answer if parent_rpcs.respond_to? :get_answer
1676
1853
  @get_answer = ::Gapic::Config::Method.new get_answer_config
1677
1854
  create_session_config = parent_rpcs.create_session if parent_rpcs.respond_to? :create_session
@@ -353,6 +353,40 @@ module Google
353
353
  end
354
354
  end
355
355
 
356
+ ##
357
+ # Baseline implementation for the stream_answer_query REST call
358
+ #
359
+ # @param request_pb [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest]
360
+ # A request object representing the call parameters. Required.
361
+ # @param options [::Gapic::CallOptions]
362
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
363
+ #
364
+ # @yieldparam chunk [::String] The chunk of data received during server streaming.
365
+ #
366
+ # @return [::Gapic::Rest::TransportOperation]
367
+ def stream_answer_query request_pb, options = nil, &block
368
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
369
+
370
+ verb, uri, query_string_params, body = ServiceStub.transcode_stream_answer_query_request request_pb
371
+ query_string_params = if query_string_params.any?
372
+ query_string_params.to_h { |p| p.split "=", 2 }
373
+ else
374
+ {}
375
+ end
376
+
377
+ response = @client_stub.make_http_request(
378
+ verb,
379
+ uri: uri,
380
+ body: body || "",
381
+ params: query_string_params,
382
+ method_name: "stream_answer_query",
383
+ options: options,
384
+ is_server_streaming: true,
385
+ &block
386
+ )
387
+ ::Gapic::Rest::TransportOperation.new response
388
+ end
389
+
356
390
  ##
357
391
  # Baseline implementation for the get_answer REST call
358
392
  #
@@ -850,6 +884,44 @@ module Google
850
884
  transcoder.transcode request_pb
851
885
  end
852
886
 
887
+ ##
888
+ # @private
889
+ #
890
+ # GRPC transcoding helper method for the stream_answer_query REST call
891
+ #
892
+ # @param request_pb [::Google::Cloud::DiscoveryEngine::V1::AnswerQueryRequest]
893
+ # A request object representing the call parameters. Required.
894
+ # @return [Array(String, [String, nil], Hash{String => String})]
895
+ # Uri, Body, Query string parameters
896
+ def self.transcode_stream_answer_query_request request_pb
897
+ transcoder = Gapic::Rest::GrpcTranscoder.new
898
+ .with_bindings(
899
+ uri_method: :post,
900
+ uri_template: "/v1/{serving_config}:streamAnswer",
901
+ body: "*",
902
+ matches: [
903
+ ["serving_config", %r{^projects/[^/]+/locations/[^/]+/dataStores/[^/]+/servingConfigs/[^/]+/?$}, false]
904
+ ]
905
+ )
906
+ .with_bindings(
907
+ uri_method: :post,
908
+ uri_template: "/v1/{serving_config}:streamAnswer",
909
+ body: "*",
910
+ matches: [
911
+ ["serving_config", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/servingConfigs/[^/]+/?$}, false]
912
+ ]
913
+ )
914
+ .with_bindings(
915
+ uri_method: :post,
916
+ uri_template: "/v1/{serving_config}:streamAnswer",
917
+ body: "*",
918
+ matches: [
919
+ ["serving_config", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/engines/[^/]+/servingConfigs/[^/]+/?$}, false]
920
+ ]
921
+ )
922
+ transcoder.transcode request_pb
923
+ end
924
+
853
925
  ##
854
926
  # @private
855
927
  #
@@ -474,7 +474,7 @@ module Google
474
474
  # Otherwise, an `ALREADY_EXISTS` error is returned.
475
475
  #
476
476
  # This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034)
477
- # standard with a length limit of 63 characters. Otherwise, an
477
+ # standard with a length limit of 128 characters. Otherwise, an
478
478
  # `INVALID_ARGUMENT` error is returned.
479
479
  #
480
480
  # @yield [response, operation] Access the result along with the RPC operation
@@ -755,7 +755,7 @@ module Google
755
755
  # @param options [::Gapic::CallOptions, ::Hash]
756
756
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
757
757
  #
758
- # @overload import_documents(inline_source: nil, gcs_source: nil, bigquery_source: nil, fhir_store_source: nil, spanner_source: nil, cloud_sql_source: nil, firestore_source: nil, alloy_db_source: nil, bigtable_source: nil, parent: nil, error_config: nil, reconciliation_mode: nil, update_mask: nil, auto_generate_ids: nil, id_field: nil)
758
+ # @overload import_documents(inline_source: nil, gcs_source: nil, bigquery_source: nil, fhir_store_source: nil, spanner_source: nil, cloud_sql_source: nil, firestore_source: nil, alloy_db_source: nil, bigtable_source: nil, parent: nil, error_config: nil, reconciliation_mode: nil, update_mask: nil, auto_generate_ids: nil, id_field: nil, force_refresh_content: nil)
759
759
  # Pass arguments to `import_documents` via keyword arguments. Note that at
760
760
  # least one keyword argument is required. To specify no parameters, or to keep all
761
761
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -870,6 +870,12 @@ module Google
870
870
  # * {::Google::Cloud::DiscoveryEngine::V1::CloudSqlSource CloudSqlSource}.
871
871
  # * {::Google::Cloud::DiscoveryEngine::V1::FirestoreSource FirestoreSource}.
872
872
  # * {::Google::Cloud::DiscoveryEngine::V1::BigtableSource BigtableSource}.
873
+ # @param force_refresh_content [::Boolean]
874
+ # Optional. Whether to force refresh the unstructured content of the
875
+ # documents.
876
+ #
877
+ # If set to `true`, the content part of the documents will be refreshed
878
+ # regardless of the update status of the referencing content.
873
879
  #
874
880
  # @yield [response, operation] Access the result along with the RPC operation
875
881
  # @yieldparam response [::Gapic::Operation]