Class: Legion::Extensions::Agentic::Executive::Chunking::Helpers::InformationItem

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/extensions/agentic/executive/chunking/helpers/information_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content:, domain: :general) ⇒ InformationItem

Returns a new instance of InformationItem.



12
13
14
15
16
17
18
19
# File 'lib/legion/extensions/agentic/executive/chunking/helpers/information_item.rb', line 12

def initialize(content:, domain: :general)
  @id         = ::SecureRandom.uuid
  @content    = content
  @domain     = domain
  @chunked    = false
  @chunk_id   = nil
  @created_at = Time.now.utc
end

Instance Attribute Details

#chunk_idObject (readonly)

Returns the value of attribute chunk_id.



10
11
12
# File 'lib/legion/extensions/agentic/executive/chunking/helpers/information_item.rb', line 10

def chunk_id
  @chunk_id
end

#contentObject (readonly)

Returns the value of attribute content.



10
11
12
# File 'lib/legion/extensions/agentic/executive/chunking/helpers/information_item.rb', line 10

def content
  @content
end

#created_atObject (readonly)

Returns the value of attribute created_at.



10
11
12
# File 'lib/legion/extensions/agentic/executive/chunking/helpers/information_item.rb', line 10

def created_at
  @created_at
end

#domainObject (readonly)

Returns the value of attribute domain.



10
11
12
# File 'lib/legion/extensions/agentic/executive/chunking/helpers/information_item.rb', line 10

def domain
  @domain
end

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'lib/legion/extensions/agentic/executive/chunking/helpers/information_item.rb', line 10

def id
  @id
end

Instance Method Details

#assign_to_chunk!(chunk_id:) ⇒ Object



25
26
27
28
# File 'lib/legion/extensions/agentic/executive/chunking/helpers/information_item.rb', line 25

def assign_to_chunk!(chunk_id:)
  @chunked  = true
  @chunk_id = chunk_id
end

#chunked?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/legion/extensions/agentic/executive/chunking/helpers/information_item.rb', line 21

def chunked?
  @chunked
end

#to_hObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/legion/extensions/agentic/executive/chunking/helpers/information_item.rb', line 35

def to_h
  {
    id:         @id,
    content:    @content,
    domain:     @domain,
    chunked:    @chunked,
    chunk_id:   @chunk_id,
    created_at: @created_at
  }
end

#unchunk!Object



30
31
32
33
# File 'lib/legion/extensions/agentic/executive/chunking/helpers/information_item.rb', line 30

def unchunk!
  @chunked  = false
  @chunk_id = nil
end