aia 0.5.18 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.envrc +1 -0
  3. data/.version +1 -1
  4. data/CHANGELOG.md +39 -5
  5. data/README.md +388 -219
  6. data/Rakefile +16 -5
  7. data/_notes.txt +231 -0
  8. data/bin/aia +3 -2
  9. data/examples/README.md +140 -0
  10. data/examples/headlines +21 -0
  11. data/lib/aia/ai_client_adapter.rb +210 -0
  12. data/lib/aia/chat_processor_service.rb +120 -0
  13. data/lib/aia/config.rb +473 -4
  14. data/lib/aia/context_manager.rb +58 -0
  15. data/lib/aia/directive_processor.rb +267 -0
  16. data/lib/aia/{tools/fzf.rb → fzf.rb} +9 -17
  17. data/lib/aia/history_manager.rb +85 -0
  18. data/lib/aia/prompt_handler.rb +178 -0
  19. data/lib/aia/session.rb +215 -0
  20. data/lib/aia/shell_command_executor.rb +109 -0
  21. data/lib/aia/ui_presenter.rb +110 -0
  22. data/lib/aia/utility.rb +24 -0
  23. data/lib/aia/version.rb +9 -6
  24. data/lib/aia.rb +57 -61
  25. data/lib/extensions/openstruct_merge.rb +44 -0
  26. metadata +29 -43
  27. data/LICENSE.txt +0 -21
  28. data/doc/aia_and_pre_compositional_prompts.md +0 -474
  29. data/lib/aia/clause.rb +0 -7
  30. data/lib/aia/cli.rb +0 -452
  31. data/lib/aia/directives.rb +0 -142
  32. data/lib/aia/dynamic_content.rb +0 -26
  33. data/lib/aia/logging.rb +0 -62
  34. data/lib/aia/main.rb +0 -265
  35. data/lib/aia/prompt.rb +0 -275
  36. data/lib/aia/tools/ai_client_backend.rb +0 -92
  37. data/lib/aia/tools/backend_common.rb +0 -58
  38. data/lib/aia/tools/client.rb +0 -197
  39. data/lib/aia/tools/editor.rb +0 -52
  40. data/lib/aia/tools/glow.rb +0 -90
  41. data/lib/aia/tools/llm.rb +0 -77
  42. data/lib/aia/tools/mods.rb +0 -100
  43. data/lib/aia/tools/sgpt.rb +0 -79
  44. data/lib/aia/tools/subl.rb +0 -68
  45. data/lib/aia/tools/vim.rb +0 -93
  46. data/lib/aia/tools.rb +0 -88
  47. data/lib/aia/user_query.rb +0 -21
  48. data/lib/core_ext/string_wrap.rb +0 -73
  49. data/lib/core_ext/tty-spinner_log.rb +0 -25
  50. data/man/aia.1 +0 -272
  51. data/man/aia.1.md +0 -236
