aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/aflow/func_tool.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/aflow/func_tool.go')
-rw-r--r--pkg/aflow/func_tool.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/aflow/func_tool.go b/pkg/aflow/func_tool.go
index 48b47b1e5..dde359485 100644
--- a/pkg/aflow/func_tool.go
+++ b/pkg/aflow/func_tool.go
@@ -4,6 +4,8 @@
package aflow
import (
+ "errors"
+
"github.com/google/syzkaller/pkg/aflow/trajectory"
"google.golang.org/genai"
)
@@ -24,6 +26,17 @@ func NewFuncTool[State, Args, Results any](name string, fn func(*Context, State,
}
}
+// BadCallError creates an error that means that LLM made a bad tool call,
+// the provided message will be returned to the LLM as an error,
+// instead of failing the whole workflow.
+func BadCallError(message string) error {
+ return &badCallError{errors.New(message)}
+}
+
+type badCallError struct {
+ error
+}
+
type funcTool[State, Args, Results any] struct {
Name string
Description string