Force answering when answering was chosen

This commit is contained in:
mudler
2024-04-16 18:54:37 +02:00
parent 35d9ba44f5
commit 324cbcd2a6

View File

@@ -471,6 +471,8 @@ func (a *Agent) consumeJob(job *Job, role string) {
} }
} }
// At this point can only be a reply action
// decode the response // decode the response
replyResponse := action.ReplyResponse{} replyResponse := action.ReplyResponse{}
@@ -494,6 +496,14 @@ func (a *Agent) consumeJob(job *Job, role string) {
// } // }
// } // }
// Force the AI to response without using any tool
// Why: some models might be silly enough to attempt to call tools even if evaluated
// that a reply was not necessary anymore
a.currentConversation = append(a.currentConversation, openai.ChatCompletionMessage{
Role: "system",
Content: "The assistant needs to reply without using any tool. " + replyResponse.Message,
})
// If we have a hud, display it // If we have a hud, display it
if a.options.enableHUD { if a.options.enableHUD {
var promptHUD *PromptHUD var promptHUD *PromptHUD