Package com.tnsai.planning.llm
Record Class LLMPlan
java.lang.Object
java.lang.Record
com.tnsai.planning.llm.LLMPlan
- Record Components:
goal- the original natural-language goalsteps- ordered list of plan stepsreasoning- overall reasoning/strategy explanation
An LLM-generated execution plan.
Contains the ordered steps, overall reasoning, and the original goal.
Plans are immutable once created but can be modified via withReorderedSteps(List)
or withoutStep(int) for user approval workflows.
- Since:
- 0.3.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLLMPlan(String goal, List<LLMPlanStep> steps, String reasoning) Creates an instance of aLLMPlanrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.goal()Returns the value of thegoalrecord component.final inthashCode()Returns a hash code value for this object.booleanisEmpty()Returns true if the plan has no steps.Returns the value of thereasoningrecord component.remainingFrom(int fromIndex) Creates a new plan with only the remaining steps starting from the given index.intsize()Returns the number of steps in this plan.steps()Returns the value of thestepsrecord component.Formats the plan for display to users.final StringtoString()Returns a string representation of this record class.withoutStep(int stepIndex) Creates a new plan with the step at the given index removed.withReorderedSteps(List<Integer> newOrder) Creates a new plan with steps reordered according to the given indices.
-
Constructor Details
-
Method Details
-
size
public int size()Returns the number of steps in this plan. -
isEmpty
public boolean isEmpty()Returns true if the plan has no steps. -
withReorderedSteps
Creates a new plan with steps reordered according to the given indices.- Parameters:
newOrder- list of step indices in desired order- Returns:
- new plan with reordered steps
- Throws:
IndexOutOfBoundsException- if any index is invalid
-
withoutStep
Creates a new plan with the step at the given index removed.- Parameters:
stepIndex- the step to remove- Returns:
- new plan without the specified step
- Throws:
IndexOutOfBoundsException- if index is invalid
-
remainingFrom
Creates a new plan with only the remaining steps starting from the given index.- Parameters:
fromIndex- start index (inclusive)- Returns:
- new plan with remaining steps
-
toDisplayString
Formats the plan for display to users. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
goal
Returns the value of thegoalrecord component.- Returns:
- the value of the
goalrecord component
-
steps
Returns the value of thestepsrecord component.- Returns:
- the value of the
stepsrecord component
-
reasoning
Returns the value of thereasoningrecord component.- Returns:
- the value of the
reasoningrecord component
-