Exception: DSPy::ReAct::MaxIterationsError

Inherits:
StandardError
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dspy/re_act.rb

Overview

Custom error classes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = "Agent reached maximum iterations without producing a final answer", iterations: nil, max_iterations: nil, tools_used: [], history: [], last_observation: nil, partial_final_answer: nil) ⇒ MaxIterationsError

Returns a new instance of MaxIterationsError.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/dspy/re_act.rb', line 82

def initialize(
  message = "Agent reached maximum iterations without producing a final answer",
  iterations: nil,
  max_iterations: nil,
  tools_used: [],
  history: [],
  last_observation: nil,
  partial_final_answer: nil
)
  @iterations = T.let(iterations, T.nilable(Integer))
  @max_iterations = T.let(max_iterations, T.nilable(Integer))
  @tools_used = T.let(tools_used, T::Array[String])
  @history = T.let(history, T::Array[T::Hash[Symbol, T.untyped]])
  @last_observation = last_observation
  @partial_final_answer = partial_final_answer
  super(message)
end

Instance Attribute Details

#historyObject (readonly)

Returns the value of attribute history.



63
64
65
# File 'lib/dspy/re_act.rb', line 63

def history
  @history
end

#iterationsObject (readonly)

Returns the value of attribute iterations.



54
55
56
# File 'lib/dspy/re_act.rb', line 54

def iterations
  @iterations
end

#last_observationObject (readonly)

Returns the value of attribute last_observation.



66
67
68
# File 'lib/dspy/re_act.rb', line 66

def last_observation
  @last_observation
end

#max_iterationsObject (readonly)

Returns the value of attribute max_iterations.



57
58
59
# File 'lib/dspy/re_act.rb', line 57

def max_iterations
  @max_iterations
end

#partial_final_answerObject (readonly)

Returns the value of attribute partial_final_answer.



69
70
71
# File 'lib/dspy/re_act.rb', line 69

def partial_final_answer
  @partial_final_answer
end

#tools_usedObject (readonly)

Returns the value of attribute tools_used.



60
61
62
# File 'lib/dspy/re_act.rb', line 60

def tools_used
  @tools_used
end