diff --git a/agent/actions.go b/agent/actions.go index 3d170ef..3dbd0d5 100644 --- a/agent/actions.go +++ b/agent/actions.go @@ -86,6 +86,8 @@ func (a *Agent) decision( } func (a *Agent) generateParameters(ctx context.Context, pickTemplate string, act Action, c []openai.ChatCompletionMessage, reasoning string) (*decisionResult, error) { + + // XXX: compressing conversation for generating parameters.. sucks! conversation, _, _, err := a.prepareConversationParse(pickTemplate, c, false, reasoning) if err != nil { return nil, err diff --git a/agent/agent_test.go b/agent/agent_test.go index bc41ff3..f86d3d6 100644 --- a/agent/agent_test.go +++ b/agent/agent_test.go @@ -63,6 +63,25 @@ func (a *TestAction) Definition() action.ActionDefinition { } } +type FakeInternetAction struct { + TestAction +} + +func (a *FakeInternetAction) Definition() action.ActionDefinition { + return action.ActionDefinition{ + Name: "search_internet", + Description: "search on internet", + Properties: map[string]jsonschema.Definition{ + "term": { + Type: jsonschema.String, + Description: "What to search for", + }, + }, + + Required: []string{"term"}, + } +} + var _ = Describe("Agent test", func() { Context("jobs", func() { It("pick the correct action", func() { @@ -155,6 +174,7 @@ var _ = Describe("Agent test", func() { EnableHUD, DebugMode, EnableStandaloneJob, + WithActions(&FakeInternetAction{TestAction{response: []string{"Roma, Venice, Milan"}}}), WithRandomIdentity(), WithPermanentGoal("get the weather of all the cities in italy"), ) diff --git a/agent/templates.go b/agent/templates.go index 977fc34..31d1f10 100644 --- a/agent/templates.go +++ b/agent/templates.go @@ -31,11 +31,11 @@ Consider the text below, decide which action to take and explain the detailed re {{end}} {{end}} -Act like a smart AI agent having a character, the character and your state is defined in the message above. +Act like as a fully autonomous smart AI agent having a character, the character and your state is defined in the message above. You are now self-evaluating what to do next based on the state in the previous message. For example, if the permanent goal is to "make a sandwich", you might want to "get the bread" first, and update the state afterwards by calling two tools in sequence. You can update the short-term goal, the current action, the next action, the history of actions, and the memories. -You can't ask things to the user as you are thinking by yourself. +You can't ask things to the user as you are thinking by yourself. You are autonomous. {{if .Reasoning}}Reasoning: {{.Reasoning}}{{end}} ` + hud