data/lib/aia/tools/vim.rb DELETED
@@ -1,93 +0,0 @@
1
- # lib/aia/tools/vim.rb
2
-
3
- class AIA::Vim < AIA::Tools
4
-
5
- meta(
6
- name: 'vim',
7
- role: :editor,
8
- desc: "Vi IMproved (VIM)",
9
- url: "https://www.vim.org",
10
- install: "brew install vim",
11
- )
12
-
13
- DEFAULT_PARAMETERS = [
14
- " ", # no parameters
15
- ].join(' ')
16
-
17
- attr_accessor :command
18
-
19
-
20
- def initialize(file: "")
21
- @file = file
22
-
23
- build_command
24
- end
25
-
26
-
27
- def build_command
28
- @command = "#{meta.name} #{DEFAULT_PARAMETERS} #{@file}"
29
- end
30
-
31
-
32
- def run
33
- # Using 'system' instead of backticks becuase
34
- # with the back ticks vim was complaining that it
35
- # was not connected to a terminal.
36
- system command
37
- end
38
- end
39
-
40
- __END__
41
-
42
- VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Sep 30 2023 05:45:56)
43
-
44
- Usage: vim [arguments] [file ..] edit specified file(s)
45
- or: vim [arguments] - read text from stdin
46
- or: vim [arguments] -t tag edit file where tag is defined
47
- or: vim [arguments] -q [errorfile] edit file with first error
48
-
49
- Arguments:
50
- -- Only file names after this
51
- -v Vi mode (like "vi")
52
- -e Ex mode (like "ex")
53
- -E Improved Ex mode
54
- -s Silent (batch) mode (only for "ex")
55
- -d Diff mode (like "vimdiff")
56
- -y Easy mode (like "evim", modeless)
57
- -R Readonly mode (like "view")
58
- -Z Restricted mode (like "rvim")
59
- -m Modifications (writing files) not allowed
60
- -M Modifications in text not allowed
61
- -b Binary mode
62
- -l Lisp mode
63
- -C Compatible with Vi: 'compatible'
64
- -N Not fully Vi compatible: 'nocompatible'
65
- -V[N][fname] Be verbose [level N] [log messages to fname]
66
- -D Debugging mode
67
- -n No swap file, use memory only
68
- -r List swap files and exit
69
- -r (with file name) Recover crashed session
70
- -L Same as -r
71
- -T <terminal> Set terminal type to <terminal>
72
- --not-a-term Skip warning for input/output not being a terminal
73
- --ttyfail Exit if input or output is not a terminal
74
- -u <vimrc> Use <vimrc> instead of any .vimrc
75
- --noplugin Don't load plugin scripts
76
- -p[N] Open N tab pages (default: one for each file)
77
- -o[N] Open N windows (default: one for each file)
78
- -O[N] Like -o but split vertically
79
- + Start at end of file
80
- +<lnum> Start at line <lnum>
81
- --cmd <command> Execute <command> before loading any vimrc file
82
- -c <command> Execute <command> after loading the first file
83
- -S <session> Source file <session> after loading the first file
84
- -s <scriptin> Read Normal mode commands from file <scriptin>
85
- -w <scriptout> Append all typed commands to file <scriptout>
86
- -W <scriptout> Write all typed commands to file <scriptout>
87
- -x Edit encrypted files
88
- --startuptime <file> Write startup timing messages to <file>
89
- --log <file> Start logging to <file> early
90
- -i <viminfo> Use <viminfo> instead of .viminfo
91
- --clean 'nocompatible', Vim defaults, no plugins, no viminfo
92
- -h or --help Print Help (this message) and exit
93
- --version Print version information and exit
data/lib/aia/tools.rb DELETED
@@ -1,88 +0,0 @@
1
- # lib/aia/tools.rb
2
-
3
- require 'hashie'
4
-
5
- class AIA::Tools
6
- @@catalog = []
7
-
8
- def meta = self.class::meta
9
-
10
- class << self
11
- def inherited(subclass)
12
- subclass_meta = Hashie::Mash.new(klass: subclass)
13
- subclass.instance_variable_set(:@_metadata, subclass_meta)
14
-
15
- @@catalog << subclass_meta
16
- end
17
-
18
-
19
- def meta(metadata = nil)
20
- return @_metadata if metadata.nil?
21
-
22
- @_metadata = Hashie::Mash.new(metadata)
23
- entry = @@catalog.detect { |item| item[:klass] == self }
24
-
25
- entry.merge!(metadata) if entry
26
- end
27
-
28
-
29
- def get_meta
30
- @_metadata
31
- end
32
-
33
-
34
- def search_for(criteria = {})
35
- @@catalog.select do |meta|
36
- criteria.all? { |k, v| meta[k] == v }
37
- end
38
- end
39
-
40
-
41
- def catalog
42
- @@catalog
43
- end
44
-
45
-
46
- def load_tools
47
- Dir.glob(File.join(File.dirname(__FILE__), 'tools', '*.rb')).each do |file|
48
- require file
49
- end
50
- end
51
-
52
-
53
- def validate_tools
54
- raise "NotImplemented"
55
- end
56
-
57
-
58
- def setup_backend
59
- AIA.config.tools.backend = find_and_initialize_backend
60
- end
61
-
62
-
63
- private
64
-
65
- def find_and_initialize_backend
66
- found = AIA::Tools.search_for(name: AIA.config.backend, role: :backend)
67
- abort_no_backend_error if found.empty?
68
- abort_too_many_backends_error(found) if found.size > 1
69
-
70
- backend_klass = found.first.klass
71
- abort "Backend not found: #{AIA.config.backend}" unless backend_klass
72
-
73
- backend_klass.new(
74
- text: "",
75
- files: []
76
- )
77
- end
78
-
79
- def abort_no_backend_error
80
- abort "There are no :backend tools named #{AIA.config.backend}"
81
- end
82
-
83
- def abort_too_many_backends_error(found)
84
- abort "There are #{found.size} :backend tools with the name #{AIA.config.backend}"
85
- end
86
-
87
- end
88
- end
@@ -1,21 +0,0 @@
1
- # aia/lia/aia/user_query.rb
2
-
3
- require 'reline'
4
-
5
- module AIA::UserQuery
6
-
7
- # Function to prompt the user with a question using reline
8
- def ask_question_with_reline(prompt)
9
- if prompt.start_with?("\n")
10
- puts
11
- puts
12
- prompt = prompt[1..]
13
- end
14
-
15
- answer = Reline.readline(prompt)
16
- Reline::HISTORY.push(answer) unless answer.nil? || Reline::HISTORY.to_a.include?(answer)
17
- answer
18
- rescue Interrupt
19
- ''
20
- end
21
- end
@@ -1,73 +0,0 @@
1
- # lib/string_wrap.rb
2
-
3
- require 'io/console'
4
-
5
- # This is a monkey patch to the String class which is
6
- # okay in this context since this program is a
7
- # stand-alone terminal utility. Otherwise we would
8
- # use a refinement or a namespace to keep this from
9
- # impact other code.
10
-
11
- class String
12
- def wrap(line_width: nil, indent: 0)
13
- # If line_width is not given, try to detect the terminal width
14
- line_width ||= IO.console ? IO.console.winsize[1] : 80
15
-
16
- # Prepare the prefix based on the type of the indent parameter
17
- prefix = indent.is_a?(String) ? indent : ' ' * indent.to_i
18
-
19
- # Split the string into paragraphs first, preserve paragraph breaks
20
- paragraphs = self.split(/\n{2,}/)
21
-
22
- # Create an empty array that will hold all wrapped paragraphs
23
- wrapped_paragraphs = []
24
-
25
- # Process each paragraph separately
26
- paragraphs.each do |paragraph|
27
- wrapped_lines = [] # Create an empty array for wrapped lines of the current paragraph
28
-
29
- # Split the paragraph into lines first, in case there are single newlines
30
- lines = paragraph.split(/(?<=\n)/)
31
-
32
- # Process each line separately to maintain single newlines
33
- lines.each do |line|
34
- words = line.split
35
- current_line = ""
36
-
37
- words.each do |word|
38
- if word.include?("\n") && !word.strip.empty?
39
- # If the word contains a newline, split and process as separate lines
40
- parts = word.split(/(?<=\n)/)
41
-
42
- parts.each_with_index do |part, index|
43
- if part == "\n"
44
- wrapped_lines << prefix + current_line
45
- current_line = ""
46
- else
47
- current_line << " " unless current_line.empty? or index == 0
48
- current_line << part.strip
49
- end
50
- end
51
-
52
- elsif current_line.length + word.length + 1 > line_width - prefix.length
53
- wrapped_lines << prefix + current_line.rstrip
54
- current_line = word
55
-
56
- else
57
- current_line << " " unless current_line.empty?
58
- current_line << word
59
- end
60
- end
61
-
62
- # Don't forget to add the last line unless it's empty
63
- wrapped_lines << prefix + current_line unless current_line.empty?
64
- end
65
-
66
- # Preserve the paragraph structure by joining the wrapped lines and append to the wrapped_paragraphs array
67
- wrapped_paragraphs << wrapped_lines.join("\n")
68
- end
69
-
70
- # Join wrapped paragraphs with double newlines into a single string
71
- wrapped_paragraphs.join("\n\n")
72
- end
73
- end
@@ -1,25 +0,0 @@
1
- # aia/lib/core_ext/tty-spinner_log.rb
2
- #
3
- # The gem's README shows the log method; bit the
4
- # author has been spinning his wheels since 2021 on pushing a release
5
- # with it. This is a stop gap.
6
-
7
- module TTY
8
- class Spinner
9
- # Log a message to the output
10
- # This will clear the current spinner line, print the log message,
11
- # and then redraw or resume the spinner on a new line.
12
- #
13
- # @param [String] message
14
- # the log message to print
15
- #
16
- # @api public
17
- def log(message)
18
- synchronize do
19
- clear_line # Clear the spinner
20
- output.puts(message) # Log the message
21
- redraw_indent # Redraw the spinner frame
22
- end
23
- end
24
- end
25
- end
data/man/aia.1 DELETED
@@ -1,272 +0,0 @@
1
- .\" Generated by kramdown-man 1.0.1
2
- .\" https://github.com/postmodern/kramdown-man#readme
3
- .TH aia 1 "v0.5.18" AIA "User Manuals"
4
- .SH NAME
5
- .PP
6
- aia \- command\-line interface for an AI assistant
7
- .SH SYNOPSIS
8
- .PP
9
- aia \[lB]options\[rB]* PROMPT\[ru]ID \[lB]CONTEXT\[ru]FILE\[rB]* \[lB]\-\- EXTERNAL\[ru]OPTIONS\[pl]\[rB]
10
- .SH DESCRIPTION
11
- .PP
12
- The aia command\-line tool is an interface for interacting with an AI model backend, providing a simple way to send prompts and receive responses\. The CLI supports various options to customize the interaction, load a configuration file, edit prompts, set debugging levels, and more\.
13
- .SH ARGUMENTS
14
- .TP
15
- \fIPROMPT\[ru]ID\fP
16
- This is a required argument\.
17
- .TP
18
- \fICONTEXT\[ru]FILES\fP
19
- This is an optional argument\. One or more files can be added to the prompt as context for the backend gen\-AI tool to process\.
20
- .TP
21
- \fIEXTERNAL\[ru]OPTIONS\fP
22
- External options are optional\. Anything that follow \[lq] \-\- \[lq] will be sent to the backend gen\-AI tool\. For example \[lq]\-\- \-C \-m gpt4\-128k\[rq] will send the options \[lq]\-C \-m gpt4\-128k\[rq] to the backend gen\-AI tool\. \fBaia\fR will not validate these external options before sending them to the backend gen\-AI tool\.
23
- .SH OPTIONS
24
- .TP
25
- \fB\-\-chat\fR
26
- begin a chat session with the backend after the initial prompt response; will set \-\-no\-out\[ru]file so that the backend response comes to STDOUT\. After the initial prompt is processed, you will be asked to provide a follow up\. Just enter whatever is appropriate terminating your input with a RETURN\. The backend will provide a response to you follow up and ask you again if you have another follow up\. This back and forth chatting will continue until you enter a RETURN without any other content \- an empty follow up prompt\. You may also enter a directive to be processed after which another follow up is requested\. If you have the \fB\-\-shell\fR and\[sl]or the \fB\-\-erb\fR options set you may use those tools within your follow up to provide dynamic content\.
27
- .TP
28
- \fB\-\-completion\fR \fISHELL\[ru]NAME\fP
29
- .TP
30
- \fB\-\-dump\fR \fIPATH\[sl]TO\[sl]FILE\.ext\fP
31
- Dump the current configuration to a file in the format denoted by the file\[cq]s extension\. Currently only \.yml, \.yaml and \.toml are acceptable file extensions\. \fIIf the file exists, it will be over\-written without warning\.\fP
32
- .TP
33
- \fB\-e\fR, \fB\-\-edit\fR
34
- Invokes an editor on the prompt file\. You can make changes to the prompt file, save it and the newly saved prompt will be processed by the backend\.
35
- .TP
36
- \fB\-\-shell\fR
37
- This option tells \fBaia\fR to replace references to system environment variables in the prompt with the value of the envar\. envars are like \[Do]HOME and \[Do]\[lC]HOME\[rC] in this example their occurance will be replaced by the value of ENV\[lB]\[oq]HOME\[cq]\[rB]\. Also the dynamic shell command in the pattern \[Do](shell command) will be executed and its output replaces its pattern\. It does not matter if your shell uses different patters than BASH since the replacement is being done within a Ruby context\.
38
- .TP
39
- \fB\-\-erb\fR
40
- If dynamic prompt content using \[Do](\.\.\.) wasn\[cq]t enough here is ERB\. Embedded RUby\. <%\[eq] ruby code %> within a prompt will have its ruby code executed and the results of that execution will be inserted into the prompt\. I\[cq]m sure we will find a way to truly misuse this capability\. Remember, some say that the simple prompt is the best prompt\.
41
- .TP
42
- \fB\-\-iq\fR, \fB\-\-image\[ru]quality\fR \fIVALUE\fP
43
- (Used with backend \[oq]client\[cq] only) See the OpenAI docs for valid values (depends on model) \- default: \[oq]\[cq]
44
- .TP
45
- \fB\-\-is\fR, \fB\-\-image\[ru]size\fR \fIVALUE\fP
46
- (Used with backend \[oq]client\[cq] only) See the OpenAI docs for valid values (depends on model) \- default: \[oq]\[cq]
47
- .TP
48
- \fB\-\-model\fR \fINAME\fP
49
- Name of the LLM model to use \- default is gpt\-4\-1106\-preview
50
- .TP
51
- \fB\-\-render\fR
52
- Render markdown to the terminal using the external tool \[lq]glow\[rq] \- default: false
53
- .TP
54
- \fB\-\-speak\fR
55
- Simple implementation\. Uses the \[lq]say\[rq] command to speak the response\. Fun with \-\-chat
56
- .TP
57
- \fB\-\-sm\fR, \fB\-\-speech\[ru]model\fR \fIMODEL NAME\fP
58
- Which OpenAI LLM to use for text\-to\-speech (TTS) \- default: tts\-1
59
- .TP
60
- \fB\-\-voice\fR \fIVOICE NAME\fP
61
- Which voice to use when speaking text\. If its \[lq]siri\[rq] and the platform is a Mac, then the CLI utility \[lq]say\[rq] is used\. Any other name will be used with OpenAI \- default: alloy
62
- .TP
63
- \fB\-\-terse\fR
64
- Add a clause to the prompt text that instructs the backend to be terse in its response\.
65
- .TP
66
- \fB\-\-tm\fR, \fB\-\-transcription\[ru]model\fR \fIMODEL NAME\fP
67
- Which OpenAI LLM to use for audio\-to\-text \- default: whisper\-1
68
- .TP
69
- \fB\-\-version\fR
70
- Print Version \- default is false
71
- .TP
72
- \fB\-b\fR, \fB\-\-\[lB]no\[rB]\-backend\fR \fILLM TOOL\fP
73
- Specify the backend prompt resolver \- default is mods
74
- .TP
75
- \fB\-c\fR, \fB\-\-config\[ru]file\fR \fIPATH\[ru]TO\[ru]CONFIG\[ru]FILE\fP
76
- Load Config File\. both YAML and TOML formats are supported\. Also ERB is supported\. For example \[ti]\[sl]aia\[ru]config\.yml\.erb will be processed through ERB and then through YAML\. The result will be written out to \[ti]\[sl]aia\[ru]config\.yml so that you can manually verify that you got what you wanted from the ERB processing\.
77
- .TP
78
- \fB\-d\fR, \fB\-\-debug\fR
79
- Turn On Debugging \- default is false
80
- .TP
81
- \fB\-e\fR, \fB\-\-edit\fR
82
- Edit the Prompt File \- default is false
83
- .TP
84
- \fB\-f\fR, \-\-fuzzy\`
85
- Use Fuzzy Matching when searching for a prompt \- default is false
86
- .TP
87
- \fB\-h\fR, \fB\-\-help\fR
88
- Show Usage \- default is false
89
- .TP
90
- \fB\-l\fR, \fB\-\-\[lB]no\[rB]\-log\[ru]file\fR \fIPATH\[ru]TO\[ru]LOG\[ru]FILE\fP
91
- Log FILEPATH \- default is \[Do]HOME\[sl]\.prompts\[sl]prompts\.log
92
- .TP
93
- \fB\-m\fR, \fB\-\-\[lB]no\[rB]\-markdown\fR
94
- Format with Markdown \- default is true
95
- .TP
96
- \fB\-n\fR, \fB\-\-next PROMPT\[ru]ID\fR
97
- 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
98
- .TP
99
- \fB\-o\fR, \fB\-\-\[lB]no\[rB]\-out\[ru]file\fR \fIPATH\[ru]TO\[ru]OUTPUT\[ru]FILE\fP
100
- Out FILENAME \- default is \.\[sl]temp\.md
101
- .TP
102
- \fB\-\-pipeline PID1,PID2,PID3\fR
103
- 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
104
- .TP
105
- \fB\-p\fR, \fB\-\-prompts\[ru]dir\fR \fIPATH\[ru]TO\[ru]DIRECTORY\fP
106
- Directory containing the prompt files \- default is \[ti]\[sl]\.prompts
107
- .TP
108
- \fB\-\-roles\[ru]dir\fR \fIPATH\[ru]TO\[ru]DIRECTORY\fP
109
- Directory containing the personification prompt files \- default is \[ti]\[sl]\.prompts\[sl]roles
110
- .TP
111
- \fB\-r\fR, \fB\-\-role\fR \fIROLE\[ru]ID\fP
112
- A role ID is the same as a prompt ID\. A \[lq]role\[rq] is a specialized prompt that gets pre\-pended to another prompt\. It\[cq]s purpose is to configure the LLM into a certain orientation within which to resolve its primary prompt\.
113
- .TP
114
- \fB\-v\fR, \fB\-\-verbose\fR
115
- Be Verbose \- default is false
116
- .TP
117
- \fB\-\-voice\fR
118
- The voice to use when the option \fB\-\-speak\fR is used\. If you are on a Mac, then setting voice to \[lq]siri\[rq] will use your Mac\[cq]s default siri voice and not access OpenAI \- default is \[lq]alloy\[rq] from OpenAI
119
- .TP
120
- \fB\-\-sm\fR, \fB\-\-speech\[ru]model\fR
121
- The OpenAI speech model to use when converting text into speech \- default is \[lq]tts\-1\[rq]
122
- .SH CONFIGURATION HIERARCHY
123
- .PP
124
- System Environment Variables (envars) that are all uppercase and begin with \[lq]AIA\[ru]\[rq] can be used to over\-ride the default configuration settings\. For example setting \[lq]export AIA\[ru]PROMPTS\[ru]DIR\[eq]\[ti]\[sl]Documents\[sl]prompts\[rq] will over\-ride the default configuration; however, a config value provided by a command line options will over\-ride an envar setting\.
125
- .PP
126
- Configuration values found in a config file will over\-ride all other values set for a config item\.
127
- .PP
128
- \[rq]\[sl]\[sl]config\[rq] directives found inside a prompt file over\-rides that config item regardless of where the value was set\.
129
- .PP
130
- For example \[lq]\[sl]\[sl]config chat? \[eq] true\[rq] within a prompt will setup the chat back and forth chat session for that specific prompt regardless of the command line options or the envar AIA\[ru]CHAT settings
131
- .SH OpenAI ACCOUNT IS REQUIRED
132
- .PP
133
- Additionally, the program requires an OpenAI access key, which can be specified using one of the following environment variables:
134
- .RS
135
- .IP \(bu 2
136
- \fBOPENAI\[ru]ACCESS\[ru]TOKEN\fR
137
- .IP \(bu 2
138
- \fBOPENAI\[ru]API\[ru]KEY\fR
139
- .RE
140
- .PP
141
- Currently there is not specific standard for name of the OpenAI key\. Some programs use one name, while others use a different name\. Both of the envars listed above mean the same thing\. If you use more than one tool to access OpenAI resources, you may have to set several envars to the same key value\.
142
- .PP
143
- To acquire an OpenAI access key, first create an account on the OpenAI platform, where further documentation is available\.
144
- .SH USAGE NOTES
145
- .PP
146
- \fBaia\fR is designed for flexibility, allowing users to pass prompt ids and context files as arguments\. Some options change the behavior of the output, such as \fB\-\-out\[ru]file\fR for specifying a file or \fB\-\-no\-out\[ru]file\fR for disabling file output in favor of standard output (STDPIT)\.
147
- .PP
148
- The \fB\-\-completion\fR option displays a script that enables prompt ID auto\-completion for bash, zsh, or fish shells\. It\[cq]s crucial to integrate the script into the shell\[cq]s runtime to take effect\.
149
- .PP
150
- The \fB\-\-dump path\[sl]to\[sl]file\.ext\fR option will write the current configuration to a file in the format requested by the file\[cq]s extension\. The following extensions are supported: \.yml, \.yaml and \.toml
151
- .SH PROMPT DIRECTIVES
152
- .PP
153
- Within a prompt text file any line that begins with \[lq]\[sl]\[sl]\[rq] is considered a prompt directive\. There are numerious prompt directives available\. In the discussion above on the configuration you learned about the \[lq]\[sl]\[sl]config\[rq] directive\.
154
- .PP
155
- Detail discussion on individual prompt directives is TBD\. Most likely it will be handled in the github wiki
156
- .UR https:\[sl]\[sl]github\.com\[sl]MadBomber\[sl]aia
157
- .UE
158
- \.
159
- .PP
160
- Some directives are:
161
- .RS
162
- .IP \(bu 2
163
- \[sl]\[sl]config item value
164
- .IP \(bu 2
165
- \[sl]\[sl]include path\[ru]to\[ru]file
166
- .IP \(bu 2
167
- \[sl]\[sl]ruby ruby\[ru]code
168
- .IP \(bu 2
169
- \[sl]\[sl]shell shell\[ru]command
170
- .RE
171
- .SH Prompt Sequences
172
- .PP
173
- 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:
174
- .PP
175
- \fBaia one \-\-pipeline two,three,four\fR
176
- .PP
177
- 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\.
178
- .SS Prompt Sequences Inside of a Prompt File
179
- .PP
180
- 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
181
- .PP
182
- \fB\[sl]\[sl]config next two\fR
183
- .PP
184
- Then inside the prompt file \fBtwo\.txt\fR you could use this directive:
185
- .PP
186
- \fB\[sl]\[sl]config pipeline three,four\fR
187
- .PP
188
- or just
189
- .PP
190
- \fB\[sl]\[sl]config next three\fR
191
- .PP
192
- if you want to specify them one at a time\.
193
- .PP
194
- You can also use the shortcuts \fB\[sl]\[sl]next\fR and \fB\[sl]\[sl]pipeline\fR
195
- .PP
196
- .PP
197
- .RS 4
198
- .EX
199
- \[sl]\[sl]next two
200
- \[sl]\[sl]next three
201
- \[sl]\[sl]next four
202
- \[sl]\[sl]next five
203
- .EE
204
- .RE
205
- .PP
206
- Is the same thing as
207
- .PP
208
- .PP
209
- .RS 4
210
- .EX
211
- \[sl]\[sl]pipeline two,three,four
212
- \[sl]\[sl]next five
213
- .EE
214
- .RE
215
- .SH SEE ALSO
216
- .RS
217
- .IP \(bu 2
218
- OpenAI Platform Documentation
219
- .UR https:\[sl]\[sl]platform\.openai\.com\[sl]docs\[sl]overview
220
- .UE
221
- for more information on obtaining access tokens
222
- .UR https:\[sl]\[sl]platform\.openai\.com\[sl]account\[sl]api\-keys
223
- .UE
224
- and working with OpenAI models\.
225
- .IP \(bu 2
226
- llm
227
- .UR https:\[sl]\[sl]llm\.datasette\.io\[sl]
228
- .UE
229
- for more information on \fBllm\fR \- A CLI utility and Python library for interacting with Large Language Models, both via remote APIs and models that can be installed and run on your own machine\.
230
- .IP \(bu 2
231
- mods
232
- .UR https:\[sl]\[sl]github\.com\[sl]charmbracelet\[sl]mods
233
- .UE
234
- for more information on \fBmods\fR \- AI for the command line, built for pipelines\. LLM based AI is really good at interpreting the output of commands and returning the results in CLI friendly text formats like Markdown\. Mods is a simple tool that makes it super easy to use AI on the command line and in your pipelines\. Mods works with OpenAI
235
- .UR https:\[sl]\[sl]platform\.openai\.com\[sl]account\[sl]api\-keys
236
- .UE
237
- and LocalAI
238
- .UR https:\[sl]\[sl]github\.com\[sl]go\-skynet\[sl]LocalAI
239
- .UE
240
- .IP \(bu 2
241
- sgpt
242
- .UR https:\[sl]\[sl]github\.com\[sl]tbckr\[sl]sgpt
243
- .UE
244
- (aka shell\-gpt) is a powerful command\-line interface (CLI) tool designed for seamless interaction with OpenAI models directly from your terminal\. Effortlessly run queries, generate shell commands or code, create images from text, and more, using simple commands\. Streamline your workflow and enhance productivity with this powerful and user\-friendly CLI tool\.
245
- .IP \(bu 2
246
- fzf
247
- .UR https:\[sl]\[sl]github\.com\[sl]junegunn\[sl]fzf
248
- .UE
249
- fzf is a general\-purpose command\-line fuzzy finder\. It\[cq]s an interactive Unix filter for command\-line that can be used with any list; files, command history, processes, hostnames, bookmarks, git commits, etc\.
250
- .IP \(bu 2
251
- ripgrep
252
- .UR https:\[sl]\[sl]github\.com\[sl]BurntSushi\[sl]ripgrep
253
- .UE
254
- Search tool like grep and The Silver Searcher\. It is a line\-oriented search tool that recursively searches a directory tree for a regex pattern\. By default, ripgrep will respect gitignore rules and automatically skip hidden files\[sl]directories and binary files\. (To disable all automatic filtering by default, use rg \-uuu\.) ripgrep has first class support on Windows, macOS and Linux, with binary downloads available for every release\.
255
- .IP \(bu 2
256
- glow
257
- .UR https:\[sl]\[sl]github\.com\[sl]charmbracelet\[sl]glow
258
- .UE
259
- Render markdown on the CLI
260
- .RE
261
- .SH Image Generation
262
- .PP
263
- The \-\-backend \[lq]client\[rq] is the only back end that supports image generation using the \fBdall\-e\-2\fR and \fBdall\-e\-3\fR models through OpenAI\. The result of your prompt will be a URL that points to the OpenAI storage space where your image is placed\.
264
- .PP
265
- Use \-\-image\[ru]size and \-\-image\[ru]quality to specified the desired size and quality of the generated image\. The valid values are available at the OpenAI website\.
266
- .PP
267
- https:\[sl]\[sl]platform\.openai\.com\[sl]docs\[sl]guides\[sl]images\[sl]usage?context\[eq]node
268
- .SH AUTHOR
269
- .PP
270
- Dewayne VanHoozer
271
- .MT dvanhoozer\[at]gmail\.com
272
- .ME