Class: LangGraphRB::Observers::GraphEvent
- Inherits:
-
Object
- Object
- LangGraphRB::Observers::GraphEvent
- Defined in:
- lib/langgraph_rb/observers/base.rb
Overview
Event data structures
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
-
#initial_state ⇒ Object
readonly
Returns the value of attribute initial_state.
-
#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:, graph:, initial_state: nil, context: nil, thread_id: nil) ⇒ GraphEvent
constructor
A new instance of GraphEvent.
- #to_h ⇒ Object
Constructor Details
#initialize(type:, graph:, initial_state: nil, context: nil, thread_id: nil) ⇒ GraphEvent
Returns a new instance of GraphEvent.
109 110 111 112 113 114 115 116 |
# File 'lib/langgraph_rb/observers/base.rb', line 109 def initialize(type:, graph:, initial_state: nil, context: nil, thread_id: nil) @type = type @graph = graph @initial_state = initial_state @context = context @thread_id = thread_id = Time.now.utc end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
107 108 109 |
# File 'lib/langgraph_rb/observers/base.rb', line 107 def context @context end |
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
107 108 109 |
# File 'lib/langgraph_rb/observers/base.rb', line 107 def graph @graph end |
#initial_state ⇒ Object (readonly)
Returns the value of attribute initial_state.
107 108 109 |
# File 'lib/langgraph_rb/observers/base.rb', line 107 def initial_state @initial_state end |
#thread_id ⇒ Object (readonly)
Returns the value of attribute thread_id.
107 108 109 |
# File 'lib/langgraph_rb/observers/base.rb', line 107 def thread_id @thread_id end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
107 108 109 |
# File 'lib/langgraph_rb/observers/base.rb', line 107 def end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
107 108 109 |
# File 'lib/langgraph_rb/observers/base.rb', line 107 def type @type end |
Instance Method Details
#to_h ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/langgraph_rb/observers/base.rb', line 118 def to_h { type: @type, graph_class: @graph.class.name, node_count: @graph.nodes.size, edge_count: @graph.edges.size, initial_state: @initial_state, context: @context, thread_id: @thread_id, timestamp: .iso8601 } end |