Skip to content

Commit

Permalink
feat(StateSnapshot): add support StateSnaphot object
Browse files Browse the repository at this point in the history
work on #14
  • Loading branch information
bsorrentino committed Aug 26, 2024
1 parent 509d7eb commit cc86564
Showing 1 changed file with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
package org.bsc.langgraph4j.state;public class StateSnapshot {
package org.bsc.langgraph4j.state;

import lombok.NonNull;
import lombok.Value;
import lombok.var;
import org.bsc.langgraph4j.RunnableConfig;
import org.bsc.langgraph4j.checkpoint.Checkpoint;

@Value
public class StateSnapshot {
AgentState state;
String next;
RunnableConfig config;

private StateSnapshot(@NonNull AgentState state, @NonNull String next, @NonNull RunnableConfig config) {
this.state = state;
this.next = next;
this.config = config;
}

public static StateSnapshot of(Checkpoint checkpoint, RunnableConfig config) {

var newConfig = RunnableConfig.builder(config)
.checkPointId( checkpoint.getId() )
.build() ;
return new StateSnapshot(checkpoint.getState(), checkpoint.getNextNodeId(), newConfig);
}

}

0 comments on commit cc86564

Please sign in to comment.