Skip to content

Commit 58a6a4b

Browse files
authored
Merge pull request #314 from thedadams/fmt-instructions-last
fix: print instructions last when fmt-ing
2 parents 930a767 + 210f53a commit 58a6a4b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pkg/types/tool.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,19 @@ func (t Tool) String() string {
267267
if t.Parameters.InternalPrompt != nil {
268268
_, _ = fmt.Fprintf(buf, "Internal Prompt: %v\n", *t.Parameters.InternalPrompt)
269269
}
270-
if t.Instructions != "" && t.BuiltinFunc == nil {
271-
_, _ = fmt.Fprintln(buf)
272-
_, _ = fmt.Fprintln(buf, t.Instructions)
273-
}
274270
if len(t.Parameters.Credentials) > 0 {
275271
_, _ = fmt.Fprintf(buf, "Credentials: %s\n", strings.Join(t.Parameters.Credentials, ", "))
276272
}
277273
if t.Chat {
278274
_, _ = fmt.Fprintf(buf, "Chat: true\n")
279275
}
280276

277+
// Instructions should be printed last
278+
if t.Instructions != "" && t.BuiltinFunc == nil {
279+
_, _ = fmt.Fprintln(buf)
280+
_, _ = fmt.Fprintln(buf, t.Instructions)
281+
}
282+
281283
return buf.String()
282284
}
283285

0 commit comments

Comments
 (0)