Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
import com.alibaba.cloud.ai.graph.NodeOutput;
import com.alibaba.cloud.ai.graph.OverAllState;
import com.alibaba.cloud.ai.graph.utils.CollectionsUtils;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.metadata.Usage;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -54,6 +56,26 @@ private InterruptionMetadata(Builder builder) {
}
}

/**
* Jackson deserialization constructor.
*/
@JsonCreator
public InterruptionMetadata(
@JsonProperty("node") String node,
@JsonProperty("agent") String agent,
@JsonProperty("state") OverAllState state,
@JsonProperty("subGraph") boolean subGraph,
@JsonProperty("tokenUsage") Usage tokenUsage,
@JsonProperty("metadata") Map<String, Object> metadata,
@JsonProperty("toolFeedbacks") List<ToolFeedback> toolFeedbacks,
@JsonProperty("toolsAutomaticallyApproved") List<AssistantMessage.ToolCall> toolsAutomaticallyApproved) {
super(node, agent, tokenUsage, state);
this.setSubGraph(subGraph);
this.metadata = metadata != null ? metadata : Map.of();
this.toolFeedbacks = toolFeedbacks != null ? new ArrayList<>(toolFeedbacks) : new ArrayList<>();
this.toolsAutomaticallyApproved = toolsAutomaticallyApproved != null ? new ArrayList<>(toolsAutomaticallyApproved) : new ArrayList<>();
}

/**
* Retrieves a metadata value associated with the specified key.
* @param key the key whose associated value is to be returned
Expand Down Expand Up @@ -199,7 +221,13 @@ public static class ToolFeedback {
FeedbackResult result;
String description;

public ToolFeedback(String id, String name, String arguments, FeedbackResult result, String description) {
@JsonCreator
public ToolFeedback(
@JsonProperty("id") String id,
@JsonProperty("name") String name,
@JsonProperty("arguments") String arguments,
@JsonProperty("result") FeedbackResult result,
@JsonProperty("description") String description) {
this.id = id;
this.name = name;
this.arguments = arguments;
Expand Down
Loading