diff --git a/pkg/types/tool.go b/pkg/types/tool.go index b6eb8528..7ef0d0fc 100644 --- a/pkg/types/tool.go +++ b/pkg/types/tool.go @@ -267,10 +267,6 @@ func (t Tool) String() string { if t.Parameters.InternalPrompt != nil { _, _ = fmt.Fprintf(buf, "Internal Prompt: %v\n", *t.Parameters.InternalPrompt) } - if t.Instructions != "" && t.BuiltinFunc == nil { - _, _ = fmt.Fprintln(buf) - _, _ = fmt.Fprintln(buf, t.Instructions) - } if len(t.Parameters.Credentials) > 0 { _, _ = fmt.Fprintf(buf, "Credentials: %s\n", strings.Join(t.Parameters.Credentials, ", ")) } @@ -278,6 +274,12 @@ func (t Tool) String() string { _, _ = fmt.Fprintf(buf, "Chat: true\n") } + // Instructions should be printed last + if t.Instructions != "" && t.BuiltinFunc == nil { + _, _ = fmt.Fprintln(buf) + _, _ = fmt.Fprintln(buf, t.Instructions) + } + return buf.String() }