aia 0.5.17 → 0.5.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.version +1 -2
- data/CHANGELOG.md +29 -24
- data/README.md +6 -15
- data/justfile +16 -3
- data/lib/aia/tools/ai_client_backend.rb +92 -0
- data/man/aia.1 +1 -1
- data/man/aia.1.md +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 299a84f02f8f0fd0d2d26e8dd0c371e22bf7b19330c858273731eae0a017b965
|
4
|
+
data.tar.gz: 64a39d4045392d1e207e6e21714925cb9cf28c68dba92df8b516efff7525b57f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d687ba13fa6a323046fd592efa9697502ba2ababe06623814ada87a5df430809bb9e54cd7da5d82c24b49d09641e59d8c77f0ed70fd4d3ae63878d2beaacc283
|
7
|
+
data.tar.gz: 2c5e3d861ec585231206a2e92a973100f1228f4eddbc5066782e0ace4a6bb76de2dd5530df9e29d87e9dd3b5aa82c03fb5002c83fda6c2b1272918d9ed3a04c4
|
data/.version
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
0.5.
|
2
|
-
|
1
|
+
0.5.18
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
-
##
|
1
|
+
## Unreleased
|
2
2
|
|
3
|
-
|
3
|
+
### [0.5.18] 2024-10-26
|
4
|
+
- updated dependencies; using prompt_manager v0.4.2
|
5
|
+
|
6
|
+
## Released
|
7
|
+
|
8
|
+
### [0.5.17] 2024-05-17
|
4
9
|
- removed replaced `semver` with `versionaire`
|
5
10
|
|
6
|
-
|
11
|
+
### [0.5.16] 2024-04-02
|
7
12
|
- fixed prompt pipelines
|
8
13
|
- added //next and //pipeline directives as shortcuts to //config [next,pipeline]
|
9
14
|
- Added new backend "client" as an internal OpenAI client
|
@@ -13,82 +18,82 @@
|
|
13
18
|
- Added --image_size and --image_quality (--is --iq)
|
14
19
|
|
15
20
|
|
16
|
-
|
21
|
+
### [0.5.15] 2024-03-30
|
17
22
|
- Added the ability to accept piped in text to be appeded to the end of the prompt text: curl $URL | aia ad_hoc
|
18
23
|
- Fixed bugs with entering directives as follow-up prompts during a chat session
|
19
24
|
|
20
|
-
|
25
|
+
### [0.5.14] 2024-03-09
|
21
26
|
- Directly access OpenAI to do text to speech when using the `--speak` option
|
22
27
|
- Added --voice to specify which voice to use
|
23
28
|
- Added --speech_model to specify which TTS model to use
|
24
29
|
|
25
|
-
|
30
|
+
### [0.5.13] 2024-03-03
|
26
31
|
- Added CLI-utility `llm` as a backend processor
|
27
32
|
|
28
|
-
|
33
|
+
### [0.5.12] 2024-02-24
|
29
34
|
- Happy Birthday Ruby!
|
30
35
|
- Added --next CLI option
|
31
36
|
- Added --pipeline CLI option
|
32
37
|
|
33
|
-
|
38
|
+
### [0.5.11] 2024-02-18
|
34
39
|
- allow directives to return information that is inserted into the prompt text
|
35
40
|
- added //shell command directive
|
36
41
|
- added //ruby ruby_code directive
|
37
42
|
- added //include path_to_file directive
|
38
43
|
|
39
|
-
|
44
|
+
### [0.5.10] 2024-02-03
|
40
45
|
- Added --roles_dir to isolate roles from other prompts if desired
|
41
46
|
- Changed --prompts to --prompts_dir to be consistent
|
42
47
|
- Refactored common fzf usage into its own tool class
|
43
48
|
|
44
|
-
|
49
|
+
### [0.5.9] 2024-02-01
|
45
50
|
- Added a "I'm working" spinner thing when "--verbose" is used as an indication that the backend is in the process of composing its response to the prompt.
|
46
51
|
|
47
|
-
|
52
|
+
### [0.5.8] 2024-01-17
|
48
53
|
- Changed the behavior of the --dump option. It must now be followed by path/to/file.ext where ext is a supported config file format: yml, yaml, toml
|
49
54
|
|
50
|
-
|
55
|
+
### [0.5.7] 2024-01-15
|
51
56
|
- Added ERB processing to the config_file
|
52
57
|
|
53
|
-
|
58
|
+
### [0.5.6] 2024-01-15
|
54
59
|
- Adding processing for directives, shell integration and erb to the follow up prompt in a chat session
|
55
60
|
- some code refactoring.
|
56
61
|
|
57
|
-
|
62
|
+
### [0.5.3] 2024-01-14
|
58
63
|
- adding ability to render markdown to the terminal using the "glow" CLI utility
|
59
64
|
|
60
|
-
|
65
|
+
### [0.5.2] 2024-01-13
|
61
66
|
- wrap response when its going to the terminal
|
62
67
|
|
63
|
-
|
68
|
+
### [0.5.1] 2024-01-12
|
64
69
|
- removed a wicked puts "loaded" statement
|
65
70
|
- fixed missed code when the options were changed to --out_file and --log_file
|
66
71
|
- fixed completion functions by updating $PROMPT_DIR to $AIA_PROMPTS_DIR to match the documentation.
|
67
72
|
|
68
|
-
|
73
|
+
### [0.5.0] 2024-01-05
|
69
74
|
- breaking changes:
|
70
75
|
- changed `--config` to `--config_file`
|
71
76
|
- changed `--env` to `--shell`
|
72
77
|
- changed `--output` to `--out_file`
|
73
78
|
- changed default `out_file` to `STDOUT`
|
74
79
|
|
75
|
-
|
80
|
+
### [0.4.3] 2023-12-31
|
76
81
|
- added --env to process embedded system environment variables and shell commands within a prompt.
|
77
82
|
- added --erb to process Embedded RuBy within a prompt because have embedded shell commands will only get you in a trouble. Having ERB will really get you into trouble. Remember the simple prompt is usually the best prompt.
|
78
83
|
|
79
|
-
|
84
|
+
### [0.4.2] 2023-12-31
|
80
85
|
- added the --role CLI option to pre-pend a "role" prompt to the front of a primary prompt.
|
81
86
|
|
82
|
-
|
87
|
+
### [0.4.1] 2023-12-31
|
83
88
|
- added a chat mode
|
84
89
|
- prompt directives now supported
|
85
90
|
- version bumped to match the `prompt_manager` gem
|
86
91
|
|
87
|
-
|
92
|
+
### [0.3.20] 2023-12-28
|
88
93
|
- added work around to issue with multiple context files going to the `mods` backend
|
89
94
|
- added shellwords gem to santize prompt text on the command line
|
90
95
|
|
91
|
-
|
96
|
+
### [0.3.19] 2023-12-26
|
92
97
|
- major code refactoring.
|
93
98
|
- supports config files \*.yml, \*.yaml and \*.toml
|
94
99
|
- usage implemented as a man page. --help will display the man page/
|
@@ -101,10 +106,10 @@
|
|
101
106
|
3. envar values over-rides ...
|
102
107
|
4. default values
|
103
108
|
|
104
|
-
|
109
|
+
### [0.3.0] = 2023-11-23
|
105
110
|
|
106
111
|
- Matching version to [prompt_manager](https://github.com/prompt_manager) This version allows for the user of history in the entery of values to prompt keywords. KW_HISTORY_MAX is set at 5. Changed CLI enteraction to use historical selection and editing of prior keyword values.
|
107
112
|
|
108
|
-
|
113
|
+
### [0.1.0] - 2023-11-23
|
109
114
|
|
110
115
|
- Initial release
|
data/README.md
CHANGED
@@ -1,19 +1,12 @@
|
|
1
1
|
# AI Assistant (AIA)
|
2
2
|
|
3
|
-
`aia` is a command-line utility that facilitates interaction with AI models. It automates the management of pre-compositional prompts and executes generative AI (Gen-AI) commands on those prompts.
|
3
|
+
`aia` is a command-line utility that facilitates interaction with AI models. It automates the management of pre-compositional prompts and executes generative AI (Gen-AI) commands on those prompts taking advantage of modern LLMs increased context window size.
|
4
4
|
|
5
5
|
It leverages the `prompt_manager` gem to manage prompts for the `mods` and `sgpt` CLI utilities. It utilizes "ripgrep" for searching for prompt files. It uses `fzf` for prompt selection based on a search term and fuzzy matching.
|
6
6
|
|
7
7
|
**Most Recent Change**: Refer to the [Changelog](CHANGELOG.md)
|
8
8
|
|
9
|
-
>
|
10
|
-
> - replaced gem semver with versionaire
|
11
|
-
>
|
12
|
-
> v0.5.16
|
13
|
-
> - fixed bugs with the prompt pipeline
|
14
|
-
> - Added new backend "client" which is an `aia` internal client to the OpenAI API that allows both text-to-speech and speech-to-text
|
15
|
-
> - Added --image_size and --image_quality to support image generation with the dall-e-2 and dall-e-3 models using the new internal `aia` OpenAI client.
|
16
|
-
>
|
9
|
+
> Just an FYI ... I am working in the `develop` branch to **drop the dependency on backend LLM processors like mods and llm.** I'm refactor aia to use my own universal client gem called ai_client which gives access to all models and all providers.
|
17
10
|
|
18
11
|
|
19
12
|
|
@@ -577,19 +570,17 @@ Here is what my `chat` prompt file looks like:
|
|
577
570
|
|
578
571
|
## Development
|
579
572
|
|
580
|
-
|
573
|
+
This CLI tool started life as a few lines of ruby in a file in my scripts repo. I just kep growing as I decided to add more capability and more backend tools. There was no real architecture to guide the design. What was left is a large code mess which is slowly being refactored into something more maintainable. That work is taking place in the `develop` branch. I welcome you help. Take a look at what is going on in that branch and send me a PR against it.
|
574
|
+
|
575
|
+
Of course if you see something in the main branch send me a PR against that one so that we can fix the problem for all.
|
581
576
|
|
582
577
|
## Contributing
|
583
578
|
|
584
579
|
Bug reports and pull requests are welcome on GitHub at https://github.com/MadBomber/aia.
|
585
580
|
|
586
|
-
I've designed `aia` so that it should be easy to integrate other backend LLM processors. If you've found one that you like, send me a pull request or a feature request.
|
587
|
-
|
588
581
|
When you find problems with `aia` please note them as an issue. This thing was written mostly by a human and you know how error prone humans are. There should be plenty of errors to find.
|
589
582
|
|
590
|
-
I'
|
591
|
-
|
592
|
-
Also I'm not happy with the way where I a some command line options for external command hard coded. I think they should be part of the configuration as well. For example the way I'm using `rg` and `fzf` may not be the way that you want to use them.
|
583
|
+
I'm not happy with the way where some command line options for external command are hard coded. I'm specific talking about the way in which the `rg` and `fzf` tools are used. There options decide the basic look and feel of the search capability on the command line. Maybe they should be part of the overall configuration so that users can tune their UI to the way they like.
|
593
584
|
|
594
585
|
## License
|
595
586
|
|
data/justfile
CHANGED
@@ -23,9 +23,10 @@ man_filepath := env_var('RR') + "/man/aia.1.md"
|
|
23
23
|
|
24
24
|
set fallback # search up for recipe name if not found locally.
|
25
25
|
|
26
|
-
set positional-arguments
|
27
|
-
set allow-duplicate-recipes
|
28
|
-
set
|
26
|
+
set positional-arguments := true
|
27
|
+
set allow-duplicate-recipes := true
|
28
|
+
set allow-duplicate-variables := true
|
29
|
+
set dotenv-load := false
|
29
30
|
|
30
31
|
# my common variables
|
31
32
|
|
@@ -80,6 +81,18 @@ mods_delete_all:
|
|
80
81
|
mods -l | awk '{print $1}' | xargs -I {} mods -d {}
|
81
82
|
|
82
83
|
|
84
|
+
#############################################
|
85
|
+
## iTerm2-related
|
86
|
+
|
87
|
+
# Fix half-duplex terminal
|
88
|
+
fix:
|
89
|
+
stty sane
|
90
|
+
|
91
|
+
|
92
|
+
# Clear the scroll-back buffer
|
93
|
+
@clear_buffer:
|
94
|
+
printf "\e[3J"
|
95
|
+
|
83
96
|
#################################################
|
84
97
|
## Private recipes
|
85
98
|
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# lib/aia/tools/ai_client_backend.rb
|
2
|
+
|
3
|
+
# This is WIP in the `develop` branch
|
4
|
+
# do not use.
|
5
|
+
|
6
|
+
require 'ai_client'
|
7
|
+
require_relative 'backend_common'
|
8
|
+
|
9
|
+
class AIA::AiClientBackend < AIA::Tools
|
10
|
+
include AIA::BackendCommon
|
11
|
+
|
12
|
+
meta(
|
13
|
+
name: 'ai_client',
|
14
|
+
role: :backend,
|
15
|
+
desc: 'AI Client integration for unified model access',
|
16
|
+
url: 'https://github.com/path/to/ai_client', # TODO: Update URL
|
17
|
+
install: 'gem install ai_client',
|
18
|
+
)
|
19
|
+
|
20
|
+
attr_reader :client, :raw_response
|
21
|
+
|
22
|
+
DEFAULT_PARAMETERS = ''
|
23
|
+
DIRECTIVES = %w[
|
24
|
+
model
|
25
|
+
temperature
|
26
|
+
max_tokens
|
27
|
+
top_p
|
28
|
+
frequency_penalty
|
29
|
+
presence_penalty
|
30
|
+
]
|
31
|
+
|
32
|
+
def initialize(text: "", files: [])
|
33
|
+
super
|
34
|
+
@client = AiClient.new
|
35
|
+
end
|
36
|
+
|
37
|
+
def build_command
|
38
|
+
# No-op - ai_client doesn't use command line
|
39
|
+
@parameters = ""
|
40
|
+
end
|
41
|
+
|
42
|
+
def run
|
43
|
+
handle_model(AIA.config.model)
|
44
|
+
rescue => e
|
45
|
+
puts "Error handling model #{AIA.config.model}: #{e.message}"
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def handle_model(model_name)
|
51
|
+
case model_name
|
52
|
+
when /vision/
|
53
|
+
image2text
|
54
|
+
when /^gpt/
|
55
|
+
text2text
|
56
|
+
when /^dall-e/
|
57
|
+
text2image
|
58
|
+
when /^tts/
|
59
|
+
text2audio
|
60
|
+
when /^whisper/
|
61
|
+
audio2text
|
62
|
+
else
|
63
|
+
raise "Unsupported model: #{model_name}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def text2text
|
68
|
+
response = client.complete(
|
69
|
+
prompt: text,
|
70
|
+
model: AIA.config.model,
|
71
|
+
temperature: AIA.config.temp
|
72
|
+
)
|
73
|
+
response.completion
|
74
|
+
end
|
75
|
+
|
76
|
+
# Placeholder methods to maintain API compatibility
|
77
|
+
def image2text
|
78
|
+
raise "Not yet implemented for ai_client"
|
79
|
+
end
|
80
|
+
|
81
|
+
def text2image
|
82
|
+
raise "Not yet implemented for ai_client"
|
83
|
+
end
|
84
|
+
|
85
|
+
def text2audio
|
86
|
+
raise "Not yet implemented for ai_client"
|
87
|
+
end
|
88
|
+
|
89
|
+
def audio2text
|
90
|
+
raise "Not yet implemented for ai_client"
|
91
|
+
end
|
92
|
+
end
|
data/man/aia.1
CHANGED
data/man/aia.1.md
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
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.18
|
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-
|
11
|
+
date: 2024-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ai_client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: hashie
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -277,6 +291,7 @@ files:
|
|
277
291
|
- lib/aia/main.rb
|
278
292
|
- lib/aia/prompt.rb
|
279
293
|
- lib/aia/tools.rb
|
294
|
+
- lib/aia/tools/ai_client_backend.rb
|
280
295
|
- lib/aia/tools/backend_common.rb
|
281
296
|
- lib/aia/tools/client.rb
|
282
297
|
- lib/aia/tools/editor.rb
|
@@ -317,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
317
332
|
- !ruby/object:Gem::Version
|
318
333
|
version: '0'
|
319
334
|
requirements: []
|
320
|
-
rubygems_version: 3.5.
|
335
|
+
rubygems_version: 3.5.22
|
321
336
|
signing_key:
|
322
337
|
specification_version: 4
|
323
338
|
summary: AI Assistant (aia) a command-line (CLI) utility
|