google-cloud-discovery_engine-v1beta 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/client.rb +742 -0
  3. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/paths.rb +199 -0
  4. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/client.rb +693 -0
  5. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/service_stub.rb +520 -0
  6. data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +48 -23
  7. data/lib/google/cloud/discovery_engine/v1beta/document_service/paths.rb +21 -0
  8. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +48 -23
  9. data/lib/google/cloud/discovery_engine/v1beta/engine_service/client.rb +296 -0
  10. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/client.rb +275 -0
  11. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/service_stub.rb +180 -0
  12. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/client.rb +449 -0
  13. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/credentials.rb +47 -0
  14. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/paths.rb +52 -0
  15. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/client.rb +416 -0
  16. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/service_stub.rb +129 -0
  17. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest.rb +52 -0
  18. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service.rb +55 -0
  19. data/lib/google/cloud/discovery_engine/v1beta/rank_service/client.rb +459 -0
  20. data/lib/google/cloud/discovery_engine/v1beta/rank_service/credentials.rb +47 -0
  21. data/lib/google/cloud/discovery_engine/v1beta/rank_service/paths.rb +52 -0
  22. data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/client.rb +426 -0
  23. data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/service_stub.rb +129 -0
  24. data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest.rb +52 -0
  25. data/lib/google/cloud/discovery_engine/v1beta/rank_service.rb +55 -0
  26. data/lib/google/cloud/discovery_engine/v1beta/rest.rb +2 -0
  27. data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +11 -6
  28. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +11 -6
  29. data/lib/google/cloud/discovery_engine/v1beta/version.rb +1 -1
  30. data/lib/google/cloud/discovery_engine/v1beta.rb +2 -0
  31. data/lib/google/cloud/discoveryengine/v1beta/answer_pb.rb +67 -0
  32. data/lib/google/cloud/discoveryengine/v1beta/common_pb.rb +1 -1
  33. data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_pb.rb +32 -1
  34. data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_services_pb.rb +25 -0
  35. data/lib/google/cloud/discoveryengine/v1beta/document_processing_config_pb.rb +1 -1
  36. data/lib/google/cloud/discoveryengine/v1beta/document_service_pb.rb +3 -1
  37. data/lib/google/cloud/discoveryengine/v1beta/engine_service_pb.rb +6 -1
  38. data/lib/google/cloud/discoveryengine/v1beta/engine_service_services_pb.rb +12 -0
  39. data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_pb.rb +52 -0
  40. data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_services_pb.rb +45 -0
  41. data/lib/google/cloud/discoveryengine/v1beta/grounding_pb.rb +46 -0
  42. data/lib/google/cloud/discoveryengine/v1beta/import_config_pb.rb +13 -1
  43. data/lib/google/cloud/discoveryengine/v1beta/rank_service_pb.rb +49 -0
  44. data/lib/google/cloud/discoveryengine/v1beta/rank_service_services_pb.rb +45 -0
  45. data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +7 -1
  46. data/lib/google/cloud/discoveryengine/v1beta/search_tuning_service_pb.rb +1 -1
  47. data/lib/google/cloud/discoveryengine/v1beta/session_pb.rb +50 -0
  48. data/proto_docs/google/cloud/discoveryengine/v1beta/answer.rb +354 -0
  49. data/proto_docs/google/cloud/discoveryengine/v1beta/common.rb +9 -1
  50. data/proto_docs/google/cloud/discoveryengine/v1beta/conversational_search_service.rb +475 -0
  51. data/proto_docs/google/cloud/discoveryengine/v1beta/document_processing_config.rb +3 -5
  52. data/proto_docs/google/cloud/discoveryengine/v1beta/document_service.rb +4 -0
  53. data/proto_docs/google/cloud/discoveryengine/v1beta/engine.rb +2 -2
  54. data/proto_docs/google/cloud/discoveryengine/v1beta/engine_service.rb +51 -0
  55. data/proto_docs/google/cloud/discoveryengine/v1beta/grounded_generation_service.rb +106 -0
  56. data/proto_docs/google/cloud/discoveryengine/v1beta/grounding.rb +76 -0
  57. data/proto_docs/google/cloud/discoveryengine/v1beta/import_config.rb +310 -24
  58. data/proto_docs/google/cloud/discoveryengine/v1beta/rank_service.rb +99 -0
  59. data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +154 -22
  60. data/proto_docs/google/cloud/discoveryengine/v1beta/search_tuning_service.rb +16 -1
  61. data/proto_docs/google/cloud/discoveryengine/v1beta/session.rb +85 -0
  62. data/proto_docs/google/cloud/discoveryengine/v1beta/user_event.rb +1 -1
  63. metadata +28 -2
