ruby-openai 6.0.0 โ 6.0.1
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 +7 -1
- data/Gemfile.lock +1 -1
- data/README.md +1 -3
- data/lib/openai/http.rb +7 -1
- data/lib/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: 492acab028ee10ea62f7f95814d674299f0fb83de535322bfc935c48b41b74f3
|
|
4
|
+
data.tar.gz: 290cd1cf80ac93bf880434e8c5969b22a077582bf07fc93f6718ad186ebd0d66
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6641fa5f1ecfccc6945ef479d4d59ae400f9f9032cee74a1b8580988c4c7c11aa363789fd1fec981bc32c3119748e813319f018c0d7bb0c7744c6fb8c12d7544
|
|
7
|
+
data.tar.gz: bfc6ddbde1d9fc342551c49c3f6ab26fd23e165fb98e037cb9731c2cd300bfe11dc89fd2c20e5e1c3ad8564958fcaffabedc38611ca7eec3c9ea0b1ba9730fd0
|
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
|
+
## [6.0.1] - 2023-11-07
|
|
9
|
+
|
|
10
|
+
### Fix
|
|
11
|
+
|
|
12
|
+
- Gracefully handle the case where an HTTP error response may not have valid JSON in its body. Thank you [@atesgoral](https://github.com/atesgoral)!
|
|
13
|
+
|
|
8
14
|
## [6.0.0] - 2023-11-06
|
|
9
15
|
|
|
10
16
|
### Added
|
|
@@ -15,7 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
15
21
|
|
|
16
22
|
### Fix
|
|
17
23
|
|
|
18
|
-
- [BREAKING] Fix issue where :stream parameters
|
|
24
|
+
- [BREAKING] Fix issue where :stream parameters were replaced by a boolean in the client application. Thanks to [@martinjaimem](https://github.com/martinjaimem), [@vickymadrid03](https://github.com/vickymadrid03) and [@nicastelo](https://github.com/nicastelo) for spotting and fixing this issue.
|
|
19
25
|
|
|
20
26
|
## [5.2.0] - 2023-10-30
|
|
21
27
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -8,9 +8,7 @@ Use the [OpenAI API](https://openai.com/blog/openai-api/) with Ruby! ๐คโค๏ธ
|
|
|
8
8
|
|
|
9
9
|
Stream text with GPT-4, transcribe and translate audio with Whisper, or create images with DALLยทE...
|
|
10
10
|
|
|
11
|
-
๐ข
|
|
12
|
-
|
|
13
|
-
[๐ฎ Ruby AI Builders Discord](https://discord.gg/k4Uc224xVD) | [๐ฆ Twitter](https://twitter.com/alexrudall) | [๐ง Anthropic Gem](https://github.com/alexrudall/anthropic) | [๐ Midjourney Gem](https://github.com/alexrudall/midjourney)
|
|
11
|
+
[๐ข Hire me](https://peaceterms.com?utm_source=ruby-openai&utm_medium=readme&utm_id=26072023) | [๐ฎ Ruby AI Builders Discord](https://discord.gg/k4Uc224xVD) | [๐ฆ Twitter](https://twitter.com/alexrudall) | [๐ง Anthropic Gem](https://github.com/alexrudall/anthropic) | [๐ Midjourney Gem](https://github.com/alexrudall/midjourney)
|
|
14
12
|
|
|
15
13
|
### Bundler
|
|
16
14
|
|
data/lib/openai/http.rb
CHANGED
|
@@ -51,7 +51,7 @@ module OpenAI
|
|
|
51
51
|
proc do |chunk, _bytes, env|
|
|
52
52
|
if env && env.status != 200
|
|
53
53
|
raise_error = Faraday::Response::RaiseError.new
|
|
54
|
-
raise_error.on_complete(env.merge(body:
|
|
54
|
+
raise_error.on_complete(env.merge(body: try_parse_json(chunk)))
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
parser.feed(chunk) do |_type, data|
|
|
@@ -125,5 +125,11 @@ module OpenAI
|
|
|
125
125
|
req.headers = headers
|
|
126
126
|
req.body = req_parameters.to_json
|
|
127
127
|
end
|
|
128
|
+
|
|
129
|
+
def try_parse_json(maybe_json)
|
|
130
|
+
JSON.parse(maybe_json)
|
|
131
|
+
rescue JSON::ParserError
|
|
132
|
+
maybe_json
|
|
133
|
+
end
|
|
128
134
|
end
|
|
129
135
|
end
|
data/lib/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: 6.0.
|
|
4
|
+
version: 6.0.1
|
|
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-
|
|
11
|
+
date: 2023-11-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: event_stream_parser
|