ruby-openai 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +2 -2
- data/lib/ruby/openai/files.rb +11 -1
- data/lib/ruby/openai/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb5a5c5d8b8e04ba7f6c22de243bfd1e901b69e28cdc2bb234b8bdc46c58a110
|
4
|
+
data.tar.gz: 138fa30d605a4ca116b98a3acb5b74617f27420a8110ef38605ec00f5896fbc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cf09eca86b84db3f6dce82589fd5c2ccd36259308e941427a5b5b9498ebccf3797a57cd6802a91879d0b6cdc87e2383e4ae4451b0941ef74beea64e721a120a
|
7
|
+
data.tar.gz: f3f9dff8efd9ba3c4a32880940078b460c8d853e9a88b0e12fb360de1e3bcb8c3b88dda695b49de9a1c08f9947d69a421be2021a466b0693b74b252cb84348f9
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,12 @@ 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
|
+
## [1.2.1] - 2021-04-11
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Add validation of JSONL files to make it easier to debug during upload.
|
13
|
+
|
8
14
|
## [1.2.0] - 2021-04-08
|
9
15
|
|
10
16
|
### Added
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ruby-openai (1.2.
|
4
|
+
ruby-openai (1.2.1)
|
5
5
|
dotenv (~> 2.7.6)
|
6
6
|
httparty (~> 0.18.1)
|
7
7
|
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
multi_xml (>= 0.5.2)
|
23
23
|
mime-types (3.3.1)
|
24
24
|
mime-types-data (~> 3.2015)
|
25
|
-
mime-types-data (3.
|
25
|
+
mime-types-data (3.2021.0225)
|
26
26
|
multi_xml (0.6.0)
|
27
27
|
parallel (1.20.1)
|
28
28
|
parser (3.0.0.0)
|
data/lib/ruby/openai/files.rb
CHANGED
@@ -18,13 +18,15 @@ module OpenAI
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def upload(version: default_version, parameters: {})
|
21
|
+
file = validate(file: parameters[:file])
|
22
|
+
|
21
23
|
self.class.post(
|
22
24
|
"/#{version}/files",
|
23
25
|
headers: {
|
24
26
|
"Content-Type" => "application/json",
|
25
27
|
"Authorization" => "Bearer #{@access_token}"
|
26
28
|
},
|
27
|
-
body: parameters.merge(file:
|
29
|
+
body: parameters.merge(file: file)
|
28
30
|
)
|
29
31
|
end
|
30
32
|
|
@@ -53,5 +55,13 @@ module OpenAI
|
|
53
55
|
def default_version
|
54
56
|
"v1".freeze
|
55
57
|
end
|
58
|
+
|
59
|
+
def validate(file:)
|
60
|
+
File.open(file).each_line.with_index do |line, index|
|
61
|
+
JSON.parse(line)
|
62
|
+
rescue JSON::ParserError => e
|
63
|
+
raise JSON::ParserError, "#{e.message} - found on line #{index + 1} of #{file}"
|
64
|
+
end
|
65
|
+
end
|
56
66
|
end
|
57
67
|
end
|
data/lib/ruby/openai/version.rb
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: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|