@@ -753,6 +753,650 @@ module Google
753
753
  raise ::Google::Cloud::Error.from_error(e)
754
754
  end
755
755
 
756
+ ##
757
+ # Answer query method.
758
+ #
759
+ # @overload answer_query(request, options = nil)
760
+ # Pass arguments to `answer_query` via a request object, either of type
761
+ # {::Google::Cloud::DiscoveryEngine::V1beta::AnswerQueryRequest} or an equivalent Hash.
762
+ #
763
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::AnswerQueryRequest, ::Hash]
764
+ # A request object representing the call parameters. Required. To specify no
765
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
766
+ # @param options [::Gapic::CallOptions, ::Hash]
767
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
768
+ #
769
+ # @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)
770
+ # Pass arguments to `answer_query` via keyword arguments. Note that at
771
+ # least one keyword argument is required. To specify no parameters, or to keep all
772
+ # the default parameter values, pass an empty Hash as a request object (see above).
773
+ #
774
+ # @param serving_config [::String]
775
+ # Required. The resource name of the Search serving config, such as
776
+ # `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`,
777
+ # or
778
+ # `projects/*/locations/global/collections/default_collection/dataStores/*/servingConfigs/default_serving_config`.
779
+ # This field is used to identify the serving configuration name, set
780
+ # of models used to make the search.
781
+ # @param query [::Google::Cloud::DiscoveryEngine::V1beta::Query, ::Hash]
782
+ # Required. Current user query.
783
+ # @param session [::String]
784
+ # The session resource name. Not required.
785
+ #
786
+ # When session field is not set, the API is in sessionless mode.
787
+ #
788
+ # We support auto session mode: users can use the wildcard symbol “-” as
789
+ # session id. A new id will be automatically generated and assigned.
790
+ # @param safety_spec [::Google::Cloud::DiscoveryEngine::V1beta::AnswerQueryRequest::SafetySpec, ::Hash]
791
+ # Model specification.
792
+ # @param related_questions_spec [::Google::Cloud::DiscoveryEngine::V1beta::AnswerQueryRequest::RelatedQuestionsSpec, ::Hash]
793
+ # Related questions specification.
794
+ # @param answer_generation_spec [::Google::Cloud::DiscoveryEngine::V1beta::AnswerQueryRequest::AnswerGenerationSpec, ::Hash]
795
+ # Answer generation specification.
796
+ # @param search_spec [::Google::Cloud::DiscoveryEngine::V1beta::AnswerQueryRequest::SearchSpec, ::Hash]
797
+ # Search specification.
798
+ # @param query_understanding_spec [::Google::Cloud::DiscoveryEngine::V1beta::AnswerQueryRequest::QueryUnderstandingSpec, ::Hash]
799
+ # Query understanding specification.
800
+ # @param asynchronous_mode [::Boolean]
801
+ # Asynchronous mode control.
802
+ #
803
+ # If enabled, the response will be returned with answer/session resource
804
+ # name without final answer. The API users need to do the polling to get
805
+ # the latest status of answer/session by calling
806
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client#get_answer ConversationalSearchService.GetAnswer}
807
+ # or
808
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client#get_session ConversationalSearchService.GetSession}
809
+ # method.
810
+ # @param user_pseudo_id [::String]
811
+ # A unique identifier for tracking visitors. For example, this could be
812
+ # implemented with an HTTP cookie, which should be able to uniquely identify
813
+ # a visitor on a single device. This unique identifier should not change if
814
+ # the visitor logs in or out of the website.
815
+ #
816
+ # This field should NOT have a fixed value such as `unknown_visitor`.
817
+ #
818
+ # The field must be a UTF-8 encoded string with a length limit of 128
819
+ # characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
820
+ # @yield [result, operation] Access the result along with the TransportOperation object
821
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::AnswerQueryResponse]
822
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
823
+ #
824
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::AnswerQueryResponse]
825
+ #
826
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
827
+ #
828
+ # @example Basic example
829
+ # require "google/cloud/discovery_engine/v1beta"
830
+ #
831
+ # # Create a client object. The client can be reused for multiple calls.
832
+ # client = Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client.new
833
+ #
834
+ # # Create a request. To set request fields, pass in keyword arguments.
835
+ # request = Google::Cloud::DiscoveryEngine::V1beta::AnswerQueryRequest.new
836
+ #
837
+ # # Call the answer_query method.
838
+ # result = client.answer_query request
839
+ #
840
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::AnswerQueryResponse.
841
+ # p result
842
+ #
843
+ def answer_query request, options = nil
844
+ raise ::ArgumentError, "request must be provided" if request.nil?
845
+
846
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::AnswerQueryRequest
847
+
848
+ # Converts hash and nil to an options object
849
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
850
+
851
+ # Customize the options with defaults
852
+ call_metadata = @config.rpcs.answer_query.metadata.to_h
853
+
854
+ # Set x-goog-api-client and x-goog-user-project headers
855
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
856
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
857
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
858
+ transports_version_send: [:rest]
859
+
860
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
861
+
862
+ options.apply_defaults timeout: @config.rpcs.answer_query.timeout,
863
+ metadata: call_metadata,
864
+ retry_policy: @config.rpcs.answer_query.retry_policy
865
+
866
+ options.apply_defaults timeout: @config.timeout,
867
+ metadata: @config.metadata,
868
+ retry_policy: @config.retry_policy
869
+
870
+ @conversational_search_service_stub.answer_query request, options do |result, operation|
871
+ yield result, operation if block_given?
872
+ return result
873
+ end
874
+ rescue ::Gapic::Rest::Error => e
875
+ raise ::Google::Cloud::Error.from_error(e)
876
+ end
877
+
878
+ ##
879
+ # Gets a Answer.
880
+ #
881
+ # @overload get_answer(request, options = nil)
882
+ # Pass arguments to `get_answer` via a request object, either of type
883
+ # {::Google::Cloud::DiscoveryEngine::V1beta::GetAnswerRequest} or an equivalent Hash.
884
+ #
885
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::GetAnswerRequest, ::Hash]
886
+ # A request object representing the call parameters. Required. To specify no
887
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
888
+ # @param options [::Gapic::CallOptions, ::Hash]
889
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
890
+ #
891
+ # @overload get_answer(name: nil)
892
+ # Pass arguments to `get_answer` via keyword arguments. Note that at
893
+ # least one keyword argument is required. To specify no parameters, or to keep all
894
+ # the default parameter values, pass an empty Hash as a request object (see above).
895
+ #
896
+ # @param name [::String]
897
+ # Required. The resource name of the Answer to get. Format:
898
+ # `projects/{project_number}/locations/{location_id}/collections/{collection}/engines/{engine_id}/sessions/{session_id}/answers/{answer_id}`
899
+ # @yield [result, operation] Access the result along with the TransportOperation object
900
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Answer]
901
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
902
+ #
903
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::Answer]
904
+ #
905
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
906
+ #
907
+ # @example Basic example
908
+ # require "google/cloud/discovery_engine/v1beta"
909
+ #
910
+ # # Create a client object. The client can be reused for multiple calls.
911
+ # client = Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client.new
912
+ #
913
+ # # Create a request. To set request fields, pass in keyword arguments.
914
+ # request = Google::Cloud::DiscoveryEngine::V1beta::GetAnswerRequest.new
915
+ #
916
+ # # Call the get_answer method.
917
+ # result = client.get_answer request
918
+ #
919
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::Answer.
920
+ # p result
921
+ #
922
+ def get_answer request, options = nil
923
+ raise ::ArgumentError, "request must be provided" if request.nil?
924
+
925
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::GetAnswerRequest
926
+
927
+ # Converts hash and nil to an options object
928
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
929
+
930
+ # Customize the options with defaults
931
+ call_metadata = @config.rpcs.get_answer.metadata.to_h
932
+
933
+ # Set x-goog-api-client and x-goog-user-project headers
934
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
935
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
936
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
937
+ transports_version_send: [:rest]
938
+
939
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
940
+
941
+ options.apply_defaults timeout: @config.rpcs.get_answer.timeout,
942
+ metadata: call_metadata,
943
+ retry_policy: @config.rpcs.get_answer.retry_policy
944
+
945
+ options.apply_defaults timeout: @config.timeout,
946
+ metadata: @config.metadata,
947
+ retry_policy: @config.retry_policy
948
+
949
+ @conversational_search_service_stub.get_answer request, options do |result, operation|
950
+ yield result, operation if block_given?
951
+ return result
952
+ end
953
+ rescue ::Gapic::Rest::Error => e
954
+ raise ::Google::Cloud::Error.from_error(e)
955
+ end
956
+
957
+ ##
958
+ # Creates a Session.
959
+ #
960
+ # If the {::Google::Cloud::DiscoveryEngine::V1beta::Session Session} to create
961
+ # already exists, an ALREADY_EXISTS error is returned.
962
+ #
963
+ # @overload create_session(request, options = nil)
964
+ # Pass arguments to `create_session` via a request object, either of type
965
+ # {::Google::Cloud::DiscoveryEngine::V1beta::CreateSessionRequest} or an equivalent Hash.
966
+ #
967
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::CreateSessionRequest, ::Hash]
968
+ # A request object representing the call parameters. Required. To specify no
969
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
970
+ # @param options [::Gapic::CallOptions, ::Hash]
971
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
972
+ #
973
+ # @overload create_session(parent: nil, session: nil)
974
+ # Pass arguments to `create_session` via keyword arguments. Note that at
975
+ # least one keyword argument is required. To specify no parameters, or to keep all
976
+ # the default parameter values, pass an empty Hash as a request object (see above).
977
+ #
978
+ # @param parent [::String]
979
+ # Required. Full resource name of parent data store. Format:
980
+ # `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}`
981
+ # @param session [::Google::Cloud::DiscoveryEngine::V1beta::Session, ::Hash]
982
+ # Required. The session to create.
983
+ # @yield [result, operation] Access the result along with the TransportOperation object
984
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Session]
985
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
986
+ #
987
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::Session]
988
+ #
989
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
990
+ #
991
+ # @example Basic example
992
+ # require "google/cloud/discovery_engine/v1beta"
993
+ #
994
+ # # Create a client object. The client can be reused for multiple calls.
995
+ # client = Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client.new
996
+ #
997
+ # # Create a request. To set request fields, pass in keyword arguments.
998
+ # request = Google::Cloud::DiscoveryEngine::V1beta::CreateSessionRequest.new
999
+ #
1000
+ # # Call the create_session method.
1001
+ # result = client.create_session request
1002
+ #
1003
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::Session.
1004
+ # p result
1005
+ #
1006
+ def create_session request, options = nil
1007
+ raise ::ArgumentError, "request must be provided" if request.nil?
1008
+
1009
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::CreateSessionRequest
1010
+
1011
+ # Converts hash and nil to an options object
1012
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1013
+
1014
+ # Customize the options with defaults
1015
+ call_metadata = @config.rpcs.create_session.metadata.to_h
1016
+
1017
+ # Set x-goog-api-client and x-goog-user-project headers
1018
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1019
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1020
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
1021
+ transports_version_send: [:rest]
1022
+
1023
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1024
+
1025
+ options.apply_defaults timeout: @config.rpcs.create_session.timeout,
1026
+ metadata: call_metadata,
1027
+ retry_policy: @config.rpcs.create_session.retry_policy
1028
+
1029
+ options.apply_defaults timeout: @config.timeout,
1030
+ metadata: @config.metadata,
1031
+ retry_policy: @config.retry_policy
1032
+
1033
+ @conversational_search_service_stub.create_session request, options do |result, operation|
1034
+ yield result, operation if block_given?
1035
+ return result
1036
+ end
1037
+ rescue ::Gapic::Rest::Error => e
1038
+ raise ::Google::Cloud::Error.from_error(e)
1039
+ end
1040
+
1041
+ ##
1042
+ # Deletes a Session.
1043
+ #
1044
+ # If the {::Google::Cloud::DiscoveryEngine::V1beta::Session Session} to delete
1045
+ # does not exist, a NOT_FOUND error is returned.
1046
+ #
1047
+ # @overload delete_session(request, options = nil)
1048
+ # Pass arguments to `delete_session` via a request object, either of type
1049
+ # {::Google::Cloud::DiscoveryEngine::V1beta::DeleteSessionRequest} or an equivalent Hash.
1050
+ #
1051
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::DeleteSessionRequest, ::Hash]
1052
+ # A request object representing the call parameters. Required. To specify no
1053
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1054
+ # @param options [::Gapic::CallOptions, ::Hash]
1055
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1056
+ #
1057
+ # @overload delete_session(name: nil)
1058
+ # Pass arguments to `delete_session` via keyword arguments. Note that at
1059
+ # least one keyword argument is required. To specify no parameters, or to keep all
1060
+ # the default parameter values, pass an empty Hash as a request object (see above).
1061
+ #
1062
+ # @param name [::String]
1063
+ # Required. The resource name of the Session to delete. Format:
1064
+ # `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}`
1065
+ # @yield [result, operation] Access the result along with the TransportOperation object
1066
+ # @yieldparam result [::Google::Protobuf::Empty]
1067
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1068
+ #
1069
+ # @return [::Google::Protobuf::Empty]
1070
+ #
1071
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1072
+ #
1073
+ # @example Basic example
1074
+ # require "google/cloud/discovery_engine/v1beta"
1075
+ #
1076
+ # # Create a client object. The client can be reused for multiple calls.
1077
+ # client = Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client.new
1078
+ #
1079
+ # # Create a request. To set request fields, pass in keyword arguments.
1080
+ # request = Google::Cloud::DiscoveryEngine::V1beta::DeleteSessionRequest.new
1081
+ #
1082
+ # # Call the delete_session method.
1083
+ # result = client.delete_session request
1084
+ #
1085
+ # # The returned object is of type Google::Protobuf::Empty.
1086
+ # p result
1087
+ #
1088
+ def delete_session request, options = nil
1089
+ raise ::ArgumentError, "request must be provided" if request.nil?
1090
+
1091
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::DeleteSessionRequest
1092
+
1093
+ # Converts hash and nil to an options object
1094
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1095
+
1096
+ # Customize the options with defaults
1097
+ call_metadata = @config.rpcs.delete_session.metadata.to_h
1098
+
1099
+ # Set x-goog-api-client and x-goog-user-project headers
1100
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1101
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1102
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
1103
+ transports_version_send: [:rest]
1104
+
1105
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1106
+
1107
+ options.apply_defaults timeout: @config.rpcs.delete_session.timeout,
1108
+ metadata: call_metadata,
1109
+ retry_policy: @config.rpcs.delete_session.retry_policy
1110
+
1111
+ options.apply_defaults timeout: @config.timeout,
1112
+ metadata: @config.metadata,
1113
+ retry_policy: @config.retry_policy
1114
+
1115
+ @conversational_search_service_stub.delete_session request, options do |result, operation|
1116
+ yield result, operation if block_given?
1117
+ return result
1118
+ end
1119
+ rescue ::Gapic::Rest::Error => e
1120
+ raise ::Google::Cloud::Error.from_error(e)
1121
+ end
1122
+
1123
+ ##
1124
+ # Updates a Session.
1125
+ #
1126
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Session Session} action type cannot
1127
+ # be changed. If the {::Google::Cloud::DiscoveryEngine::V1beta::Session Session}
1128
+ # to update does not exist, a NOT_FOUND error is returned.
1129
+ #
1130
+ # @overload update_session(request, options = nil)
1131
+ # Pass arguments to `update_session` via a request object, either of type
1132
+ # {::Google::Cloud::DiscoveryEngine::V1beta::UpdateSessionRequest} or an equivalent Hash.
1133
+ #
1134
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::UpdateSessionRequest, ::Hash]
1135
+ # A request object representing the call parameters. Required. To specify no
1136
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1137
+ # @param options [::Gapic::CallOptions, ::Hash]
1138
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1139
+ #
1140
+ # @overload update_session(session: nil, update_mask: nil)
1141
+ # Pass arguments to `update_session` via keyword arguments. Note that at
1142
+ # least one keyword argument is required. To specify no parameters, or to keep all
1143
+ # the default parameter values, pass an empty Hash as a request object (see above).
1144
+ #
1145
+ # @param session [::Google::Cloud::DiscoveryEngine::V1beta::Session, ::Hash]
1146
+ # Required. The Session to update.
1147
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1148
+ # Indicates which fields in the provided
1149
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Session Session} to update. The
1150
+ # following are NOT supported:
1151
+ #
1152
+ # * {::Google::Cloud::DiscoveryEngine::V1beta::Session#name Session.name}
1153
+ #
1154
+ # If not set or empty, all supported fields are updated.
1155
+ # @yield [result, operation] Access the result along with the TransportOperation object
1156
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Session]
1157
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1158
+ #
1159
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::Session]
1160
+ #
1161
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1162
+ #
1163
+ # @example Basic example
1164
+ # require "google/cloud/discovery_engine/v1beta"
1165
+ #
1166
+ # # Create a client object. The client can be reused for multiple calls.
1167
+ # client = Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client.new
1168
+ #
1169
+ # # Create a request. To set request fields, pass in keyword arguments.
1170
+ # request = Google::Cloud::DiscoveryEngine::V1beta::UpdateSessionRequest.new
1171
+ #
1172
+ # # Call the update_session method.
1173
+ # result = client.update_session request
1174
+ #
1175
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::Session.
1176
+ # p result
1177
+ #
1178
+ def update_session request, options = nil
1179
+ raise ::ArgumentError, "request must be provided" if request.nil?
1180
+
1181
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::UpdateSessionRequest
1182
+
1183
+ # Converts hash and nil to an options object
1184
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1185
+
1186
+ # Customize the options with defaults
1187
+ call_metadata = @config.rpcs.update_session.metadata.to_h
1188
+
1189
+ # Set x-goog-api-client and x-goog-user-project headers
1190
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1191
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1192
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
1193
+ transports_version_send: [:rest]
1194
+
1195
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1196
+
1197
+ options.apply_defaults timeout: @config.rpcs.update_session.timeout,
1198
+ metadata: call_metadata,
1199
+ retry_policy: @config.rpcs.update_session.retry_policy
1200
+
1201
+ options.apply_defaults timeout: @config.timeout,
1202
+ metadata: @config.metadata,
1203
+ retry_policy: @config.retry_policy
1204
+
1205
+ @conversational_search_service_stub.update_session request, options do |result, operation|
1206
+ yield result, operation if block_given?
1207
+ return result
1208
+ end
1209
+ rescue ::Gapic::Rest::Error => e
1210
+ raise ::Google::Cloud::Error.from_error(e)
1211
+ end
1212
+
1213
+ ##
1214
+ # Gets a Session.
1215
+ #
1216
+ # @overload get_session(request, options = nil)
1217
+ # Pass arguments to `get_session` via a request object, either of type
1218
+ # {::Google::Cloud::DiscoveryEngine::V1beta::GetSessionRequest} or an equivalent Hash.
1219
+ #
1220
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::GetSessionRequest, ::Hash]
1221
+ # A request object representing the call parameters. Required. To specify no
1222
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1223
+ # @param options [::Gapic::CallOptions, ::Hash]
1224
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1225
+ #
1226
+ # @overload get_session(name: nil)
1227
+ # Pass arguments to `get_session` via keyword arguments. Note that at
1228
+ # least one keyword argument is required. To specify no parameters, or to keep all
1229
+ # the default parameter values, pass an empty Hash as a request object (see above).
1230
+ #
1231
+ # @param name [::String]
1232
+ # Required. The resource name of the Session to get. Format:
1233
+ # `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}`
1234
+ # @yield [result, operation] Access the result along with the TransportOperation object
1235
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Session]
1236
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1237
+ #
1238
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::Session]
1239
+ #
1240
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1241
+ #
1242
+ # @example Basic example
1243
+ # require "google/cloud/discovery_engine/v1beta"
1244
+ #
1245
+ # # Create a client object. The client can be reused for multiple calls.
1246
+ # client = Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client.new
1247
+ #
1248
+ # # Create a request. To set request fields, pass in keyword arguments.
1249
+ # request = Google::Cloud::DiscoveryEngine::V1beta::GetSessionRequest.new
1250
+ #
1251
+ # # Call the get_session method.
1252
+ # result = client.get_session request
1253
+ #
1254
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::Session.
1255
+ # p result
1256
+ #
1257
+ def get_session request, options = nil
1258
+ raise ::ArgumentError, "request must be provided" if request.nil?
1259
+
1260
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::GetSessionRequest
1261
+
1262
+ # Converts hash and nil to an options object
1263
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1264
+
1265
+ # Customize the options with defaults
1266
+ call_metadata = @config.rpcs.get_session.metadata.to_h
1267
+
1268
+ # Set x-goog-api-client and x-goog-user-project headers
1269
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1270
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1271
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
1272
+ transports_version_send: [:rest]
1273
+
1274
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1275
+
1276
+ options.apply_defaults timeout: @config.rpcs.get_session.timeout,
1277
+ metadata: call_metadata,
1278
+ retry_policy: @config.rpcs.get_session.retry_policy
1279
+
1280
+ options.apply_defaults timeout: @config.timeout,
1281
+ metadata: @config.metadata,
1282
+ retry_policy: @config.retry_policy
1283
+
1284
+ @conversational_search_service_stub.get_session request, options do |result, operation|
1285
+ yield result, operation if block_given?
1286
+ return result
1287
+ end
1288
+ rescue ::Gapic::Rest::Error => e
1289
+ raise ::Google::Cloud::Error.from_error(e)
1290
+ end
1291
+
1292
+ ##
1293
+ # Lists all Sessions by their parent
1294
+ # {::Google::Cloud::DiscoveryEngine::V1beta::DataStore DataStore}.
1295
+ #
1296
+ # @overload list_sessions(request, options = nil)
1297
+ # Pass arguments to `list_sessions` via a request object, either of type
1298
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ListSessionsRequest} or an equivalent Hash.
1299
+ #
1300
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::ListSessionsRequest, ::Hash]
1301
+ # A request object representing the call parameters. Required. To specify no
1302
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1303
+ # @param options [::Gapic::CallOptions, ::Hash]
1304
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1305
+ #
1306
+ # @overload list_sessions(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
1307
+ # Pass arguments to `list_sessions` via keyword arguments. Note that at
1308
+ # least one keyword argument is required. To specify no parameters, or to keep all
1309
+ # the default parameter values, pass an empty Hash as a request object (see above).
1310
+ #
1311
+ # @param parent [::String]
1312
+ # Required. The data store resource name. Format:
1313
+ # `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}`
1314
+ # @param page_size [::Integer]
1315
+ # Maximum number of results to return. If unspecified, defaults
1316
+ # to 50. Max allowed value is 1000.
1317
+ # @param page_token [::String]
1318
+ # A page token, received from a previous `ListSessions` call.
1319
+ # Provide this to retrieve the subsequent page.
1320
+ # @param filter [::String]
1321
+ # A filter to apply on the list results. The supported features are:
1322
+ # user_pseudo_id, state.
1323
+ #
1324
+ # Example:
1325
+ # "user_pseudo_id = some_id"
1326
+ # @param order_by [::String]
1327
+ # A comma-separated list of fields to order by, sorted in ascending order.
1328
+ # Use "desc" after a field name for descending.
1329
+ # Supported fields:
1330
+ # * `update_time`
1331
+ # * `create_time`
1332
+ # * `session_name`
1333
+ #
1334
+ # Example:
1335
+ # "update_time desc"
1336
+ # "create_time"
1337
+ # @yield [result, operation] Access the result along with the TransportOperation object
1338
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Session>]
1339
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1340
+ #
1341
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Session>]
1342
+ #
1343
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1344
+ #
1345
+ # @example Basic example
1346
+ # require "google/cloud/discovery_engine/v1beta"
1347
+ #
1348
+ # # Create a client object. The client can be reused for multiple calls.
1349
+ # client = Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Rest::Client.new
1350
+ #
1351
+ # # Create a request. To set request fields, pass in keyword arguments.
1352
+ # request = Google::Cloud::DiscoveryEngine::V1beta::ListSessionsRequest.new
1353
+ #
1354
+ # # Call the list_sessions method.
1355
+ # result = client.list_sessions request
1356
+ #
1357
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1358
+ # # over elements, and API calls will be issued to fetch pages as needed.
1359
+ # result.each do |item|
1360
+ # # Each element is of type ::Google::Cloud::DiscoveryEngine::V1beta::Session.
1361
+ # p item
1362
+ # end
1363
+ #
1364
+ def list_sessions request, options = nil
1365
+ raise ::ArgumentError, "request must be provided" if request.nil?
1366
+
1367
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ListSessionsRequest
1368
+
1369
+ # Converts hash and nil to an options object
1370
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1371
+
1372
+ # Customize the options with defaults
1373
+ call_metadata = @config.rpcs.list_sessions.metadata.to_h
1374
+
1375
+ # Set x-goog-api-client and x-goog-user-project headers
1376
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1377
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1378
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
1379
+ transports_version_send: [:rest]
1380
+
1381
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1382
+
1383
+ options.apply_defaults timeout: @config.rpcs.list_sessions.timeout,
1384
+ metadata: call_metadata,
1385
+ retry_policy: @config.rpcs.list_sessions.retry_policy
1386
+
1387
+ options.apply_defaults timeout: @config.timeout,
1388
+ metadata: @config.metadata,
1389
+ retry_policy: @config.retry_policy
1390
+
1391
+ @conversational_search_service_stub.list_sessions request, options do |result, operation|
1392
+ result = ::Gapic::Rest::PagedEnumerable.new @conversational_search_service_stub, :list_sessions, "sessions", request, result, options
1393
+ yield result, operation if block_given?
1394
+ return result
1395
+ end
1396
+ rescue ::Gapic::Rest::Error => e
1397
+ raise ::Google::Cloud::Error.from_error(e)
1398
+ end
1399
+
756
1400
  ##
