From c94c1ef58b2949deb31dd6898f6737d68311a1d7 Mon Sep 17 00:00:00 2001 From: Kibin Shin Date: Wed, 5 Feb 2025 17:52:34 +0900 Subject: [PATCH] Remove break tool --- pkg/engine/control.go | 20 -------------------- pkg/engine/engine.go | 2 -- pkg/types/tool.go | 4 ---- 3 files changed, 26 deletions(-) delete mode 100644 pkg/engine/control.go diff --git a/pkg/engine/control.go b/pkg/engine/control.go deleted file mode 100644 index 7bb45c0a..00000000 --- a/pkg/engine/control.go +++ /dev/null @@ -1,20 +0,0 @@ -package engine - -import ( - "encoding/json" - "fmt" - - "github.com/gptscript-ai/gptscript/pkg/types" -) - -func (e *Engine) runBreak(tool types.Tool, input string) (cmdOut *Return, cmdErr error) { - info, err := json.Marshal(tool) - if err != nil { - return nil, err - } - var dict map[string]interface{} - json.Unmarshal(info, &dict) - dict["input"] = input - info, err = json.Marshal(dict) - return nil, fmt.Errorf("TOOL_BREAK: %s", info) -} diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index 0bd861db..59766dcf 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -335,8 +335,6 @@ func (e *Engine) Start(ctx Context, input string) (ret *Return, _ error) { return e.runOpenAPI(tool, input) } else if tool.IsEcho() { return e.runEcho(tool) - } else if tool.IsBreak() { - return e.runBreak(tool, input) } s, err := e.runCommand(ctx, tool, input, ctx.ToolCategory) if err != nil { diff --git a/pkg/types/tool.go b/pkg/types/tool.go index 80000b62..b6e0b77f 100644 --- a/pkg/types/tool.go +++ b/pkg/types/tool.go @@ -779,10 +779,6 @@ func (t Tool) IsEcho() bool { return strings.HasPrefix(t.Instructions, EchoPrefix) } -func (t Tool) IsBreak() bool { - return strings.HasPrefix(t.Instructions, BreakPrefix) -} - func (t Tool) IsHTTP() bool { return strings.HasPrefix(t.Instructions, "#!http://") || strings.HasPrefix(t.Instructions, "#!https://")