Class: Legion::Gaia::InputFrame
- Inherits:
-
Data
- Object
- Data
- Legion::Gaia::InputFrame
- Defined in:
- lib/legion/gaia/input_frame.rb
Instance Attribute Summary collapse
-
#auth_context ⇒ Object
readonly
Returns the value of attribute auth_context.
-
#channel_capabilities ⇒ Object
readonly
Returns the value of attribute channel_capabilities.
-
#channel_id ⇒ Object
readonly
Returns the value of attribute channel_id.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#device_context ⇒ Object
readonly
Returns the value of attribute device_context.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#principal_id ⇒ Object
readonly
Returns the value of attribute principal_id.
-
#received_at ⇒ Object
readonly
Returns the value of attribute received_at.
-
#session_continuity_id ⇒ Object
readonly
Returns the value of attribute session_continuity_id.
Instance Method Summary collapse
- #human_direct? ⇒ Boolean
-
#initialize(content:, channel_id:, id: SecureRandom.uuid, content_type: :text, channel_capabilities: [], device_context: {}, session_continuity_id: nil, auth_context: {}, metadata: {}, received_at: Time.now.utc, principal_id: nil) ⇒ InputFrame
constructor
rubocop:disable Metrics/ParameterLists.
- #resolved_principal_id ⇒ Object
- #salience ⇒ Object
- #text? ⇒ Boolean
- #to_signal ⇒ Object
Constructor Details
#initialize(content:, channel_id:, id: SecureRandom.uuid, content_type: :text, channel_capabilities: [], device_context: {}, session_continuity_id: nil, auth_context: {}, metadata: {}, received_at: Time.now.utc, principal_id: nil) ⇒ InputFrame
rubocop:disable Metrics/ParameterLists
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/legion/gaia/input_frame.rb', line 22 def initialize( # rubocop:disable Metrics/ParameterLists content:, channel_id:, id: SecureRandom.uuid, content_type: :text, channel_capabilities: [], device_context: {}, session_continuity_id: nil, auth_context: {}, metadata: {}, received_at: Time.now.utc, principal_id: nil ) super end |
Instance Attribute Details
#auth_context ⇒ Object (readonly)
Returns the value of attribute auth_context
9 10 11 |
# File 'lib/legion/gaia/input_frame.rb', line 9 def auth_context @auth_context end |
#channel_capabilities ⇒ Object (readonly)
Returns the value of attribute channel_capabilities
9 10 11 |
# File 'lib/legion/gaia/input_frame.rb', line 9 def channel_capabilities @channel_capabilities end |
#channel_id ⇒ Object (readonly)
Returns the value of attribute channel_id
9 10 11 |
# File 'lib/legion/gaia/input_frame.rb', line 9 def channel_id @channel_id end |
#content ⇒ Object (readonly)
Returns the value of attribute content
9 10 11 |
# File 'lib/legion/gaia/input_frame.rb', line 9 def content @content end |
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type
9 10 11 |
# File 'lib/legion/gaia/input_frame.rb', line 9 def content_type @content_type end |
#device_context ⇒ Object (readonly)
Returns the value of attribute device_context
9 10 11 |
# File 'lib/legion/gaia/input_frame.rb', line 9 def device_context @device_context end |
#id ⇒ Object (readonly)
Returns the value of attribute id
9 10 11 |
# File 'lib/legion/gaia/input_frame.rb', line 9 def id @id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata
9 10 11 |
# File 'lib/legion/gaia/input_frame.rb', line 9 def @metadata end |
#principal_id ⇒ Object (readonly)
Returns the value of attribute principal_id
9 10 11 |
# File 'lib/legion/gaia/input_frame.rb', line 9 def principal_id @principal_id end |
#received_at ⇒ Object (readonly)
Returns the value of attribute received_at
9 10 11 |
# File 'lib/legion/gaia/input_frame.rb', line 9 def received_at @received_at end |
#session_continuity_id ⇒ Object (readonly)
Returns the value of attribute session_continuity_id
9 10 11 |
# File 'lib/legion/gaia/input_frame.rb', line 9 def session_continuity_id @session_continuity_id end |
Instance Method Details
#human_direct? ⇒ Boolean
42 43 44 |
# File 'lib/legion/gaia/input_frame.rb', line 42 def human_direct? [:source_type] == :human_direct end |
#resolved_principal_id ⇒ Object
50 51 52 |
# File 'lib/legion/gaia/input_frame.rb', line 50 def resolved_principal_id principal_id || auth_context&.dig(:principal_id) end |
#salience ⇒ Object
46 47 48 |
# File 'lib/legion/gaia/input_frame.rb', line 46 def salience [:salience] || 0.0 end |
#text? ⇒ Boolean
38 39 40 |
# File 'lib/legion/gaia/input_frame.rb', line 38 def text? content_type == :text end |
#to_signal ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/legion/gaia/input_frame.rb', line 54 def to_signal { value: content, source_type: [:source_type] || :ambient, salience: salience, channel_id: channel_id, frame_id: id, received_at: received_at, principal_id: resolved_principal_id } end |