From 324cbcd2a6f5a2a4e00c6fca6a04064e2a42e455 Mon Sep 17 00:00:00 2001 From: mudler Date: Tue, 16 Apr 2024 18:54:37 +0200 Subject: [PATCH] Force answering when answering was chosen --- agent/agent.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/agent/agent.go b/agent/agent.go index b90e600..244b10a 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -471,6 +471,8 @@ func (a *Agent) consumeJob(job *Job, role string) { } } + // At this point can only be a reply action + // decode the response 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 a.options.enableHUD { var promptHUD *PromptHUD