Class: Google::Cloud::Dialogflow::V2::Conversations::Rest::Client
- Inherits:
-
Object
- Object
- Google::Cloud::Dialogflow::V2::Conversations::Rest::Client
- Includes:
- Paths
- Defined in:
- lib/google/cloud/dialogflow/v2/conversations/rest/client.rb
Overview
REST client for the Conversations service.
Service for managing Conversations.
Defined Under Namespace
Classes: Configuration
Instance Attribute Summary collapse
-
#location_client ⇒ Google::Cloud::Location::Locations::Rest::Client
readonly
Get the associated client for mix-in of the Locations.
Class Method Summary collapse
-
.configure {|config| ... } ⇒ Client::Configuration
Configure the Conversations Client class.
Instance Method Summary collapse
-
#complete_conversation(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Dialogflow::V2::Conversation
Completes the specified conversation.
-
#configure {|config| ... } ⇒ Client::Configuration
Configure the Conversations Client instance.
-
#create_conversation(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Dialogflow::V2::Conversation
Creates a new conversation.
-
#generate_stateless_suggestion(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Dialogflow::V2::GenerateStatelessSuggestionResponse
Generates and returns a suggestion for a conversation that does not have a resource created for it.
-
#generate_stateless_summary(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Dialogflow::V2::GenerateStatelessSummaryResponse
Generates and returns a summary for a conversation that does not have a resource created for it.
-
#generate_suggestions(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Dialogflow::V2::GenerateSuggestionsResponse
Generates all the suggestions using generators configured in the conversation profile.
-
#get_conversation(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Dialogflow::V2::Conversation
Retrieves the specific conversation.
-
#ingest_context_references(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Dialogflow::V2::IngestContextReferencesResponse
Data ingestion API.
-
#initialize {|config| ... } ⇒ Client
constructor
Create a new Conversations REST client object.
-
#list_conversations(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Conversation>
Returns the list of all conversations in the specified project.
-
#list_messages(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Message>
Lists messages that belong to a given conversation.
-
#logger ⇒ Logger
The logger used for request/response debug logging.
-
#search_knowledge(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Dialogflow::V2::SearchKnowledgeResponse
Get answers for the given query based on knowledge documents.
-
#suggest_conversation_summary(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryResponse
Suggests summary for a conversation based on specific historical messages.
-
#universe_domain ⇒ String
The effective universe domain.
Methods included from Paths
#agent_path, #conversation_model_path, #conversation_path, #conversation_profile_path, #cx_security_settings_path, #data_store_path, #document_path, #generator_path, #knowledge_base_path, #location_path, #message_path, #phrase_set_path, #project_path
Constructor Details
#initialize {|config| ... } ⇒ Client
Create a new Conversations REST client object.
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 133 def initialize # Create the configuration object @config = Configuration.new Client.configure # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials # Use self-signed JWT if the endpoint is unchanged from default, # but only if the default endpoint does not have a region prefix. enable_self_signed_jwt = @config.endpoint.nil? || (@config.endpoint == Configuration::DEFAULT_ENDPOINT && !@config.endpoint.split(".").first.include?("-")) credentials ||= Credentials.default scope: @config.scope, enable_self_signed_jwt: enable_self_signed_jwt if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @conversations_stub = ::Google::Cloud::Dialogflow::V2::Conversations::Rest::ServiceStub.new( endpoint: @config.endpoint, endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, universe_domain: @config.universe_domain, credentials: credentials, logger: @config.logger ) @conversations_stub.logger(stub: true)&.info do |entry| entry.set_system_name entry.set_service entry. = "Created client for #{entry.service}" entry.set_credentials_fields credentials entry.set "customEndpoint", @config.endpoint if @config.endpoint entry.set "defaultTimeout", @config.timeout if @config.timeout entry.set "quotaProject", @quota_project_id if @quota_project_id end @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @conversations_stub.endpoint config.universe_domain = @conversations_stub.universe_domain config.bindings_override = @config.bindings_override config.logger = @conversations_stub.logger if config.respond_to? :logger= end end |
Instance Attribute Details
#location_client ⇒ Google::Cloud::Location::Locations::Rest::Client (readonly)
Get the associated client for mix-in of the Locations.
189 190 191 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 189 def location_client @location_client end |
Class Method Details
.configure {|config| ... } ⇒ Client::Configuration
Configure the Conversations Client class.
See Configuration for a description of the configuration fields.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 66 def self.configure @configure ||= begin namespace = ["Google", "Cloud", "Dialogflow", "V2"] parent_config = while namespace.any? parent_name = namespace.join "::" parent_const = const_get parent_name break parent_const.configure if parent_const.respond_to? :configure namespace.pop end default_config = Client::Configuration.new parent_config default_config.timeout = 60.0 default_config.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] } default_config end yield @configure if block_given? @configure end |
Instance Method Details
#complete_conversation(request, options = nil) ⇒ ::Google::Cloud::Dialogflow::V2::Conversation #complete_conversation(name: nil) ⇒ ::Google::Cloud::Dialogflow::V2::Conversation
Completes the specified conversation. Finished conversations are purged from the database after 30 days.
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 539 def complete_conversation request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CompleteConversationRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.complete_conversation..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.complete_conversation.timeout, metadata: , retry_policy: @config.rpcs.complete_conversation.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @conversations_stub.complete_conversation request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#configure {|config| ... } ⇒ Client::Configuration
Configure the Conversations Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on configure.
See Configuration for a description of the configuration fields.
103 104 105 106 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 103 def configure yield @config if block_given? @config end |
#create_conversation(request, options = nil) ⇒ ::Google::Cloud::Dialogflow::V2::Conversation #create_conversation(parent: nil, conversation: nil, conversation_id: nil) ⇒ ::Google::Cloud::Dialogflow::V2::Conversation
Creates a new conversation. Conversations are auto-completed after 24 hours.
Conversation Lifecycle: There are two stages during a conversation: Automated Agent Stage and Assist Stage.
For Automated Agent Stage, there will be a dialogflow agent responding to user queries.
For Assist Stage, there's no dialogflow agent responding to user queries. But we will provide suggestions which are generated from conversation.
If
Conversation.conversation_profile
is configured for a dialogflow agent, conversation will start from
Automated Agent Stage
, otherwise, it will start from Assist Stage
. And
during Automated Agent Stage
, once an
Intent with
Intent.live_agent_handoff
is triggered, conversation will transfer to Assist Stage.
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 279 def create_conversation request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CreateConversationRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.create_conversation..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.create_conversation.timeout, metadata: , retry_policy: @config.rpcs.create_conversation.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @conversations_stub.create_conversation request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#generate_stateless_suggestion(request, options = nil) ⇒ ::Google::Cloud::Dialogflow::V2::GenerateStatelessSuggestionResponse #generate_stateless_suggestion(parent: nil, generator: nil, generator_name: nil, context_references: nil, conversation_context: nil, trigger_events: nil) ⇒ ::Google::Cloud::Dialogflow::V2::GenerateStatelessSuggestionResponse
Generates and returns a suggestion for a conversation that does not have a resource created for it.
1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 1018 def generate_stateless_suggestion request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GenerateStatelessSuggestionRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.generate_stateless_suggestion..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.generate_stateless_suggestion.timeout, metadata: , retry_policy: @config.rpcs.generate_stateless_suggestion.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @conversations_stub.generate_stateless_suggestion request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#generate_stateless_summary(request, options = nil) ⇒ ::Google::Cloud::Dialogflow::V2::GenerateStatelessSummaryResponse #generate_stateless_summary(stateless_conversation: nil, conversation_profile: nil, latest_message: nil, max_context_size: nil) ⇒ ::Google::Cloud::Dialogflow::V2::GenerateStatelessSummaryResponse
Generates and returns a summary for a conversation that does not have a resource created for it.
918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 918 def generate_stateless_summary request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GenerateStatelessSummaryRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.generate_stateless_summary..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.generate_stateless_summary.timeout, metadata: , retry_policy: @config.rpcs.generate_stateless_summary.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @conversations_stub.generate_stateless_summary request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#generate_suggestions(request, options = nil) ⇒ ::Google::Cloud::Dialogflow::V2::GenerateSuggestionsResponse #generate_suggestions(conversation: nil, latest_message: nil, trigger_events: nil) ⇒ ::Google::Cloud::Dialogflow::V2::GenerateSuggestionsResponse
Generates all the suggestions using generators configured in the conversation profile. A generator is used only if its trigger event is matched.
1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 1237 def generate_suggestions request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GenerateSuggestionsRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.generate_suggestions..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.generate_suggestions.timeout, metadata: , retry_policy: @config.rpcs.generate_suggestions.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @conversations_stub.generate_suggestions request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_conversation(request, options = nil) ⇒ ::Google::Cloud::Dialogflow::V2::Conversation #get_conversation(name: nil) ⇒ ::Google::Cloud::Dialogflow::V2::Conversation
Retrieves the specific conversation.
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 458 def get_conversation request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetConversationRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_conversation..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_conversation.timeout, metadata: , retry_policy: @config.rpcs.get_conversation.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @conversations_stub.get_conversation request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#ingest_context_references(request, options = nil) ⇒ ::Google::Cloud::Dialogflow::V2::IngestContextReferencesResponse #ingest_context_references(conversation: nil, context_references: nil) ⇒ ::Google::Cloud::Dialogflow::V2::IngestContextReferencesResponse
Data ingestion API. Ingests context references for an existing conversation.
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 625 def ingest_context_references request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::IngestContextReferencesRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.ingest_context_references..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.ingest_context_references.timeout, metadata: , retry_policy: @config.rpcs.ingest_context_references.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @conversations_stub.ingest_context_references request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_conversations(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Conversation> #list_conversations(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Conversation>
Returns the list of all conversations in the specified project.
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 376 def list_conversations request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListConversationsRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_conversations..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list_conversations.timeout, metadata: , retry_policy: @config.rpcs.list_conversations.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @conversations_stub.list_conversations request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @conversations_stub, :list_conversations, "conversations", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_messages(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Message> #list_messages(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Message>
Lists messages that belong to a given conversation.
messages
are ordered by create_time
in descending order. To fetch
updates without duplication, send request with filter
create_time_epoch_microseconds >
[first item's create_time of previous request]
and empty page_token.
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 727 def request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListMessagesRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs...to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs..timeout, metadata: , retry_policy: @config.rpcs..retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @conversations_stub. request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @conversations_stub, :list_messages, "messages", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#logger ⇒ Logger
The logger used for request/response debug logging.
196 197 198 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 196 def logger @conversations_stub.logger end |
#search_knowledge(request, options = nil) ⇒ ::Google::Cloud::Dialogflow::V2::SearchKnowledgeResponse #search_knowledge(parent: nil, query: nil, conversation_profile: nil, session_id: nil, conversation: nil, latest_message: nil, query_source: nil, end_user_metadata: nil, search_config: nil, exact_search: nil) ⇒ ::Google::Cloud::Dialogflow::V2::SearchKnowledgeResponse
Get answers for the given query based on knowledge documents.
1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 1145 def search_knowledge request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::SearchKnowledgeRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.search_knowledge..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.search_knowledge.timeout, metadata: , retry_policy: @config.rpcs.search_knowledge.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @conversations_stub.search_knowledge request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#suggest_conversation_summary(request, options = nil) ⇒ ::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryResponse #suggest_conversation_summary(conversation: nil, latest_message: nil, context_size: nil, assist_query_params: nil) ⇒ ::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryResponse
Suggests summary for a conversation based on specific historical messages. The range of the messages to be used for summary can be specified in the request.
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 825 def suggest_conversation_summary request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::SuggestConversationSummaryRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.suggest_conversation_summary..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.suggest_conversation_summary.timeout, metadata: , retry_policy: @config.rpcs.suggest_conversation_summary.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @conversations_stub.suggest_conversation_summary request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#universe_domain ⇒ String
The effective universe domain
113 114 115 |
# File 'lib/google/cloud/dialogflow/v2/conversations/rest/client.rb', line 113 def universe_domain @conversations_stub.universe_domain end |