ruby-openai 6.0.0 โ†’ 6.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88af78318c57c49636755099d6c8837e62762dee65e27465160b1d3778721edd
4
- data.tar.gz: d6abf778678cf1813ce61efcf5874ecb0e4157a9cb08f6e958948b6d4f5d74ab
3
+ metadata.gz: 492acab028ee10ea62f7f95814d674299f0fb83de535322bfc935c48b41b74f3
4
+ data.tar.gz: 290cd1cf80ac93bf880434e8c5969b22a077582bf07fc93f6718ad186ebd0d66
5
5
  SHA512:
6
- metadata.gz: 046c91484f51ea3973698c2bd3a7ff627df3a8413097757e4cd7debaf540ee40eb162cfdc6df41b2973cba3a5ef17014c8c18f544c777a5a45d93cb8530fe232
7
- data.tar.gz: 196cd9c830e5e2639c16fc02431b2dfad8286cc098c85b47c6c42c2c64a2f570a8412f021846ffdff0c057a184a298c43c82e69b0f2ad1b25f048b0c76969422
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 where 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.
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-openai (6.0.0)
4
+ ruby-openai (6.0.1)
5
5
  event_stream_parser (>= 0.3.0, < 1.0.0)
6
6
  faraday (>= 1)
7
7
  faraday-multipart (>= 1)
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
- ๐Ÿšข Based in the UK and want to hire me? Now you can! [railsai.com](https://railsai.com?utm_source=ruby-openai&utm_medium=readme&utm_id=26072023)
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: JSON.parse(chunk)))
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
@@ -1,3 +1,3 @@
1
1
  module OpenAI
2
- VERSION = "6.0.0".freeze
2
+ VERSION = "6.0.1".freeze
3
3
  end
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.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-06 00:00:00.000000000 Z
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