-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(StateSnapshot): add support StateSnaphot object
work on #14
- Loading branch information
1 parent
509d7eb
commit cc86564
Showing
1 changed file
with
28 additions
and
1 deletion.
There are no files selected for viewing
29 changes: 28 additions & 1 deletion
29
core-jdk8/src/main/java/org/bsc/langgraph4j/state/StateSnapshot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |