diff --git a/adk/common/tool/follow_up_tool.go b/adk/common/tool/follow_up_tool.go index c1496b1..bc6f292 100644 --- a/adk/common/tool/follow_up_tool.go +++ b/adk/common/tool/follow_up_tool.go @@ -24,7 +24,6 @@ import ( "github.com/cloudwego/eino/components/tool" "github.com/cloudwego/eino/components/tool/utils" - "github.com/cloudwego/eino/compose" "github.com/cloudwego/eino/schema" ) @@ -59,30 +58,26 @@ func init() { } func FollowUp(ctx context.Context, input *FollowUpToolInput) (string, error) { - wasInterrupted, _, storedState := compose.GetInterruptState[*FollowUpState](ctx) + wasInterrupted, _, storedState := tool.GetInterruptState[*FollowUpState](ctx) if !wasInterrupted { - // First invocation: parse input, create info/state, and interrupt. info := &FollowUpInfo{Questions: input.Questions} state := &FollowUpState{Questions: input.Questions} - return "", compose.StatefulInterrupt(ctx, info, state) + return "", tool.StatefulInterrupt(ctx, info, state) } - // Resume flow: check if we are the target and get the user's answer. - isResumeTarget, hasData, resumeData := compose.GetResumeContext[*FollowUpInfo](ctx) + isResumeTarget, hasData, resumeData := tool.GetResumeContext[*FollowUpInfo](ctx) if !isResumeTarget { - // Not for us. Re-interrupt with the same questions from the stored state. info := &FollowUpInfo{Questions: storedState.Questions} - return "", compose.StatefulInterrupt(ctx, info, storedState) + return "", tool.StatefulInterrupt(ctx, info, storedState) } if !hasData || resumeData.UserAnswer == "" { return "", fmt.Errorf("tool resumed without a user answer") } - // Success. The tool's output is the user's answer. return resumeData.UserAnswer, nil } diff --git a/adk/common/tool/review_edit_wrapper.go b/adk/common/tool/review_edit_wrapper.go index f2b673d..a974056 100644 --- a/adk/common/tool/review_edit_wrapper.go +++ b/adk/common/tool/review_edit_wrapper.go @@ -21,7 +21,6 @@ import ( "fmt" "github.com/cloudwego/eino/components/tool" - "github.com/cloudwego/eino/compose" "github.com/cloudwego/eino/schema" ) @@ -29,7 +28,6 @@ import ( type ReviewEditInfo struct { ToolName string ArgumentsInJSON string - ToolCallID string ReviewResult *ReviewEditResult } @@ -69,21 +67,19 @@ func (i InvokableReviewEditTool) InvokableRun(ctx context.Context, argumentsInJS return "", err } - wasInterrupted, _, storedArguments := compose.GetInterruptState[string](ctx) - if !wasInterrupted { // Initial invocation, interrupt for review. - return "", compose.StatefulInterrupt(ctx, &ReviewEditInfo{ + wasInterrupted, _, storedArguments := tool.GetInterruptState[string](ctx) + if !wasInterrupted { + return "", tool.StatefulInterrupt(ctx, &ReviewEditInfo{ ToolName: toolInfo.Name, ArgumentsInJSON: argumentsInJSON, - ToolCallID: compose.GetToolCallID(ctx), }, argumentsInJSON) } - isResumeTarget, hasData, data := compose.GetResumeContext[*ReviewEditInfo](ctx) - if !isResumeTarget { // Not for us, re-interrupt. - return "", compose.StatefulInterrupt(ctx, &ReviewEditInfo{ + isResumeTarget, hasData, data := tool.GetResumeContext[*ReviewEditInfo](ctx) + if !isResumeTarget { + return "", tool.StatefulInterrupt(ctx, &ReviewEditInfo{ ToolName: toolInfo.Name, ArgumentsInJSON: storedArguments, - ToolCallID: compose.GetToolCallID(ctx), }, storedArguments) } if !hasData || data.ReviewResult == nil {