improve templating
This commit is contained in:
@@ -88,38 +88,26 @@ func (a *Agent) generateParameters(ctx context.Context, action Action, conversat
|
|||||||
const pickActionTemplate = `You can take any of the following tools:
|
const pickActionTemplate = `You can take any of the following tools:
|
||||||
|
|
||||||
{{range .Actions -}}
|
{{range .Actions -}}
|
||||||
{{.Name}}: {{.Description }}
|
- {{.Name}}: {{.Description }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
To answer back to the user, use the "reply" tool.
|
||||||
To answer back to the user, use the "answer" 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'.
|
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 }}
|
{{range .Messages -}}
|
||||||
{{if eq .Role "tool"}}Tool result{{else}}{{.Role}}{{ end }}: {{.Content}}
|
{{.Role}}{{if .FunctionCall}}(tool_call){{.FunctionCall}}{{end}}: {{if .FunctionCall}}{{.FunctionCall}}{{else if .ToolCalls -}}{{range .ToolCalls -}}{{.Name}} called with {{.Arguments}}{{end}}{{ else }}{{.Content -}}{{end}}
|
||||||
{{if .FunctionCall}}
|
|
||||||
Tool called with: {{.FunctionCall}}
|
|
||||||
{{end}}
|
|
||||||
{{range .ToolCalls}}
|
|
||||||
{{.Name}}: {{.Arguments}}
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
{{end}}
|
||||||
`
|
`
|
||||||
|
|
||||||
const reEvalTemplate = `You can take any of the following tools:
|
const reEvalTemplate = `You can take any of the following tools:
|
||||||
|
|
||||||
{{range .Actions}}{{.Name}}: {{.Description}}{{end}}
|
{{range .Actions -}}
|
||||||
|
- {{.Name}}: {{.Description }}
|
||||||
To answer back to the user, use the "answer" tool.
|
{{ end }}
|
||||||
For answering without picking a choice, reply with 'none'.
|
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'.
|
||||||
Given the text below, decide which action to take and explain the reasoning behind it.
|
|
||||||
|
|
||||||
{{range .Messages -}}
|
{{range .Messages -}}
|
||||||
{{if eq .Role "tool" }}Tool result{{else}}{{.Role}}: {{ end }}{{.Content }}
|
{{.Role}}{{if .FunctionCall}}(tool_call){{.FunctionCall}}{{end}}: {{if .FunctionCall}}{{.FunctionCall}}{{else if .ToolCalls -}}{{range .ToolCalls -}}{{.Name}} called with {{.Arguments}}{{end}}{{ else }}{{.Content -}}{{end}}
|
||||||
{{if .FunctionCall}}Tool called with: {{.FunctionCall}}{{end}}
|
|
||||||
{{range .ToolCalls}}
|
|
||||||
{{.Name}}: {{.Arguments}}
|
|
||||||
{{end}}
|
|
||||||
{{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.`
|
We already have called tools. Evaluate the current situation and decide if we need to execute other tools or answer back with a result.`
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const testActionResult = "In Boston it's 30C today, it's sunny, and humidity is at 98%"
|
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{}
|
var _ Action = &TestAction{}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user