aia 0.5.11 → 0.5.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semver +1 -1
- data/CHANGELOG.md +5 -0
- data/README.md +68 -7
- data/justfile +5 -0
- data/lib/aia/cli.rb +31 -4
- data/lib/aia/directives.rb +11 -1
- data/lib/aia/main.rb +15 -2
- data/main.just +5 -0
- data/man/aia.1 +29 -1
- data/man/aia.1.md +31 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fa0d67e36209d8ac1840c94820ce58e0b6c08a6b01e47e579dfe90f04b94420
|
4
|
+
data.tar.gz: 382d34ab554077b0e81d3a724362b41463e5ccc88f888dbba00b1ad65ff0c528
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 109f27eb85889450bd19bb78a123d02ba789bd99708cf7be20528a8da8c090a7ef68655e60f7fda31a0da12a506a38f3fcdf8c9d2b4a2ea9096006ab81c5d494
|
7
|
+
data.tar.gz: 4b46125f0937d74ea4fe446c343b474f7c3b7d0443def5fea9782a5eea9a7c7bf4997e866871723dc2e4fe2d4fd9db07fe7384f9a95655891efbbfac5711a40f
|
data/.semver
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.5.12] 2024-02-24
|
4
|
+
- Happy Birthday Ruby!
|
5
|
+
- Added --next CLI option
|
6
|
+
- Added --pipeline CLI option
|
7
|
+
|
3
8
|
## [0.5.11] 2024-02-18
|
4
9
|
- allow directives to return information that is inserted into the prompt text
|
5
10
|
- added //shell command directive
|
data/README.md
CHANGED
@@ -6,18 +6,16 @@ It leverages the `prompt_manager` gem to manage prompts for the `mods` and `sgpt
|
|
6
6
|
|
7
7
|
**Most Recent Change**: Refer to the [Changelog](CHANGELOG.md)
|
8
8
|
|
9
|
+
> v0.5.12
|
10
|
+
> - Supports Prompt Sequencing
|
11
|
+
> - Added --next option
|
12
|
+
> - Added --pipeline option
|
13
|
+
>
|
9
14
|
> v0.5.11
|
10
15
|
> - Allow directives to prepend content into the prompt text
|
11
16
|
> - Added //include path_to_file
|
12
17
|
> - Added //shell shell_command
|
13
18
|
> - Added //ruby ruby code
|
14
|
-
>
|
15
|
-
> v0.5.10
|
16
|
-
> - Added --roles_dir
|
17
|
-
> - Changed --prompts to --prompts_dir
|
18
|
-
> - Fixed Issue 33
|
19
|
-
>
|
20
|
-
|
21
19
|
|
22
20
|
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
23
21
|
|
@@ -41,6 +39,10 @@ It leverages the `prompt_manager` gem to manage prompts for the `mods` and `sgpt
|
|
41
39
|
- [//shell](#shell)
|
42
40
|
- [Backend Directive Commands](#backend-directive-commands)
|
43
41
|
- [Using Directives in Chat Sessions](#using-directives-in-chat-sessions)
|
42
|
+
- [Prompt Sequences](#prompt-sequences)
|
43
|
+
- [--next](#--next)
|
44
|
+
- [--pipeline](#--pipeline)
|
45
|
+
- [Best Practices ??](#best-practices-)
|
44
46
|
- [All About ROLES](#all-about-roles)
|
45
47
|
- [The --roles_dir (AIA_ROLES_DIR)](#the---roles_dir-aia_roles_dir)
|
46
48
|
- [The --role Option](#the---role-option)
|
@@ -298,6 +300,65 @@ Whe you are in a chat session, you may use a directive as a follow up prompt. F
|
|
298
300
|
The directive is executed and a new follow up prompt can be entered with a more lengthy response generated from the backend.
|
299
301
|
|
300
302
|
|
303
|
+
## Prompt Sequences
|
304
|
+
|
305
|
+
Why would you need/want to use a sequence of prompts in a batch situation. Maybe you have a complex prompt which exceeds the token limitations of your model for input so you need to break it up into multiple parts. Or suppose its a simple prompt but the number of tokens on the output is limited and you do not get exactly the kind of full response for which you were looking.
|
306
|
+
|
307
|
+
Sometimes it takes a series of prompts to get the kind of response that you want. The reponse from one prompt becomes a context for the next prompt. This is easy to do within a `chat` session were you are manually entering and adjusting your prompts until you get the kind of response that you want.
|
308
|
+
|
309
|
+
If you need to do this on a regular basis or within a batch you can use `aia` and the `--next` and `--pipeline` command line options.
|
310
|
+
|
311
|
+
These two options specify the sequence of prompt IDs to be processed. Both options are available to be used within a prompt file using the `//config` directive. Like all embedded directives you can take advantage of parameterization shell integration and Ruby. I'm start to feel like TIm Tool man - more power!
|
312
|
+
|
313
|
+
Consider the condition in which you have 4 prompt IDs that need to be processed in sequence. The IDs and associated prompt file names are:
|
314
|
+
|
315
|
+
| Promt ID | Prompt File |
|
316
|
+
| -------- | ----------- |
|
317
|
+
| one. | one.txt |
|
318
|
+
| two. | two.txt |
|
319
|
+
| three. | three.txt |
|
320
|
+
| four. | four.txt |
|
321
|
+
|
322
|
+
|
323
|
+
### --next
|
324
|
+
|
325
|
+
```shell
|
326
|
+
export AIA_OUT_FILE=temp.md
|
327
|
+
aia one --next two
|
328
|
+
aia three --next four temp.md
|
329
|
+
```
|
330
|
+
|
331
|
+
or within each of the prompt files you use the config directive:
|
332
|
+
|
333
|
+
```
|
334
|
+
one.txt contains //config next two
|
335
|
+
two.txt contains //config next three
|
336
|
+
three.txt contains //config next four
|
337
|
+
```
|
338
|
+
BUT if you have more than two prompts in your sequence then consider using the --pipeline option.
|
339
|
+
|
340
|
+
### --pipeline
|
341
|
+
|
342
|
+
`aia one --pipeline two,three,four`
|
343
|
+
|
344
|
+
or inside of the `one.txt` prompt file use this directive:
|
345
|
+
|
346
|
+
`//config pipeline two,three,four`
|
347
|
+
|
348
|
+
### Best Practices ??
|
349
|
+
|
350
|
+
Since the response of one prompt is fed into the next prompt within the sequence instead of having all prompts write their response to the same out file, use these directives inside the associated prompt files:
|
351
|
+
|
352
|
+
|
353
|
+
| Prompt File | Directive |
|
354
|
+
| --- | --- |
|
355
|
+
| one.txt | //config out_file one.md |
|
356
|
+
| two.txt | //config out_file two.md |
|
357
|
+
| three.txt | //config out_file three.md |
|
358
|
+
| four.txt | //config out_file four.md |
|
359
|
+
|
360
|
+
This way you can see the response that was generated for each prompt in the sequence.
|
361
|
+
|
301
362
|
## All About ROLES
|
302
363
|
|
303
364
|
### The --roles_dir (AIA_ROLES_DIR)
|
data/justfile
CHANGED
@@ -157,6 +157,11 @@ view_man_page: create_man_page
|
|
157
157
|
create_man_page:
|
158
158
|
rake man
|
159
159
|
|
160
|
+
|
161
|
+
# Generate the Documentation
|
162
|
+
gen_doc: create_man_page update_toc_in_readmen
|
163
|
+
|
164
|
+
|
160
165
|
##########################################
|
161
166
|
|
162
167
|
# Tag the current commit, push it, then bump the version
|
data/lib/aia/cli.rb
CHANGED
@@ -27,9 +27,8 @@ class AIA::Cli
|
|
27
27
|
load_config_file unless AIA.config.config_file.nil?
|
28
28
|
|
29
29
|
convert_to_pathname_objects
|
30
|
-
|
30
|
+
error_on_invalid_option_combinations
|
31
31
|
setup_prompt_manager
|
32
|
-
|
33
32
|
execute_immediate_commands
|
34
33
|
end
|
35
34
|
|
@@ -47,6 +46,29 @@ class AIA::Cli
|
|
47
46
|
end
|
48
47
|
|
49
48
|
|
49
|
+
def error_on_invalid_option_combinations
|
50
|
+
# --chat is intended as an interactive exchange
|
51
|
+
if AIA.config.chat?
|
52
|
+
unless AIA.config.next.empty?
|
53
|
+
abort "ERROR: Cannot use --next with --chat"
|
54
|
+
end
|
55
|
+
unless STDOUT == AIA.config.out_file
|
56
|
+
abort "ERROR: Cannot use --out_file with --chat"
|
57
|
+
end
|
58
|
+
unless AIA.config.pipeline.empty?
|
59
|
+
abort "ERROR: Cannot use --pipeline with --chat"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# --next says which prompt to process next
|
64
|
+
# but --pipeline gives an entire sequence of prompts for processing
|
65
|
+
unless AIA.config.next.empty?
|
66
|
+
unless AIA.config.pipeline.empty?
|
67
|
+
abort "ERROR: Cannot use --pipeline with --next"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
50
72
|
def string_to_pathname(string)
|
51
73
|
['~/', '$HOME/'].each do |prefix|
|
52
74
|
if string.start_with? prefix
|
@@ -151,6 +173,8 @@ class AIA::Cli
|
|
151
173
|
verbose?: [false, "-v --verbose"],
|
152
174
|
version?: [false, "--version"],
|
153
175
|
#
|
176
|
+
next: ['', "-n --next"],
|
177
|
+
pipeline: [[], "--pipeline"],
|
154
178
|
role: ['', "-r --role"],
|
155
179
|
#
|
156
180
|
config_file:[nil, "-c --config_file"],
|
@@ -263,8 +287,11 @@ class AIA::Cli
|
|
263
287
|
else
|
264
288
|
value = arguments[index + 1]
|
265
289
|
if value.nil? || value.start_with?('-')
|
266
|
-
|
267
|
-
|
290
|
+
abort "ERROR: #{option_sym} requires a parameter value"
|
291
|
+
elsif "--pipeline" == switch
|
292
|
+
prompt_sequence = value.split(',')
|
293
|
+
AIA.config[option_sym] = prompt_sequence
|
294
|
+
arguments.slice!(index,2)
|
268
295
|
else
|
269
296
|
AIA.config[option_sym] = value
|
270
297
|
arguments.slice!(index,2)
|
data/lib/aia/directives.rb
CHANGED
@@ -60,8 +60,18 @@ class AIA::Directives
|
|
60
60
|
value = parts.join
|
61
61
|
if item.end_with?('?')
|
62
62
|
AIA.config[item] = %w[1 y yea yes t true].include?(value.downcase)
|
63
|
+
elsif item.end_with?('_file')
|
64
|
+
if "STDOUT" == value.upcase
|
65
|
+
AIA.config[item] = STDOUT
|
66
|
+
elsif "STDERR" == value.upcase
|
67
|
+
AIA.config[item] = STDERR
|
68
|
+
else
|
69
|
+
AIA.config[item] = value.start_with?('/') ?
|
70
|
+
Pathname.new(value) :
|
71
|
+
Pathname.pwd + value
|
72
|
+
end
|
63
73
|
else
|
64
|
-
AIA.config[item] =
|
74
|
+
AIA.config[item] = value
|
65
75
|
end
|
66
76
|
end
|
67
77
|
|
data/lib/aia/main.rb
CHANGED
@@ -43,11 +43,11 @@ class AIA::Main
|
|
43
43
|
|
44
44
|
@logger.info(AIA.config) if AIA.config.debug? || AIA.config.verbose?
|
45
45
|
|
46
|
-
@prompt = AIA::Prompt.new.prompt
|
47
|
-
|
48
46
|
|
49
47
|
@directives_processor = AIA::Directives.new
|
50
48
|
|
49
|
+
@prompt = AIA::Prompt.new.prompt
|
50
|
+
|
51
51
|
# TODO: still should verify that the tools are ion the $PATH
|
52
52
|
# tools.class.verify_tools
|
53
53
|
end
|
@@ -71,6 +71,8 @@ class AIA::Main
|
|
71
71
|
end
|
72
72
|
|
73
73
|
|
74
|
+
# This will be recursive with the new options
|
75
|
+
# --next and --pipeline
|
74
76
|
def call
|
75
77
|
directive_output = @directives_processor.execute_my_directives
|
76
78
|
|
@@ -124,6 +126,17 @@ class AIA::Main
|
|
124
126
|
speak result
|
125
127
|
lets_chat
|
126
128
|
end
|
129
|
+
|
130
|
+
return if AIA.config.next.empty? && AIA.config.pipeline.empty?
|
131
|
+
|
132
|
+
# Reset some config items to defaults
|
133
|
+
AIA.config.directives = []
|
134
|
+
AIA.config.next = AIA.config.pipeline.shift
|
135
|
+
AIA.config.arguments = [AIA.config.next, AIA.config.out_file.to_s]
|
136
|
+
AIA.config.next = ""
|
137
|
+
|
138
|
+
@prompt = AIA::Prompt.new.prompt
|
139
|
+
call # Recurse!
|
127
140
|
end
|
128
141
|
|
129
142
|
|
data/main.just
CHANGED
@@ -55,6 +55,11 @@ view_man_page: create_man_page
|
|
55
55
|
create_man_page:
|
56
56
|
rake man
|
57
57
|
|
58
|
+
|
59
|
+
# Generate the Documentation
|
60
|
+
gen_doc: create_man_page update_toc_in_readmen
|
61
|
+
|
62
|
+
|
58
63
|
##########################################
|
59
64
|
|
60
65
|
# Tag the current commit, push it, then bump the version
|
data/man/aia.1
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
.\" Generated by kramdown-man 1.0.1
|
2
2
|
.\" https://github.com/postmodern/kramdown-man#readme
|
3
|
-
.TH aia 1 "v0.5.
|
3
|
+
.TH aia 1 "v0.5.12" AIA "User Manuals"
|
4
4
|
.SH NAME
|
5
5
|
.PP
|
6
6
|
aia \- command\-line interface for an AI assistant
|
@@ -78,9 +78,15 @@ Log FILEPATH \- default is \[Do]HOME\[sl]\.prompts\[sl]prompts\.log
|
|
78
78
|
\fB\-m\fR, \fB\-\-\[lB]no\[rB]\-markdown\fR
|
79
79
|
Format with Markdown \- default is true
|
80
80
|
.TP
|
81
|
+
\fB\-n\fR, \fB\-\-next PROMPT\[ru]ID\fR
|
82
|
+
Specifies the next prompt ID to be processed using the response for the previous prompt ID\[cq]s processing as a context within which to process the next prompt \- default is an empty string
|
83
|
+
.TP
|
81
84
|
\fB\-o\fR, \fB\-\-\[lB]no\[rB]\-out\[ru]file\fR \fIPATH\[ru]TO\[ru]OUTPUT\[ru]FILE\fP
|
82
85
|
Out FILENAME \- default is \.\[sl]temp\.md
|
83
86
|
.TP
|
87
|
+
\fB\-\-pipeline PID1,PID2,PID3\fR
|
88
|
+
Specifies a pipeline of prompt IDs (PID) in which the respone the first prompt is fed into the second prompt as context whose response is fed into the third as context, etc\. It is a comma seperated list\. There is no artificial limit to the number of prompt IDs in the pipeline \- default is an empty list
|
89
|
+
.TP
|
84
90
|
\fB\-p\fR, \fB\-\-prompts\[ru]dir\fR \fIPATH\[ru]TO\[ru]DIRECTORY\fP
|
85
91
|
Directory containing the prompt files \- default is \[ti]\[sl]\.prompts
|
86
92
|
.TP
|
@@ -141,6 +147,28 @@ Some directives are:
|
|
141
147
|
.IP \(bu 2
|
142
148
|
\[sl]\[sl]shell shell\[ru]command
|
143
149
|
.RE
|
150
|
+
.SH Prompt Sequences
|
151
|
+
.PP
|
152
|
+
The \fB\-\-next\fR and \fB\-\-pipeline\fR command line options allow for the sequencing of prompts such that the first prompt\[cq]s response feeds into the second prompt\[cq]s context and so on\. Suppose you had a complex sequence of prompts with IDs one, two, three and four\. You would use the following \fBaia\fR command to process them in sequence:
|
153
|
+
.PP
|
154
|
+
\fBaia one \-\-pipeline two,three,four\fR
|
155
|
+
.PP
|
156
|
+
Notice that the value for the pipelined prompt IDs has no spaces\. This is so that the command line parser does not mistake one of the promp IDs as a CLI option and issue an error\.
|
157
|
+
.SS Prompt Sequences Inside of a Prompt File
|
158
|
+
.PP
|
159
|
+
You can also use the \fBconfig\fR directive inside of a prompt file to specify a sequence\. Given the example above of 4 prompt IDs you could add this directive to the prompt file \fBone\.txt\fR
|
160
|
+
.PP
|
161
|
+
\fB\[sl]\[sl]config next two\fR
|
162
|
+
.PP
|
163
|
+
Then inside the prompt file \fBtwo\.txt\fR you could use this directive:
|
164
|
+
.PP
|
165
|
+
\fB\[sl]\[sl]config pipeline three,four\fR
|
166
|
+
.PP
|
167
|
+
or just
|
168
|
+
.PP
|
169
|
+
\fB\[sl]\[sl]config next three\fR
|
170
|
+
.PP
|
171
|
+
if you want to specify them one at a time\.
|
144
172
|
.SH SEE ALSO
|
145
173
|
.RS
|
146
174
|
.IP \(bu 2
|
data/man/aia.1.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# aia 1 "v0.5.
|
1
|
+
# aia 1 "v0.5.12" AIA "User Manuals"
|
2
2
|
|
3
3
|
## NAME
|
4
4
|
|
@@ -82,9 +82,15 @@ The aia command-line tool is an interface for interacting with an AI model backe
|
|
82
82
|
`-m`, `--[no]-markdown`
|
83
83
|
: Format with Markdown - default is true
|
84
84
|
|
85
|
+
`-n`, `--next PROMPT_ID`
|
86
|
+
: Specifies the next prompt ID to be processed using the response for the previous prompt ID's processing as a context within which to process the next prompt - default is an empty string
|
87
|
+
|
85
88
|
`-o`, `--[no]-out_file` *PATH_TO_OUTPUT_FILE*
|
86
89
|
: Out FILENAME - default is ./temp.md
|
87
90
|
|
91
|
+
`--pipeline PID1,PID2,PID3`
|
92
|
+
: Specifies a pipeline of prompt IDs (PID) in which the respone the first prompt is fed into the second prompt as context whose response is fed into the third as context, etc. It is a comma seperated list. There is no artificial limit to the number of prompt IDs in the pipeline - default is an empty list
|
93
|
+
|
88
94
|
`-p`, `--prompts_dir` *PATH_TO_DIRECTORY*
|
89
95
|
: Directory containing the prompt files - default is ~/.prompts
|
90
96
|
|
@@ -141,6 +147,30 @@ Some directives are:
|
|
141
147
|
- //ruby ruby_code
|
142
148
|
- //shell shell_command
|
143
149
|
|
150
|
+
## Prompt Sequences
|
151
|
+
|
152
|
+
The `--next` and `--pipeline` command line options allow for the sequencing of prompts such that the first prompt's response feeds into the second prompt's context and so on. Suppose you had a complex sequence of prompts with IDs one, two, three and four. You would use the following `aia` command to process them in sequence:
|
153
|
+
|
154
|
+
`aia one --pipeline two,three,four`
|
155
|
+
|
156
|
+
Notice that the value for the pipelined prompt IDs has no spaces. This is so that the command line parser does not mistake one of the promp IDs as a CLI option and issue an error.
|
157
|
+
|
158
|
+
### Prompt Sequences Inside of a Prompt File
|
159
|
+
|
160
|
+
You can also use the `config` directive inside of a prompt file to specify a sequence. Given the example above of 4 prompt IDs you could add this directive to the prompt file `one.txt`
|
161
|
+
|
162
|
+
`//config next two`
|
163
|
+
|
164
|
+
Then inside the prompt file `two.txt` you could use this directive:
|
165
|
+
|
166
|
+
`//config pipeline three,four`
|
167
|
+
|
168
|
+
or just
|
169
|
+
|
170
|
+
`//config next three`
|
171
|
+
|
172
|
+
if you want to specify them one at a time.
|
173
|
+
|
144
174
|
|
145
175
|
## SEE ALSO
|
146
176
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dewayne VanHoozer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|