Enha: show tool response
This commit is contained in:
2
bot.go
2
bot.go
@@ -448,6 +448,8 @@ func findCall(msg, toolCall string, tv *tview.TextView) {
|
|||||||
}
|
}
|
||||||
resp := f(fc.Args)
|
resp := f(fc.Args)
|
||||||
toolMsg := fmt.Sprintf("tool response: %+v", string(resp))
|
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)
|
chatRound(toolMsg, cfg.ToolRole, tv, false, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
llm.go
2
llm.go
@@ -173,7 +173,7 @@ func (op OpenAIer) FormMsg(msg, role string, resume bool) (io.Reader, error) {
|
|||||||
ChatBody: chatBody,
|
ChatBody: chatBody,
|
||||||
Tools: nil,
|
Tools: nil,
|
||||||
}
|
}
|
||||||
if cfg.ToolUse && !resume {
|
if cfg.ToolUse && !resume && role != cfg.ToolRole {
|
||||||
req.Tools = baseTools // set tools to use
|
req.Tools = baseTools // set tools to use
|
||||||
}
|
}
|
||||||
data, err := json.Marshal(req)
|
data, err := json.Marshal(req)
|
||||||
|
|||||||
6
tools.go
6
tools.go
@@ -149,7 +149,7 @@ var baseTools = []models.Tool{
|
|||||||
Type: "function",
|
Type: "function",
|
||||||
Function: models.ToolFunc{
|
Function: models.ToolFunc{
|
||||||
Name: "memorise",
|
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{
|
Parameters: models.ToolFuncParams{
|
||||||
Type: "object",
|
Type: "object",
|
||||||
Required: []string{"topic", "data"},
|
Required: []string{"topic", "data"},
|
||||||
@@ -171,7 +171,7 @@ var baseTools = []models.Tool{
|
|||||||
Type: "function",
|
Type: "function",
|
||||||
Function: models.ToolFunc{
|
Function: models.ToolFunc{
|
||||||
Name: "recall",
|
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{
|
Parameters: models.ToolFuncParams{
|
||||||
Type: "object",
|
Type: "object",
|
||||||
Required: []string{"topic"},
|
Required: []string{"topic"},
|
||||||
@@ -189,7 +189,7 @@ var baseTools = []models.Tool{
|
|||||||
Type: "function",
|
Type: "function",
|
||||||
Function: models.ToolFunc{
|
Function: models.ToolFunc{
|
||||||
Name: "recall_topics",
|
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{
|
Parameters: models.ToolFuncParams{
|
||||||
Type: "object",
|
Type: "object",
|
||||||
Required: []string{},
|
Required: []string{},
|
||||||
|
|||||||
Reference in New Issue
Block a user