Streamline toolbox usage and update dependencies

Enhanced the toolbox in `search.go` to require tools explicitly with `WithRequireTool(true)`, improving execution control. Updated multiple library dependencies in `go.mod` and `go.sum` to ensure compatibility, stability, and to leverage the latest features. Added logging for `CallAndExecute` results to aid in debugging.
This commit is contained in:
2025-04-04 20:14:46 -04:00
parent 1aaed4ea28
commit 4f1a7e5b80
3 changed files with 35 additions and 31 deletions

View File

@@ -161,7 +161,7 @@ func (a Agent) SearchAndUseTools(ctx context.Context, searchQuery string, questi
Use appropriate tools to analyze the search results and determine if they answer the question.`).
WithSystemPromptSuffix(``).
WithToolbox(gollm.NewToolBox(converted...))
WithToolbox(gollm.NewToolBox(converted...).WithRequireTool(true))
var searches = make([]string, len(searchResults))
for i, r := range searchResults {
@@ -179,6 +179,7 @@ Use appropriate tools to analyze the search results and determine if they answer
results, err = a.CallAndExecute(ctx, messages...)
}
slog.Info("search results called and executed", "error", err, "results text", results.Text, "results", results.CallResults)
if err != nil {
return knowledge, fmt.Errorf("error executing search function: %w", err)
}