Skip to content

Commit

Permalink
feat: add toString()
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Sep 14, 2024
1 parent b210f38 commit 7445a88
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import org.bsc.langgraph4j.RunnableConfig;
import org.bsc.langgraph4j.checkpoint.Checkpoint;

import static java.lang.String.*;

public final class StateSnapshot<State extends AgentState> extends NodeOutput<State> {
private final RunnableConfig config;

Expand Down Expand Up @@ -37,6 +39,11 @@ private StateSnapshot(@NonNull String node, @NonNull State state, @NonNull Runna
this.config = config;
}

@Override
public String toString() {

return format("StateSnapshot{node=%s, state=%s, config=%s}", node(), state(), config());
}
public static <State extends AgentState> StateSnapshot<State> of(Checkpoint checkpoint, RunnableConfig config, AgentStateFactory<State> factory) {

RunnableConfig newConfig = RunnableConfig.builder(config)
Expand All @@ -46,4 +53,5 @@ public static <State extends AgentState> StateSnapshot<State> of(Checkpoint chec
return new StateSnapshot<>( checkpoint.getNodeId(), factory.apply(checkpoint.getState()), newConfig);
}


}

0 comments on commit 7445a88

Please sign in to comment.