Module: Google::Cloud::Dialogflow::Contexts
- Defined in:
- lib/google/cloud/dialogflow.rb
Class Method Summary collapse
-
.new(version: , credentials: , scopes: , client_config: , timeout: ) ⇒ Object
A context represents additional information included with user input or with an intent returned by the Dialogflow API.
Class Method Details
.new(version: , credentials: , scopes: , client_config: , timeout: ) ⇒ Object
A context represents additional information included with user input or with an intent returned by the Dialogflow API. Contexts are helpful for differentiating user input which may be vague or have a different meaning depending on additional details from your application such as user setting and preferences, previous user input, where the user is in your application, geographic location, and so on.
You can include contexts as input parameters of a DetectIntent (or StreamingDetectIntent) request, or as output contexts included in the returned intent. Contexts expire when an intent is matched, after the number of +DetectIntent+ requests specified by the +lifespan_count+ parameter, or after 10 minutes if no intents are matched for a +DetectIntent+ request.
For more information about contexts, see the Dialogflow documentation.
213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/google/cloud/dialogflow.rb', line 213 def self.new(*args, version: :v2, **kwargs) unless AVAILABLE_VERSIONS.include?(version.to_s.downcase) raise "The version: #{version} is not available. The available versions " \ "are: [#{AVAILABLE_VERSIONS.join(", ")}]" end require "#{FILE_DIR}/#{version.to_s.downcase}" version_module = Google::Cloud::Dialogflow .constants .select {|sym| sym.to_s.downcase == version.to_s.downcase} .first Google::Cloud::Dialogflow.const_get(version_module)::Contexts.new(*args, **kwargs) end |