Skip to content

Commit

Permalink
Update ruby-openai to 5.2
Browse files Browse the repository at this point in the history
The major difference is that the methods return hashes instead of Response
objects.
  • Loading branch information
MatheusRich committed Nov 1, 2023
1 parent 4f498be commit 15e5ca4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby 3.2.0
ruby 3.2.2
14 changes: 6 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PATH
async (~> 2.6)
dotenv (~> 2.8.0)
dry-monads (~> 1.6)
ruby-openai (~> 3.0)
ruby-openai (~> 5.0)
slack-ruby-client (~> 2.x)
zeitwerk (~> 2.6.6)

Expand Down Expand Up @@ -37,6 +37,7 @@ GEM
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
event_stream_parser (0.3.0)
faraday (2.7.11)
base64
faraday-net_http (>= 2.0, < 3.1)
Expand All @@ -52,15 +53,10 @@ GEM
gli (2.21.1)
hashdiff (1.0.1)
hashie (5.0.0)
httparty (0.21.0)
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
io-event (1.3.3)
json (2.6.3)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
mini_mime (1.1.5)
multi_xml (0.6.0)
multipart-post (2.3.0)
parallel (1.23.0)
parser (3.2.2.4)
Expand Down Expand Up @@ -102,8 +98,10 @@ GEM
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
ruby-openai (3.7.0)
httparty (>= 0.18.1)
ruby-openai (5.2.0)
event_stream_parser (>= 0.3.0, < 1.0.0)
faraday (>= 1)
faraday-multipart (>= 1)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
simplecov (0.22.0)
Expand Down
2 changes: 1 addition & 1 deletion gold_miner.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
spec.add_dependency "async", "~> 2.6"
spec.add_dependency "dotenv", "~> 2.8.0"
spec.add_dependency "dry-monads", "~> 1.6"
spec.add_dependency "ruby-openai", "~> 3.0"
spec.add_dependency "ruby-openai", "~> 5.0"
spec.add_dependency "slack-ruby-client", "~> 2.x"
spec.add_dependency "zeitwerk", "~> 2.6.6"

Expand Down
1 change: 0 additions & 1 deletion lib/gold_miner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require "dry/monads"
require "zeitwerk"
require "openai"

Zeitwerk::Loader.for_gem.setup

Expand Down
2 changes: 2 additions & 0 deletions lib/gold_miner/author_config.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require "yaml"

class GoldMiner
class AuthorConfig
DEFAULT_AUTHOR_LINK = "#to-do"
Expand Down
3 changes: 2 additions & 1 deletion lib/gold_miner/blog_post/open_ai_writer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require "openai"
require "json"

class GoldMiner
Expand Down Expand Up @@ -53,7 +54,7 @@ def ask_openai(prompt)
}
)

if !response.success?
if !response["error"].nil?
warn "[WARNING] OpenAI error: #{response["error"]["message"]}"
return
end
Expand Down

0 comments on commit 15e5ca4

Please sign in to comment.