diff --git a/agent/actions.go b/agent/actions.go index 6364c6d..8106c69 100644 --- a/agent/actions.go +++ b/agent/actions.go @@ -88,38 +88,26 @@ func (a *Agent) generateParameters(ctx context.Context, action Action, conversat const pickActionTemplate = `You can take any of the following tools: {{range .Actions -}} -{{.Name}}: {{.Description }} +- {{.Name}}: {{.Description }} {{ end }} - -To answer back to the user, use the "answer" tool. +To answer back to the user, use the "reply" tool. Given the text below, decide which action to take and explain the detailed reasoning behind it. For answering without picking a choice, reply with 'none'. -{{range .Messages }} -{{if eq .Role "tool"}}Tool result{{else}}{{.Role}}{{ end }}: {{.Content}} -{{if .FunctionCall}} -Tool called with: {{.FunctionCall}} -{{end}} -{{range .ToolCalls}} -{{.Name}}: {{.Arguments}} -{{end}} +{{range .Messages -}} +{{.Role}}{{if .FunctionCall}}(tool_call){{.FunctionCall}}{{end}}: {{if .FunctionCall}}{{.FunctionCall}}{{else if .ToolCalls -}}{{range .ToolCalls -}}{{.Name}} called with {{.Arguments}}{{end}}{{ else }}{{.Content -}}{{end}} {{end}} ` const reEvalTemplate = `You can take any of the following tools: -{{range .Actions}}{{.Name}}: {{.Description}}{{end}} - -To answer back to the user, use the "answer" tool. -For answering without picking a choice, reply with 'none'. - -Given the text below, decide which action to take and explain the reasoning behind it. +{{range .Actions -}} +- {{.Name}}: {{.Description }} +{{ end }} +To answer back to the user, use the "reply" tool. +Given the text below, decide which action to take and explain the detailed reasoning behind it. For answering without picking a choice, reply with 'none'. {{range .Messages -}} -{{if eq .Role "tool" }}Tool result{{else}}{{.Role}}: {{ end }}{{.Content }} -{{if .FunctionCall}}Tool called with: {{.FunctionCall}}{{end}} -{{range .ToolCalls}} -{{.Name}}: {{.Arguments}} -{{end}} +{{.Role}}{{if .FunctionCall}}(tool_call){{.FunctionCall}}{{end}}: {{if .FunctionCall}}{{.FunctionCall}}{{else if .ToolCalls -}}{{range .ToolCalls -}}{{.Name}} called with {{.Arguments}}{{end}}{{ else }}{{.Content -}}{{end}} {{end}} We already have called tools. Evaluate the current situation and decide if we need to execute other tools or answer back with a result.` diff --git a/agent/agent_test.go b/agent/agent_test.go index 3252cac..910a086 100644 --- a/agent/agent_test.go +++ b/agent/agent_test.go @@ -11,7 +11,7 @@ import ( ) const testActionResult = "In Boston it's 30C today, it's sunny, and humidity is at 98%" -const testActionResult2 = "In milan it's very hot today" +const testActionResult2 = "In milan it's very hot today, it is 45C and the humidity is at 200%" var _ Action = &TestAction{}