757
1401
  # Configuration class for the ConversationalSearchService REST API.
758
1402
  #
@@ -916,6 +1560,41 @@ module Google
916
1560
  # @return [::Gapic::Config::Method]
917
1561
  #
918
1562
  attr_reader :list_conversations
1563
+ ##
1564
+ # RPC-specific configuration for `answer_query`
1565
+ # @return [::Gapic::Config::Method]
1566
+ #
1567
+ attr_reader :answer_query
1568
+ ##
1569
+ # RPC-specific configuration for `get_answer`
1570
+ # @return [::Gapic::Config::Method]
1571
+ #
1572
+ attr_reader :get_answer
1573
+ ##
1574
+ # RPC-specific configuration for `create_session`
1575
+ # @return [::Gapic::Config::Method]
1576
+ #
1577
+ attr_reader :create_session
1578
+ ##
1579
+ # RPC-specific configuration for `delete_session`
1580
+ # @return [::Gapic::Config::Method]
1581
+ #
1582
+ attr_reader :delete_session
1583
+ ##
1584
+ # RPC-specific configuration for `update_session`
1585
+ # @return [::Gapic::Config::Method]
1586
+ #
1587
+ attr_reader :update_session
1588
+ ##
1589
+ # RPC-specific configuration for `get_session`
1590
+ # @return [::Gapic::Config::Method]
1591
+ #
1592
+ attr_reader :get_session
1593
+ ##
1594
+ # RPC-specific configuration for `list_sessions`
1595
+ # @return [::Gapic::Config::Method]
1596
+ #
1597
+ attr_reader :list_sessions
919
1598
 
