openai-term 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/openai +9 -9
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7807f8bc3c8150a78ad1bd08c3995c63f5767c7c403332184eb53657e234395c
|
4
|
+
data.tar.gz: 9a410c45e8f255e723bc7ed9022eb019d612f0caf4faf6eeafc4b8a8df696e93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 511193fd306c068eced18f852b27fff11b7b92507074f8d28857bdaa86f5183e68170c3a61e1fe8fafc1daa9a64ba3c0ac961aa35619f8475314f92231f2fe01
|
7
|
+
data.tar.gz: bb7be835e14c8dc9084b82edc58b72b48ca19442be7d85182cc3be2c0d26a3538e6fa9277b02ad005d796bfb94e78696b504cd2aa6b06f9b76224762c0218e36
|
data/bin/openai
CHANGED
@@ -44,13 +44,12 @@ else
|
|
44
44
|
end
|
45
45
|
|
46
46
|
# PROCESS QUERY
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
exit
|
47
|
+
@q = ""
|
48
|
+
@q += @t if @t
|
49
|
+
@q += File.read(@f) if @f
|
50
|
+
unless @f or @t
|
51
|
+
puts "You must supply a query in form of a text file (option -f file) and/or text (option -t text)\n\n"
|
52
|
+
exit
|
54
53
|
end
|
55
54
|
|
56
55
|
# REQUEST AND PRINT RESPONSE
|
@@ -65,8 +64,9 @@ begin
|
|
65
64
|
response = client.completions( parameters: { model: @m, prompt: @q, max_tokens: @x })
|
66
65
|
begin
|
67
66
|
output = response["choices"][0]["text"]
|
68
|
-
rescue
|
69
|
-
|
67
|
+
rescue => error
|
68
|
+
p error
|
69
|
+
output = response["error"]["message"]
|
70
70
|
end
|
71
71
|
puts output.strip + "\n\n"
|
72
72
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openai-term
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geir Isene
|
@@ -41,9 +41,8 @@ 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
|
-
|
46
|
-
-t or the -f option).'
|
44
|
+
the -f option to read the query from a text file instead. New in 1.1.1: Better
|
45
|
+
error handling.'
|
47
46
|
email: g@isene.com
|
48
47
|
executables:
|
49
48
|
- openai
|