Class: LangGraphRB::Observers::NodeEvent
- Inherits:
-
Object
- Object
- LangGraphRB::Observers::NodeEvent
- Defined in:
- lib/langgraph_rb/observers/base.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#node_class ⇒ Object
readonly
Returns the value of attribute node_class.
-
#node_name ⇒ Object
readonly
Returns the value of attribute node_name.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#state_after ⇒ Object
readonly
Returns the value of attribute state_after.
-
#state_before ⇒ Object
readonly
Returns the value of attribute state_before.
-
#step_number ⇒ Object
readonly
Returns the value of attribute step_number.
-
#thread_id ⇒ Object
readonly
Returns the value of attribute thread_id.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, node_name:, node_class: nil, state_before: nil, state_after: nil, context: nil, thread_id: nil, step_number: nil, duration: nil, error: nil, result: nil) ⇒ NodeEvent
constructor
A new instance of NodeEvent.
- #to_h ⇒ Object
Constructor Details
#initialize(type:, node_name:, node_class: nil, state_before: nil, state_after: nil, context: nil, thread_id: nil, step_number: nil, duration: nil, error: nil, result: nil) ⇒ NodeEvent
Returns a new instance of NodeEvent.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/langgraph_rb/observers/base.rb', line 122 def initialize(type:, node_name:, node_class: nil, state_before: nil, state_after: nil, context: nil, thread_id: nil, step_number: nil, duration: nil, error: nil, result: nil) @type = type @node_name = node_name @node_class = node_class @state_before = state_before @state_after = state_after @context = context @thread_id = thread_id @step_number = step_number @duration = duration @error = error @result = result @timestamp = Time.now.utc end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
119 120 121 |
# File 'lib/langgraph_rb/observers/base.rb', line 119 def context @context end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
119 120 121 |
# File 'lib/langgraph_rb/observers/base.rb', line 119 def duration @duration end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
119 120 121 |
# File 'lib/langgraph_rb/observers/base.rb', line 119 def error @error end |
#node_class ⇒ Object (readonly)
Returns the value of attribute node_class.
119 120 121 |
# File 'lib/langgraph_rb/observers/base.rb', line 119 def node_class @node_class end |
#node_name ⇒ Object (readonly)
Returns the value of attribute node_name.
119 120 121 |
# File 'lib/langgraph_rb/observers/base.rb', line 119 def node_name @node_name end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
119 120 121 |
# File 'lib/langgraph_rb/observers/base.rb', line 119 def result @result end |
#state_after ⇒ Object (readonly)
Returns the value of attribute state_after.
119 120 121 |
# File 'lib/langgraph_rb/observers/base.rb', line 119 def state_after @state_after end |
#state_before ⇒ Object (readonly)
Returns the value of attribute state_before.
119 120 121 |
# File 'lib/langgraph_rb/observers/base.rb', line 119 def state_before @state_before end |
#step_number ⇒ Object (readonly)
Returns the value of attribute step_number.
119 120 121 |
# File 'lib/langgraph_rb/observers/base.rb', line 119 def step_number @step_number end |
#thread_id ⇒ Object (readonly)
Returns the value of attribute thread_id.
119 120 121 |
# File 'lib/langgraph_rb/observers/base.rb', line 119 def thread_id @thread_id end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
119 120 121 |
# File 'lib/langgraph_rb/observers/base.rb', line 119 def @timestamp end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
119 120 121 |
# File 'lib/langgraph_rb/observers/base.rb', line 119 def type @type end |
Instance Method Details
#to_h ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/langgraph_rb/observers/base.rb', line 139 def to_h { type: @type, node_name: @node_name, node_class: @node_class&.name, state_before: @state_before, state_after: @state_after, context: @context, thread_id: @thread_id, step_number: @step_number, duration_ms: @duration ? (@duration * 1000).round(2) : nil, error: @error&., error_class: @error&.class&.name, result_type: @result&.class&.name, timestamp: @timestamp.iso8601 } end |