920
1599
  # @private
921
1600
  def initialize parent_rpcs = nil
@@ -931,6 +1610,20 @@ module Google
931
1610
  @get_conversation = ::Gapic::Config::Method.new get_conversation_config
932
1611
  list_conversations_config = parent_rpcs.list_conversations if parent_rpcs.respond_to? :list_conversations
933
1612
  @list_conversations = ::Gapic::Config::Method.new list_conversations_config
1613
+ answer_query_config = parent_rpcs.answer_query if parent_rpcs.respond_to? :answer_query
1614
+ @answer_query = ::Gapic::Config::Method.new answer_query_config
1615
+ get_answer_config = parent_rpcs.get_answer if parent_rpcs.respond_to? :get_answer
1616
+ @get_answer = ::Gapic::Config::Method.new get_answer_config
1617
+ create_session_config = parent_rpcs.create_session if parent_rpcs.respond_to? :create_session
1618
+ @create_session = ::Gapic::Config::Method.new create_session_config
1619
+ delete_session_config = parent_rpcs.delete_session if parent_rpcs.respond_to? :delete_session
1620
+ @delete_session = ::Gapic::Config::Method.new delete_session_config
1621
+ update_session_config = parent_rpcs.update_session if parent_rpcs.respond_to? :update_session
1622
+ @update_session = ::Gapic::Config::Method.new update_session_config
1623
+ get_session_config = parent_rpcs.get_session if parent_rpcs.respond_to? :get_session
1624
+ @get_session = ::Gapic::Config::Method.new get_session_config
1625
+ list_sessions_config = parent_rpcs.list_sessions if parent_rpcs.respond_to? :list_sessions
1626
+ @list_sessions = ::Gapic::Config::Method.new list_sessions_config
934
1627
 
935
1628
  yield self if block_given?
936
1629
  end