openai-term 1.2.1 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/openai +10 -10
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8d8a11333a11c485b026674918f685ec1b0f5e0e085ffe9b36789cab50205dd
|
4
|
+
data.tar.gz: 40d4fd48a98cd3134f7ba4ad19d8347246564aa6651fd2fb96202763d590e375
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b0a2e19261526b96af25f4015091a07091409325268b8816e2f2c8e95472b28cd318c84777dda8dca1009a8b2b96d309251320c8a2e0427ad21fc3749e2aa87
|
7
|
+
data.tar.gz: e23f349349b402873ffc421c610fdb489c7db531bb533ba277cfb8ae140b1ba3277fbf67de01111dd796b999c35934f015893a69777c322bd204a2690fee5f28
|
data/bin/openai
CHANGED
@@ -7,16 +7,10 @@ require 'tty-prompt'
|
|
7
7
|
require "ruby/openai"
|
8
8
|
|
9
9
|
# INITIALIZE CONSTANTS
|
10
|
-
@x =
|
11
|
-
@m = "
|
10
|
+
@x = 500
|
11
|
+
@m = "gpt-3.5-turbo-instruct"
|
12
12
|
@prompt = TTY::Prompt.new
|
13
13
|
|
14
|
-
def model
|
15
|
-
c = %w(text-davinci-003 code-cushman-001 text-curie-001 text-ada-001)
|
16
|
-
m = @prompt.select("What AI model do you want to use? (see https://beta.openai.com/docs/models/codex for details)", c, cycle: true)
|
17
|
-
return m
|
18
|
-
end
|
19
|
-
|
20
14
|
# HANDLE COMMAND LINE OPTIONS
|
21
15
|
options = {}
|
22
16
|
optparse = OptionParser.new do |opts|
|
@@ -27,7 +21,8 @@ optparse = OptionParser.new do |opts|
|
|
27
21
|
opts.on('-f', '--file textfile', 'A file to process') { |f| @f = f }
|
28
22
|
opts.on('-t', '--text text', 'The text to process') { |t| @t = t }
|
29
23
|
opts.on('-x', '--max max_tokens', 'Specify max number of words in response') { |x| @x = x.to_i }
|
30
|
-
opts.on('-m', '--model', 'The AI model to use (default =
|
24
|
+
opts.on('-m', '--model', 'The AI model to use (default = gpt-3.5-turbo-instruct)') { |m| @m = m }
|
25
|
+
opts.on('-M', '--listmodels', 'List available models, pick and use') { @m = "list" }
|
31
26
|
opts.on('-i', '--image', 'Create an image with the text supplied by -t or -f') { @i = true }
|
32
27
|
opts.on('-h', 'Display SHORT help text') { puts opts; exit }
|
33
28
|
opts.on('-v', '--version', 'Display the version number') { puts "Version: 0.1"; exit }
|
@@ -53,7 +48,12 @@ unless @f or @t
|
|
53
48
|
end
|
54
49
|
|
55
50
|
# REQUEST AND PRINT RESPONSE
|
56
|
-
client = OpenAI::Client.new(access_token: @ai)
|
51
|
+
client = OpenAI::Client.new(access_token: @ai, log_errors: true)
|
52
|
+
|
53
|
+
if @m == "list"
|
54
|
+
c = client.models.list["data"].map.each { |i| i["id"] }
|
55
|
+
@m = @prompt.select("What AI model do you want to use? (see https://beta.openai.com/docs/models/codex for details)", c, cycle: true)
|
56
|
+
end
|
57
57
|
|
58
58
|
begin
|
59
59
|
if @i
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openai-term
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geir Isene
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-openai
|
@@ -41,8 +41,9 @@ dependencies:
|
|
41
41
|
description: 'This is a pretty straight forward interface to OpenAI with the option
|
42
42
|
to select the AI model and the maximum token length (number of maximum words in
|
43
43
|
the AI''s response). You will use the -t option to supply the query to OpenAI or
|
44
|
-
the -f option to read the query from a text file instead. New in 1.
|
45
|
-
|
44
|
+
the -f option to read the query from a text file instead. New in 1.3: Updated default
|
45
|
+
model to gpt-3.5-turbo-instruct. 1.4: Added option -M to list available model and
|
46
|
+
use the one selected.'
|
46
47
|
email: g@isene.com
|
47
48
|
executables:
|
48
49
|
- openai
|
@@ -55,7 +56,7 @@ licenses:
|
|
55
56
|
- Unlicense
|
56
57
|
metadata:
|
57
58
|
source_code_uri: https://github.com/isene/openai
|
58
|
-
post_install_message:
|
59
|
+
post_install_message:
|
59
60
|
rdoc_options: []
|
60
61
|
require_paths:
|
61
62
|
- lib
|
@@ -70,8 +71,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
71
|
- !ruby/object:Gem::Version
|
71
72
|
version: '0'
|
72
73
|
requirements: []
|
73
|
-
rubygems_version: 3.
|
74
|
-
signing_key:
|
74
|
+
rubygems_version: 3.4.20
|
75
|
+
signing_key:
|
75
76
|
specification_version: 4
|
76
77
|
summary: openai is a terminal interface to the OpenAI solution at beta.openai.com
|
77
78
|
test_files: []
|