From 6955a5bc3a89e982f0b05d1e8e6f109e3b79d9ca Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Fri, 8 Aug 2025 14:26:01 +0300 Subject: Enha: show tool response --- bot.go | 2 ++ llm.go | 2 +- tools.go | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bot.go b/bot.go index 776a373..35ea0fa 100644 --- a/bot.go +++ b/bot.go @@ -448,6 +448,8 @@ func findCall(msg, toolCall string, tv *tview.TextView) { } resp := f(fc.Args) toolMsg := fmt.Sprintf("tool response: %+v", string(resp)) + fmt.Fprintf(tv, "%s[-:-:b](%d) <%s>: [-:-:-]\n%s\n", + "\n", len(chatBody.Messages), cfg.ToolRole, toolMsg) chatRound(toolMsg, cfg.ToolRole, tv, false, false) } diff --git a/llm.go b/llm.go index 14caa5c..05874a1 100644 --- a/llm.go +++ b/llm.go @@ -173,7 +173,7 @@ func (op OpenAIer) FormMsg(msg, role string, resume bool) (io.Reader, error) { ChatBody: chatBody, Tools: nil, } - if cfg.ToolUse && !resume { + if cfg.ToolUse && !resume && role != cfg.ToolRole { req.Tools = baseTools // set tools to use } data, err := json.Marshal(req) diff --git a/tools.go b/tools.go index dee0577..acc4697 100644 --- a/tools.go +++ b/tools.go @@ -149,7 +149,7 @@ var baseTools = []models.Tool{ Type: "function", Function: models.ToolFunc{ Name: "memorise", - Description: "save topic-data in key-value cache", + Description: "Save topic-data in key-value cache. Use when asked to remember something/keep in mind.", Parameters: models.ToolFuncParams{ Type: "object", Required: []string{"topic", "data"}, @@ -171,7 +171,7 @@ var baseTools = []models.Tool{ Type: "function", Function: models.ToolFunc{ Name: "recall", - Description: "recall topic-data from key-value cache", + Description: "Recall topic-data from key-value cache. Use when precise info about the topic is needed.", Parameters: models.ToolFuncParams{ Type: "object", Required: []string{"topic"}, @@ -189,7 +189,7 @@ var baseTools = []models.Tool{ Type: "function", Function: models.ToolFunc{ Name: "recall_topics", - Description: "recall all topics from key-value cache", + Description: "Recall all topics from key-value cache. Use when need to know what topics are currently stored in memory.", Parameters: models.ToolFuncParams{ Type: "object", Required: []string{}, -- cgit v1.2.3