From 5e6863379cc57a91f4fac148cb1146c1e0b56325 Mon Sep 17 00:00:00 2001 From: mudler Date: Wed, 25 Dec 2024 23:17:40 +0100 Subject: [PATCH] Time shouldn't be part of the Hud, but always rendered Signed-off-by: mudler --- agent/actions.go | 2 -- agent/state.go | 1 - agent/templates.go | 9 ++++++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/agent/actions.go b/agent/actions.go index 9d0e407..8b4c7a1 100644 --- a/agent/actions.go +++ b/agent/actions.go @@ -3,7 +3,6 @@ package agent import ( "context" "fmt" - "time" "github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/xlog" @@ -196,7 +195,6 @@ func (a *Agent) prepareHUD() PromptHUD { CurrentState: *a.currentState, PermanentGoal: a.options.permanentGoal, ShowCharacter: a.options.showCharacter, - Time: time.Now().Format(time.RFC3339), } } diff --git a/agent/state.go b/agent/state.go index a44c34f..05f42cd 100644 --- a/agent/state.go +++ b/agent/state.go @@ -18,7 +18,6 @@ type PromptHUD struct { CurrentState action.StateResult `json:"current_state"` PermanentGoal string `json:"permanent_goal"` ShowCharacter bool `json:"show_character"` - Time string `json:"time"` } type Character struct { diff --git a/agent/templates.go b/agent/templates.go index 0b2055e..4575c9c 100644 --- a/agent/templates.go +++ b/agent/templates.go @@ -3,6 +3,7 @@ package agent import ( "bytes" "html/template" + "time" "github.com/mudler/local-agent-framework/action" "github.com/sashabaranov/go-openai" @@ -28,10 +29,12 @@ func renderTemplate(templ string, hud *PromptHUD, actions Actions, reasoning str Actions []action.ActionDefinition Reasoning string Messages []openai.ChatCompletionMessage + Time string }{ Actions: definitions, HUD: hud, Reasoning: reasoning, + Time: time.Now().Format(time.RFC3339), }) if err != nil { return "", err @@ -42,7 +45,7 @@ func renderTemplate(templ string, hud *PromptHUD, actions Actions, reasoning str const innerMonologueTemplate = `"This is not a typical conversation between an assistant and an user. You are thinking out loud by yourself now, and you are evaluating the current situation. -Considering the goal and the persistent goal, if you have one, and do something, or decide to plan something for later on. If you have the action available, you might also decide to engage a conversation with the user by notifying him."` +Considering the goal and the persistent goal (if you have one) do an action or decide to plan something for later on. If possible for you, you might also decide to engage a conversation with the user by notifying him."` const hudTemplate = `{{with .HUD }}{{if .ShowCharacter}}The assistant acts like an human, has a character and the replies and actions might be influenced by it. {{if .Character.Name}}This is the assistant name: {{.Character.Name}} @@ -54,13 +57,13 @@ const hudTemplate = `{{with .HUD }}{{if .ShowCharacter}}The assistant acts like {{end}} This is your current state: -Current time: {{.Time}} NowDoing: {{if .CurrentState.NowDoing}}{{.CurrentState.NowDoing}}{{else}}Nothing{{end}} DoingNext: {{if .CurrentState.DoingNext}}{{.CurrentState.DoingNext}}{{else}}Nothing{{end}} Your permanent goal is: {{if .PermanentGoal}}{{.PermanentGoal}}{{else}}Nothing{{end}} Your current goal is: {{if .CurrentState.Goal}}{{.CurrentState.Goal}}{{else}}Nothing{{end}} You have done: {{range .CurrentState.DoneHistory}}{{.}} {{end}} -You have a short memory with: {{range .CurrentState.Memories}}{{.}} {{end}}{{end}}` +You have a short memory with: {{range .CurrentState.Memories}}{{.}} {{end}}{{end}} +Current time: is {{.Time}}` const pickSelfTemplate = `You can take any of the following tools: