Class: HTM::Workflows::RememberWorkflow
- Inherits:
-
Object
- Object
- HTM::Workflows::RememberWorkflow
- Defined in:
- lib/htm/workflows/remember_workflow.rb
Overview
RememberWorkflow orchestrates the parallel processing of node enrichment
Uses simple_flow to manage the dependency graph and parallel execution of embedding generation, tag extraction, and proposition extraction.
The workflow structure:
save_node (no deps) -> embedding, tags, propositions (parallel)
Instance Attribute Summary collapse
-
#htm ⇒ Object
readonly
Returns the value of attribute htm.
-
#pipeline ⇒ Object
readonly
Returns the value of attribute pipeline.
Instance Method Summary collapse
-
#call(content:, tags: [], metadata: {}) ⇒ Integer
Execute the remember workflow.
-
#execution_plan ⇒ String
Get execution plan.
-
#initialize(htm, concurrency: :auto) ⇒ RememberWorkflow
constructor
Initialize the remember workflow.
-
#to_mermaid ⇒ String
Get visualization of the workflow as Mermaid diagram.
Constructor Details
#initialize(htm, concurrency: :auto) ⇒ RememberWorkflow
Initialize the remember workflow
31 32 33 34 35 |
# File 'lib/htm/workflows/remember_workflow.rb', line 31 def initialize(htm, concurrency: :auto) @htm = htm @concurrency = concurrency @pipeline = build_pipeline end |
Instance Attribute Details
#htm ⇒ Object (readonly)
Returns the value of attribute htm.
24 25 26 |
# File 'lib/htm/workflows/remember_workflow.rb', line 24 def htm @htm end |
#pipeline ⇒ Object (readonly)
Returns the value of attribute pipeline.
24 25 26 |
# File 'lib/htm/workflows/remember_workflow.rb', line 24 def pipeline @pipeline end |
Instance Method Details
#call(content:, tags: [], metadata: {}) ⇒ Integer
Execute the remember workflow
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/htm/workflows/remember_workflow.rb', line 44 def call(content:, tags: [], metadata: {}) initial_data = { content: content, tags: , metadata: , robot_id: @htm.robot_id, htm: @htm } result = @pipeline.call_parallel(SimpleFlow::Result.new(initial_data)) if result.continue? result.context[:node_id] else HTM.logger.error "RememberWorkflow failed: #{result.errors.inspect}" raise HTM::Error, "Remember workflow failed: #{result.errors.values.flatten.join(', ')}" end end |
#execution_plan ⇒ String
Get execution plan
75 76 77 |
# File 'lib/htm/workflows/remember_workflow.rb', line 75 def execution_plan @pipeline.execution_plan end |
#to_mermaid ⇒ String
Get visualization of the workflow as Mermaid diagram
67 68 69 |
# File 'lib/htm/workflows/remember_workflow.rb', line 67 def to_mermaid @pipeline.visualize_mermaid end |