Class: GraphAgent::Graph::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/graph_agent/graph/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, action, metadata: nil, retry_policy: nil, cache_policy: nil) ⇒ Node

Returns a new instance of Node.



8
9
10
11
12
13
14
# File 'lib/graph_agent/graph/node.rb', line 8

def initialize(name, action, metadata: nil, retry_policy: nil, cache_policy: nil)
  @name = name.to_s
  @action = action
  @metadata =  || {}
  @retry_policy = retry_policy
  @cache_policy = cache_policy
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



6
7
8
# File 'lib/graph_agent/graph/node.rb', line 6

def action
  @action
end

#cache_policyObject (readonly)

Returns the value of attribute cache_policy.



6
7
8
# File 'lib/graph_agent/graph/node.rb', line 6

def cache_policy
  @cache_policy
end

#metadataObject (readonly)

Returns the value of attribute metadata.



6
7
8
# File 'lib/graph_agent/graph/node.rb', line 6

def 
  @metadata
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/graph_agent/graph/node.rb', line 6

def name
  @name
end

#retry_policyObject (readonly)

Returns the value of attribute retry_policy.



6
7
8
# File 'lib/graph_agent/graph/node.rb', line 6

def retry_policy
  @retry_policy
end

Instance Method Details

#call(state, config = {}) ⇒ Object



16
17
18
19
# File 'lib/graph_agent/graph/node.rb', line 16

def call(state, config = {})
  result = execute_with_retry(state, config)
  normalize_result(result)
end