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.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkg/aflow/func_tool.go b/pkg/aflow/func_tool.go
index cd069db84..48b47b1e5 100644
--- a/pkg/aflow/func_tool.go
+++ b/pkg/aflow/func_tool.go
@@ -40,11 +40,17 @@ func (t *funcTool[State, Args, Results]) declaration() *genai.FunctionDeclaratio
}
func (t *funcTool[State, Args, Results]) execute(ctx *Context, args map[string]any) (map[string]any, error) {
- state, err := convertFromMap[State](ctx.state, false)
+ state, err := convertFromMap[State](ctx.state, false, false)
if err != nil {
return nil, err
}
- a, err := convertFromMap[Args](args, true)
+ // We parse args in non-strict mode too.
+ // LLM shouldn't provide excessive args, but they are known to mess up things
+ // in all possible ways occasionally. Generally we want to handle such cases
+ // in some way, rather than fail the whole workflow. We could reply to it
+ // with an error about this, but it's unclear if the additional round-trip
+ // worth it, it already provided all the actual arguments.
+ a, err := convertFromMap[Args](args, false, true)
if err != nil {
return nil, err
}