ruby-openai 3.0.3 → 3.2.0
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/CHANGELOG.md +17 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +12 -12
- data/README.md +11 -11
- data/lib/ruby/openai/files.rb +4 -0
- data/lib/ruby/openai/finetunes.rb +8 -0
- data/lib/ruby/openai/version.rb +1 -1
- data/ruby-openai.gemspec +1 -1
- metadata +3 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e8ff1d30efd244fc448e8f473834796b8b02b627a5a4fc4edfdb79062119cfd
|
4
|
+
data.tar.gz: dfd511d71c4a8d351e298cb6759bc876467840c70d073b0835259d18a4e4aa6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6df6919af3e66c044d7309f6f7272078a12a2532702ced4175365b9ca618b7f6cac88e8aa7d84ed9884fea053d032505b9b1a3be8f7a39cb47c056e2e7a87849
|
7
|
+
data.tar.gz: 529f048e9a35a7169f688cc49bb78a68b5787919c716dcb8c4017357db3124ed637314c931578b05aeedc76c72045c8f3144682c32f2a3879188270cbe7eae8d
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [3.2.0] - 2023-02-13
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Add Files#content endpoint - thanks [@unixneo](https://github.com/unixneo) for raising!
|
13
|
+
|
14
|
+
## [3.1.0] - 2023-02-13
|
15
|
+
|
16
|
+
### Added
|
17
|
+
|
18
|
+
- Add Finetunes#delete endpoint - thanks [@lancecarlson](https://github.com/lancecarlson) for flagging this.
|
19
|
+
- Add VCR header and body matching - thanks [@petergoldstein](https://github.com/petergoldstein)!
|
20
|
+
|
21
|
+
### Fixed
|
22
|
+
|
23
|
+
- Update File#upload specs to remove deprecated `answers` purpose.
|
24
|
+
|
8
25
|
## [3.0.3] - 2023-01-07
|
9
26
|
|
10
27
|
### Added
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ruby-openai (3.0
|
5
|
-
httparty (>= 0.18.1
|
4
|
+
ruby-openai (3.2.0)
|
5
|
+
httparty (>= 0.18.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -23,12 +23,12 @@ GEM
|
|
23
23
|
mini_mime (1.1.2)
|
24
24
|
multi_xml (0.6.0)
|
25
25
|
parallel (1.22.1)
|
26
|
-
parser (3.
|
26
|
+
parser (3.2.0.0)
|
27
27
|
ast (~> 2.4.1)
|
28
28
|
public_suffix (5.0.1)
|
29
29
|
rainbow (3.1.1)
|
30
30
|
rake (13.0.6)
|
31
|
-
regexp_parser (2.
|
31
|
+
regexp_parser (2.7.0)
|
32
32
|
rexml (3.2.5)
|
33
33
|
rspec (3.12.0)
|
34
34
|
rspec-core (~> 3.12.0)
|
@@ -36,27 +36,27 @@ GEM
|
|
36
36
|
rspec-mocks (~> 3.12.0)
|
37
37
|
rspec-core (3.12.0)
|
38
38
|
rspec-support (~> 3.12.0)
|
39
|
-
rspec-expectations (3.12.
|
39
|
+
rspec-expectations (3.12.2)
|
40
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
41
41
|
rspec-support (~> 3.12.0)
|
42
|
-
rspec-mocks (3.12.
|
42
|
+
rspec-mocks (3.12.3)
|
43
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
44
44
|
rspec-support (~> 3.12.0)
|
45
45
|
rspec-support (3.12.0)
|
46
|
-
rubocop (1.
|
46
|
+
rubocop (1.45.1)
|
47
47
|
json (~> 2.3)
|
48
48
|
parallel (~> 1.10)
|
49
|
-
parser (>= 3.
|
49
|
+
parser (>= 3.2.0.0)
|
50
50
|
rainbow (>= 2.2.2, < 4.0)
|
51
51
|
regexp_parser (>= 1.8, < 3.0)
|
52
52
|
rexml (>= 3.2.5, < 4.0)
|
53
53
|
rubocop-ast (>= 1.24.1, < 2.0)
|
54
54
|
ruby-progressbar (~> 1.7)
|
55
|
-
unicode-display_width (>=
|
55
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
56
56
|
rubocop-ast (1.24.1)
|
57
57
|
parser (>= 3.1.1.0)
|
58
58
|
ruby-progressbar (1.11.0)
|
59
|
-
unicode-display_width (2.
|
59
|
+
unicode-display_width (2.4.2)
|
60
60
|
vcr (6.1.0)
|
61
61
|
webmock (3.18.1)
|
62
62
|
addressable (>= 2.8.0)
|
@@ -71,10 +71,10 @@ DEPENDENCIES
|
|
71
71
|
dotenv (~> 2.8.1)
|
72
72
|
rake (~> 13.0)
|
73
73
|
rspec (~> 3.12)
|
74
|
-
rubocop (~> 1.
|
74
|
+
rubocop (~> 1.45.1)
|
75
75
|
ruby-openai!
|
76
76
|
vcr (~> 6.1.0)
|
77
77
|
webmock (~> 3.18.1)
|
78
78
|
|
79
79
|
BUNDLED WITH
|
80
|
-
2.
|
80
|
+
2.4.5
|
data/README.md
CHANGED
@@ -134,29 +134,23 @@ You can use the embeddings endpoint to get a vector of numbers representing an i
|
|
134
134
|
Put your data in a `.jsonl` file like this:
|
135
135
|
|
136
136
|
```json
|
137
|
-
{"
|
138
|
-
{"
|
137
|
+
{"prompt":"Overjoyed with my new phone! ->", "completion":" positive"}
|
138
|
+
{"prompt":"@lakers disappoint for a third straight night ->", "completion":" negative"}
|
139
139
|
```
|
140
140
|
|
141
141
|
and pass the path to `client.files.upload` to upload it to OpenAI, and then interact with it:
|
142
142
|
|
143
143
|
```ruby
|
144
|
-
client.files.upload(parameters: { file: "path/to/
|
144
|
+
client.files.upload(parameters: { file: "path/to/sentiment.jsonl", purpose: "fine-tune" })
|
145
145
|
client.files.list
|
146
146
|
client.files.retrieve(id: 123)
|
147
|
+
client.files.content(id: 123)
|
147
148
|
client.files.delete(id: 123)
|
148
149
|
```
|
149
150
|
|
150
151
|
### Fine-tunes
|
151
152
|
|
152
|
-
|
153
|
-
|
154
|
-
```json
|
155
|
-
{"prompt":"Overjoyed with my new phone! ->", "completion":" positive"}
|
156
|
-
{"prompt":"@lakers disappoint for a third straight night ->", "completion":" negative"}
|
157
|
-
```
|
158
|
-
|
159
|
-
and pass the path to `client.files.upload` to upload it to OpenAI and get its ID:
|
153
|
+
Upload your fine-tuning data in a `.jsonl` file as above and get its ID:
|
160
154
|
|
161
155
|
```ruby
|
162
156
|
response = client.files.upload(parameters: { file: "path/to/sentiment.jsonl", purpose: "fine-tune" })
|
@@ -200,6 +194,12 @@ This fine-tuned model name can then be used in completions:
|
|
200
194
|
JSON.parse(response.body)["choices"].map { |c| c["text"] }
|
201
195
|
```
|
202
196
|
|
197
|
+
You can delete the fine-tuned model when you are done with it:
|
198
|
+
|
199
|
+
```ruby
|
200
|
+
client.finetunes.delete(fine_tuned_model: fine_tuned_model)
|
201
|
+
```
|
202
|
+
|
203
203
|
### Image Generation
|
204
204
|
|
205
205
|
Generate an image using DALL·E! The size of any generated images must be one of `256x256`, `512x512` or `1024x1024` -
|
data/lib/ruby/openai/files.rb
CHANGED
@@ -24,5 +24,13 @@ module OpenAI
|
|
24
24
|
def events(id:)
|
25
25
|
OpenAI::Client.get(path: "/fine-tunes/#{id}/events")
|
26
26
|
end
|
27
|
+
|
28
|
+
def delete(fine_tuned_model:)
|
29
|
+
if fine_tuned_model.start_with?("ft-")
|
30
|
+
raise ArgumentError, "Please give a fine_tuned_model name, not a fine-tune ID"
|
31
|
+
end
|
32
|
+
|
33
|
+
OpenAI::Client.delete(path: "/models/#{fine_tuned_model}")
|
34
|
+
end
|
27
35
|
end
|
28
36
|
end
|
data/lib/ruby/openai/version.rb
CHANGED
data/ruby-openai.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-openai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -17,9 +17,6 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.18.1
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.22.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,9 +24,6 @@ dependencies:
|
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 0.18.1
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 0.22.0
|
33
27
|
description:
|
34
28
|
email:
|
35
29
|
- alexrudall@users.noreply.github.com
|
@@ -86,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
80
|
- !ruby/object:Gem::Version
|
87
81
|
version: '0'
|
88
82
|
requirements: []
|
89
|
-
rubygems_version: 3.
|
83
|
+
rubygems_version: 3.4.5
|
90
84
|
signing_key:
|
91
85
|
specification_version: 4
|
92
86
|
summary: A Ruby gem for the OpenAI GPT-3 API
|