aia 0.5.13 → 0.5.14
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.
- checksums.yaml +4 -4
- data/.semver +1 -1
- data/CHANGELOG.md +5 -0
- data/README.md +10 -7
- data/lib/aia/cli.rb +2 -0
- data/lib/aia/main.rb +3 -14
- data/lib/aia.rb +50 -3
- data/man/aia.1 +7 -1
- data/man/aia.1.md +6 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a4bc8019b9ad41da7d884ad4d86b3489afd2487b8ce7be78dd10ca8e963f454
|
4
|
+
data.tar.gz: d374c91f50ea29bb1dd0d9fab5c924ab7741676c45cf75de6999f3f965c1d8a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a2a194377c2b871a13e951a423bd1cede4b06be631ba0a3986cd8b3bddb80bb3cdd0c831207df08da7cabbdcb697d290bef6c083c54054d550c942909dbdd16
|
7
|
+
data.tar.gz: 79921b2f9899a2a86a86a18ae4cf2d9fe988a94e2bb70ae4dcd1998c3f721661b9a4587f4585219666b2d942d6ef500015fe9f4cfd60cae3982cb143b62bc366
|
data/.semver
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.5.14] 2024-03-09
|
4
|
+
- Directly access OpenAI to do text to speech when using the `--speak` option
|
5
|
+
- Added --voice to specify which voice to use
|
6
|
+
- Added --speech_model to specify which TTS model to use
|
7
|
+
|
3
8
|
## [0.5.13] 2024-03-03
|
4
9
|
- Added CLI-utility `llm` as a backend processor
|
5
10
|
|
data/README.md
CHANGED
@@ -6,15 +6,15 @@ 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.14
|
10
|
+
> - Directly access OpenAI to do text to speech when using the `--speak` option
|
11
|
+
> - Added --voice to specify which voice to use
|
12
|
+
> - Added --speech_model to specify which TTS model to use
|
13
|
+
>
|
9
14
|
> v0.5.13
|
10
15
|
> - Added an initial integration for CLI-tool `llm` as a backend processor
|
11
16
|
> Its primary feature is its **ability to use local LLMs and APIs to keep all processing within your local workstation.**
|
12
17
|
>
|
13
|
-
> v0.5.12
|
14
|
-
> - Supports Prompt Sequencing
|
15
|
-
> - Added --next option
|
16
|
-
> - Added --pipeline option
|
17
|
-
|
18
18
|
|
19
19
|
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
20
20
|
|
@@ -106,9 +106,12 @@ The `aia` configuration defaults can be over-ridden by system environment variab
|
|
106
106
|
| log_file | ~/.prompts/_prompts.log | AIA_LOG_FILE |
|
107
107
|
| markdown | true | AIA_MARKDOWN |
|
108
108
|
| model | gpt-4-1106-preview | AIA_MODEL |
|
109
|
-
| out_file
|
109
|
+
| out_file | STDOUT | AIA_OUT_FILE |
|
110
110
|
| prompts_dir | ~/.prompts | AIA_PROMPTS_DIR |
|
111
|
-
|
|
111
|
+
| speech_model. | tts-1 | AIA_SPEECH_MODEL |
|
112
|
+
| verbose | FALSE | AIA_VERBOSE |
|
113
|
+
| voice | alloy | AIA_VOICE |
|
114
|
+
|
112
115
|
|
113
116
|
|
114
117
|
See the `@options` hash in the `cli.rb` file for a complete list. There are some config items that do not necessarily make sense for use as an envar over-ride. For example if you set `export AIA_DUMP_FILE=config.yaml` then `aia` would dump the current configuration config.yaml and exit every time it is ran until you finally `unset AIA_DUMP_FILE`
|
data/lib/aia/cli.rb
CHANGED
@@ -155,6 +155,8 @@ class AIA::Cli
|
|
155
155
|
extra: [''], #
|
156
156
|
#
|
157
157
|
model: ["gpt-4-1106-preview", "--llm --model"],
|
158
|
+
speech_model: ["tts-1", "--sm --spech_model"],
|
159
|
+
voice: ["alloy", "--voice"],
|
158
160
|
#
|
159
161
|
dump_file: [nil, "--dump"],
|
160
162
|
completion: [nil, "--completion"],
|
data/lib/aia/main.rb
CHANGED
@@ -53,17 +53,6 @@ class AIA::Main
|
|
53
53
|
end
|
54
54
|
|
55
55
|
|
56
|
-
def speak(what)
|
57
|
-
return false unless AIA.config.speak?
|
58
|
-
# TODO: Consider putting this into a thread
|
59
|
-
# so that it can speak at the same time
|
60
|
-
# the output is going to the screen
|
61
|
-
# MacOS uses the say command
|
62
|
-
system "say #{Shellwords.escape(what)}"
|
63
|
-
true
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
56
|
# Function to setup the Reline history with a maximum depth
|
68
57
|
def setup_reline_history(max_history_size=5)
|
69
58
|
Reline::HISTORY.clear
|
@@ -123,7 +112,7 @@ class AIA::Main
|
|
123
112
|
|
124
113
|
if AIA.config.chat?
|
125
114
|
setup_reline_history
|
126
|
-
speak result
|
115
|
+
AIA.speak result
|
127
116
|
lets_chat
|
128
117
|
end
|
129
118
|
|
@@ -227,14 +216,14 @@ class AIA::Main
|
|
227
216
|
result = get_and_display_result(the_prompt_text)
|
228
217
|
|
229
218
|
log_the_follow_up(the_prompt_text, result)
|
230
|
-
speak result
|
219
|
+
AIA.speak result
|
231
220
|
end
|
232
221
|
else
|
233
222
|
the_prompt_text = insert_terse_phrase(the_prompt_text)
|
234
223
|
result = get_and_display_result(the_prompt_text)
|
235
224
|
|
236
225
|
log_the_follow_up(the_prompt_text, result)
|
237
|
-
speak result
|
226
|
+
AIA.speak result
|
238
227
|
end
|
239
228
|
|
240
229
|
the_prompt_text = ask_question_with_reline("\nFollow Up: ")
|
data/lib/aia.rb
CHANGED
@@ -20,11 +20,12 @@ tramp_require('debug_me') {
|
|
20
20
|
}
|
21
21
|
|
22
22
|
require 'hashie'
|
23
|
+
require 'openai'
|
23
24
|
require 'os'
|
24
25
|
require 'pathname'
|
25
26
|
require 'reline'
|
26
27
|
require 'shellwords'
|
27
|
-
require 'tempfile'
|
28
|
+
require 'tempfile'
|
28
29
|
|
29
30
|
require 'tty-spinner'
|
30
31
|
|
@@ -45,8 +46,15 @@ require_relative "core_ext/string_wrap"
|
|
45
46
|
module AIA
|
46
47
|
class << self
|
47
48
|
attr_accessor :config
|
49
|
+
attr_accessor :client
|
48
50
|
|
49
51
|
def run(args=ARGV)
|
52
|
+
begin
|
53
|
+
@client = OpenAI::Client.new(access_token: ENV["OPENAI_API_KEY"])
|
54
|
+
rescue OpenAI::ConfigurationError
|
55
|
+
@client = nil
|
56
|
+
end
|
57
|
+
|
50
58
|
args = args.split(' ') if args.is_a?(String)
|
51
59
|
|
52
60
|
# TODO: Currently this is a one and done architecture.
|
@@ -59,8 +67,47 @@ module AIA
|
|
59
67
|
|
60
68
|
|
61
69
|
def speak(what)
|
62
|
-
return unless
|
63
|
-
|
70
|
+
return unless config.speak?
|
71
|
+
|
72
|
+
if OS.osx? && 'siri' == config.voice.downcase
|
73
|
+
system "say #{Shellwords.escape(what)}"
|
74
|
+
else
|
75
|
+
use_openai_tts(what)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
def use_openai_tts(what)
|
81
|
+
if client.nil?
|
82
|
+
puts "\nWARNING: OpenAI's text to speech capability is not available at this time."
|
83
|
+
return
|
84
|
+
end
|
85
|
+
|
86
|
+
player = if OS.osx?
|
87
|
+
'afplay'
|
88
|
+
elsif OS.linux?
|
89
|
+
'mpg123'
|
90
|
+
elsif OS.windows?
|
91
|
+
'cmdmp3'
|
92
|
+
else
|
93
|
+
puts "\nWARNING: There is no MP3 player available"
|
94
|
+
return
|
95
|
+
end
|
96
|
+
|
97
|
+
response = client.audio.speech(
|
98
|
+
parameters: {
|
99
|
+
model: config.speech_model,
|
100
|
+
input: what,
|
101
|
+
voice: config.voice
|
102
|
+
}
|
103
|
+
)
|
104
|
+
|
105
|
+
Tempfile.create(['speech', '.mp3']) do |f|
|
106
|
+
f.binmode
|
107
|
+
f.write(response)
|
108
|
+
f.close
|
109
|
+
`#{player} #{f.path}`
|
110
|
+
end
|
64
111
|
end
|
65
112
|
end
|
66
113
|
end
|
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.14" AIA "User Manuals"
|
4
4
|
.SH NAME
|
5
5
|
.PP
|
6
6
|
aia \- command\-line interface for an AI assistant
|
@@ -98,6 +98,12 @@ A role ID is the same as a prompt ID\. A \[lq]role\[rq] is a specialized prompt
|
|
98
98
|
.TP
|
99
99
|
\fB\-v\fR, \fB\-\-verbose\fR
|
100
100
|
Be Verbose \- default is false
|
101
|
+
.TP
|
102
|
+
\fB\-\-voice\fR
|
103
|
+
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
|
104
|
+
.TP
|
105
|
+
\fB\-\-sm\fR, \fB\-\-speech\[ru]model\fR
|
106
|
+
The OpenAI speech model to use when converting text into speech \- default is \[lq]tts\-1\[rq]
|
101
107
|
.SH CONFIGURATION HIERARCHY
|
102
108
|
.PP
|
103
109
|
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\.
|
data/man/aia.1.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# aia 1 "v0.5.
|
1
|
+
# aia 1 "v0.5.14" AIA "User Manuals"
|
2
2
|
|
3
3
|
## NAME
|
4
4
|
|
@@ -103,6 +103,11 @@ The aia command-line tool is an interface for interacting with an AI model backe
|
|
103
103
|
`-v`, `--verbose`
|
104
104
|
: Be Verbose - default is false
|
105
105
|
|
106
|
+
`--voice`
|
107
|
+
: The voice to use when the option `--speak` is used. If you are on a Mac, then setting voice to "siri" will use your Mac's default siri voice and not access OpenAI - default is "alloy" from OpenAI
|
108
|
+
|
109
|
+
`--sm`, `--speech_model`
|
110
|
+
: The OpenAI speech model to use when converting text into speech - default is "tts-1"
|
106
111
|
|
107
112
|
## CONFIGURATION HIERARCHY
|
108
113
|
|
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.14
|
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-03-
|
11
|
+
date: 2024-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: ruby-openai
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: semver2
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|