chatgpt2023 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/chatgpt2023.rb +20 -12
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4728e79c0d12f0dd5a5ce7a7970f507d6fd79471727fb205f7416b3326fe8985
|
4
|
+
data.tar.gz: 7ca136ca869d4908c9fa70827b4a2a549cff92633026c1c70e8843886c026b59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f403b18eec392d2b1958b1168536ad716f02ddcd7445a3c67fa46916193190ee920020a2902e63c00621135392f580a00e12948b6dfa56a40f5316dd42d591d2
|
7
|
+
data.tar.gz: bda567ca1b04f4e4350c475d62cc4576887c36d7762bae951dd918269f149419411eb76e309a6190ad5e34cea71db375dd55a2a0b6cddff86ab0495a74506faf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/chatgpt2023.rb
CHANGED
@@ -32,6 +32,9 @@ require 'down'
|
|
32
32
|
# chat.completion 'Say this is a test'
|
33
33
|
# #=> This is indeed a test
|
34
34
|
|
35
|
+
class ChatGpt2023Error < Exception
|
36
|
+
end
|
37
|
+
|
35
38
|
class ChatGpt2023
|
36
39
|
|
37
40
|
def initialize(apikey: nil, debug: false)
|
@@ -44,35 +47,40 @@ class ChatGpt2023
|
|
44
47
|
end
|
45
48
|
|
46
49
|
def completions(s, temperature: 0, max_tokens: 7)
|
47
|
-
|
48
|
-
|
50
|
+
|
51
|
+
r = go_completions(s, temperature: temperature, max_tokens: max_tokens)
|
52
|
+
raise ChatGpt2023Error, r[:error][:message].inspect if r.has_key? :error
|
53
|
+
|
54
|
+
puts 'completions r: ' + r.inspect if @debug
|
49
55
|
r[:choices]
|
56
|
+
|
50
57
|
end
|
51
58
|
|
52
|
-
def completion(s)
|
53
|
-
|
59
|
+
def completion(s, temperature: 0, max_tokens: 7)
|
60
|
+
go_completions(s, temperature: temperature, max_tokens: max_tokens)\
|
61
|
+
.first[:text].strip
|
54
62
|
end
|
55
63
|
|
56
64
|
alias complete completion
|
65
|
+
alias ask completion
|
57
66
|
|
58
67
|
def edits(s, s2)
|
59
|
-
r =
|
68
|
+
r = go_edits(s, s2)
|
60
69
|
end
|
61
70
|
|
62
71
|
def images(s)
|
63
|
-
|
72
|
+
go_images_generations(s)
|
64
73
|
end
|
65
74
|
|
66
75
|
def image(s)
|
67
|
-
r =
|
68
|
-
|
69
|
-
Down.download(img)
|
76
|
+
r = images(s)
|
77
|
+
Down.download(r[:data].first[:url] )
|
70
78
|
end
|
71
79
|
|
72
80
|
alias imagine image
|
73
81
|
|
74
82
|
def images_edit(s, image, mask: nil)
|
75
|
-
|
83
|
+
go_images_edits(s, image, mask: mask)
|
76
84
|
end
|
77
85
|
|
78
86
|
private
|
@@ -129,9 +137,9 @@ class ChatGpt2023
|
|
129
137
|
|
130
138
|
end
|
131
139
|
|
132
|
-
def submit(
|
140
|
+
def submit(uri2, h)
|
133
141
|
|
134
|
-
uri = URI.parse(@apiurl + '/' +
|
142
|
+
uri = URI.parse(@apiurl + '/' + uri2)
|
135
143
|
request = Net::HTTP::Post.new(uri)
|
136
144
|
request.content_type = "application/json"
|
137
145
|
request["Authorization"] = 'Bearer ' + @apikey
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chatgpt2023
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
6FQD1/GISew7VvxUJdptXeuVNIsdNKxvL3RpfLCuFsi1WXyJ4k3odRMTmS0kAfTy
|
37
37
|
J4sZZW9RNfabTMQQY7DIs3tUAn6i+O0r9lo=
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date: 2023-
|
39
|
+
date: 2023-02-07 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: down
|
metadata.gz.sig
CHANGED
Binary file
|