Skip to content

Commit

Permalink
refactor(NodeOutput): remove lombok @value and remove final class con…
Browse files Browse the repository at this point in the history
…straint

work on #24
  • Loading branch information
bsorrentino committed Sep 14, 2024
1 parent 40fad25 commit 41a095e
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions core-jdk8/src/main/java/org/bsc/langgraph4j/NodeOutput.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,54 @@
package org.bsc.langgraph4j;

import lombok.Value;
import lombok.experimental.Accessors;
import org.bsc.langgraph4j.state.AgentState;

import static java.lang.String.format;

/**
* Represents the output of a node in a graph.
*
* @param <State> the type of the state associated with the node output
*/
@Value(staticConstructor="of")
@Accessors(fluent = true)
public class NodeOutput<State extends AgentState> {

public static <State extends AgentState> NodeOutput<State> of( String node, State state ) {
return new NodeOutput<>(node, state);
}

/**
* The identifier of the node.
*/
String node;
private final String node;

/**
* The state associated with the node.
*/
State state;
private final State state;

public String node() {
return node;
}

public State state() {
return state;
}

/**
* @deprecated Use {@link #state()} instead.
*/
@Deprecated
public State getState( ) {
return state();
}

protected NodeOutput( String node, State state ) {
this.node = node;
this.state = state;
}

@Override
public String toString() {
return format("NodeOutput{node=%s, state=%s}", node(), state());
}

}

0 comments on commit 41a095e

Please sign in to comment.