Skip to content

Commit 7f7ef63

Browse files
Allow internal prompt to be skipped
1 parent 5174792 commit 7f7ef63

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

pkg/engine/engine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func (e *Engine) Start(ctx Context, input string) (*Return, error) {
180180
Temperature: tool.Temperature,
181181
}
182182

183-
if InternalSystemPrompt != "" {
183+
if InternalSystemPrompt != "" && (tool.InternalPrompt == nil || *tool.InternalPrompt) {
184184
completion.Messages = append(completion.Messages, types.CompletionMessage{
185185
Role: types.CompletionMessageRoleTypeSystem,
186186
Content: types.Text(InternalSystemPrompt),

pkg/monitor/display.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (l *livePrinter) end() {
6868
return
6969
}
7070
if l.needsNewline {
71-
fmt.Println()
71+
_, _ = fmt.Fprintln(os.Stderr)
7272
}
7373
l.needsNewline = false
7474
}
@@ -83,7 +83,7 @@ func (l *livePrinter) print(event runner.Event, c call) {
8383

8484
last := l.lastLines[c.ID]
8585
line := strings.TrimPrefix(event.Content, last)
86-
fmt.Print(line)
86+
_, _ = fmt.Fprint(os.Stderr, line)
8787
l.needsNewline = !strings.HasSuffix(line, "\n")
8888
l.lastLines[c.ID] = event.Content
8989
}

pkg/parser/parser.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ func isParam(line string, tool *types.Tool) (_ bool, err error) {
7979
tool.ModelName = value
8080
case "description":
8181
tool.Description = value
82+
case "internalprompt":
83+
v, err := toBool(value)
84+
if err != nil {
85+
return false, err
86+
}
87+
tool.InternalPrompt = &v
8288
case "tools":
8389
tool.Tools = append(tool.Tools, csv(strings.ToLower(value))...)
8490
case "args":

pkg/types/tool.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ type Program struct {
2323
type BuiltinFunc func(ctx context.Context, env []string, input string) (string, error)
2424

2525
type Tool struct {
26-
ID string `json:"id,omitempty"`
27-
Name string `json:"name,omitempty"`
28-
Description string `json:"description,omitempty"`
29-
Arguments *JSONSchema `json:"arguments,omitempty"`
30-
Instructions string `json:"instructions,omitempty"`
31-
Tools []string `json:"tools,omitempty"`
32-
ToolMapping map[string]string `json:"toolMapping,omitempty"`
33-
LocalTools map[string]string `json:"localTools,omitempty"`
34-
BuiltinFunc BuiltinFunc `json:"-"`
26+
ID string `json:"id,omitempty"`
27+
Name string `json:"name,omitempty"`
28+
Description string `json:"description,omitempty"`
29+
InternalPrompt *bool `json:"internalPrompt"`
30+
Arguments *JSONSchema `json:"arguments,omitempty"`
31+
Instructions string `json:"instructions,omitempty"`
32+
Tools []string `json:"tools,omitempty"`
33+
ToolMapping map[string]string `json:"toolMapping,omitempty"`
34+
LocalTools map[string]string `json:"localTools,omitempty"`
35+
BuiltinFunc BuiltinFunc `json:"-"`
3536

3637
Vision bool `json:"vision,omitempty"`
3738
MaxTokens int `json:"maxTokens,omitempty"`

0 commit comments

Comments
 (0)