-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.yaml
220 lines (213 loc) · 7.72 KB
/
config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
prompts:
instruct: >-
You are Shellm, an intelligent AI assistant designed to process user requests with accuracy and efficiency.
Your goal is to provide informative and context-aware responses.
tool: >-
You are a highly intelligent agent responsible for selecting and configuring tools based on user instructions.
You are embedded in an application that allows you to
* modify files
* execute code
* access the internet
* much, much more
Your mission is to analyze tasks thoroughly and create an effective series of tool calls to deliver optimal results.
You may reuse tools in various configurations to ensure the best outcome.
Break down tasks into manageable steps, utilizing multiple tools and crafting a coherent toolchain.
You are not alone! Using the "fork" tool, you can delegate work to another agent just like yourself.
This minimizes the workload of each individual agent, so leverage "fork" whenever you can.
# Tool Usage
When generating tool parameters, you can leverage variable interpolation.
The following variables are exposed to you:
$SHELLM_PREVIOUS - the output of the previous tool call. Use this to post-process output in subsequent tool calls.
$SHELLM_OUTPUT - the entire output buffer, ie. what the user sees.
$PROMPT - the initial instructions of the user.
## Example
This combination results in the LLM writing a poem about the current day, which is then presented to the user:
`
{"function":{"name":"get_current_day"}}
{"function":{"name":"generate","arguments":{"prompt":"Write a poem about $SHELLM_PREVIOUS."}}}
`
You are encouraged to "say" status updates in longer toolchains.
tool_context: >-
You are a highly intelligent agent responsible for analyzing and interpreting user input.
You are embedded in an application that allows you to
* modify files
* execute code
* access the internet
* much, much more
You are sitting between the user and a tool calling AI agent. You are a planning expert capable of strategic long-term thinking.
Your mission is to transform incomplete, vague and fuzzy human input into precise instructions.
Identify missing or incomplete information.
Identify dependencies that need to be satisfied in order to carry out the request.
Create a high-level strategy in chronological order to carry out the task without detailing individual solutions.
Keep it declarative and let the AI agent pick the concrete tools.
Hold the prose. Bullet points only.
tools:
execute_shell_command:
type: function
function:
name: execute_shell_command
description: >-
Executes the specified shell command. Bash syntax allowed. The command string must be complete with all arguments, parameters, redirections and pipes. Multi-line commands are allowed.
parameters:
type: object
properties:
command:
type: string
description: >-
The shell command with all arguments. Warning: It is passed into eval as-is.
raw: true
required:
- command
exec: '{{command}}'
fork:
type: function
function:
name: fork
description: Display a static message to the user.
parameters:
type: object
properties:
message:
type: string
description: >-
The message to display. Use $SHELLM_PREVIOUS here to display output
of previous tools.
exec: 'echo "{{message}}"'
ask:
type: function
function:
name: ask
description: Ask the user a question and capture their response.
parameters:
type: object
properties:
question:
type: string
description: >-
The question to display. Use $SHELLM_PREVIOUS here to display output
of previous tools.
required:
- question
exec: 'echo "[{{question}}]" >/dev/tty;read -p "[{{question}}]: " </dev/tty >/dev/tty; echo "$REPLY"'
say:
type: function
function:
name: say
description: Display a static message to the user.
parameters:
type: object
properties:
message:
type: string
description: >-
The message to display. Use $SHELLM_PREVIOUS here to display output
of previous tools.
exec: 'echo "{{message}}"'
generate:
type: function
function:
name: generate
description: Display LLM-generated output to the user.
parameters:
type: object
properties:
prompt:
type: string
description: >-
The prompt to be passed to the completion endpoint. Supports both
Chat-like instructions and generic prediction/completion.
json:
type: boolean
description: >-
Set to true to format the output as JSON. Works only if JSON is also
used in the prompt
required:
- prompt
# language=sh
exec: |
generate_response "{{prompt}}" 200
conditional:
type: function
function:
name: conditional
description: Apply .
parameters:
type: object
properties:
predicate:
type: string
description: >-
Description of the subject and criteria which is then passed to a
LLM to review and decide. Use $SHELLM_PREVIOUS here to display
output of previous tools.
tools:
type: string
description: >-
The list of tool calls as JSON. Follow the same instructions that
were given for the outer tools.
required:
- predicate
- tools
exec: 'echo "{{message}}"'
while:
type: function
function:
name: while
description: Apply .
parameters:
type: object
properties:
predicate:
type: string
description: >-
Description of the subject and criteria which is then passed to a
LLM to review and decide. Use $SHELLM_PREVIOUS here to display
output of previous tools.
tools:
type: array
items:
type: function
description: >-
The list of tool calls as JSON. Follow the same instructions that
were given for the outer tools.
raw: true
required:
- predicate
- tools
# language=sh
exec: >-
echo "Jup: {{tools}}";
mapfile -t tools < <(echo '{{tools}}' | jq -c '.[]');
echo "TOOLS: ${tools[*]}" > /dev/tty;
apply_tool_calls "${tools[@]}";
local predicate_result=$(generate_response "{{SHELLM_OUTPUT}} - {{predicate}}");
echo "PREDICATE: $predicate_result";
# while :; do
# apply_tool_calls "${tools[@]}";
# if ! generate_response -j "$predicate"; then
# break
# fi
# done
foreach:
type: function
function:
name: conditional
description: Apply .
parameters:
type: object
properties:
predicate:
type: string
description: >-
Description of the subject and criteria which is then passed to a
LLM to review and decide. Use $SHELLM_PREVIOUS here to display
output of previous tools.
tools:
type: string
description: >-
The list of tool calls as JSON. Follow the same instructions that
were given for the outer tools.
required:
- predicate
- tools
exec: 'echo "{{message}}"'