openai_ruby 0.3.3 → 0.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33013deb6a09941565ac13e9b3ee5de96d220b54c5c18f691201312237625ed1
4
- data.tar.gz: f0e635b8af085b9111f83e3575e125a6de7a931793df2f75cca27f84abb6ccac
3
+ metadata.gz: 81e0258ab6bf88656d9b93a18c224102395e7554db4861bb48abe689b9feb35a
4
+ data.tar.gz: 34b12d1fdcc6504f8634448f31e6904a112c71aef3c74f6deebad44254e7694f
5
5
  SHA512:
6
- metadata.gz: e8b07aafb4694d054618c56808fd8e9fd12d246f24003c5d8ad1672dff02a75e9c91c2d656f0e537e9f25dfe2d1402a84ec3f0d0f8491a1310b06c936b483b09
7
- data.tar.gz: f32b7a3a048742c1d2ec478ede1082176ad00a7351ee7b9de094ab2e2315e7153b2de3c641d5474ba85109b21eddbe334209c4800060dd87bb89e8433e553765
6
+ metadata.gz: 5b17e84dc3fe67d9fa60cd7533535158fcc867989efd9edaee24b6f0b969ae8c744d86f67666652e5fce361f55edc4b27afa0872e76a6bdbf819be4a8105f3e0
7
+ data.tar.gz: 94e720225a951875150db51bb645a3af9e14b5c31ca5d792c87956beb41f60e536a920e4f223d73be6ffc214314342942571ec30873fb008b67fc6a053f0e3fd
data/Gemfile.lock ADDED
@@ -0,0 +1,64 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ openai_ruby (0.3.4)
5
+ faraday (~> 2.7)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ diff-lcs (1.5.0)
12
+ faraday (2.7.4)
13
+ faraday-net_http (>= 2.0, < 3.1)
14
+ ruby2_keywords (>= 0.0.4)
15
+ faraday-net_http (3.0.2)
16
+ json (2.6.3)
17
+ parallel (1.22.1)
18
+ parser (3.2.1.0)
19
+ ast (~> 2.4.1)
20
+ rainbow (3.1.1)
21
+ rake (13.0.6)
22
+ regexp_parser (2.7.0)
23
+ rexml (3.2.5)
24
+ rspec (3.12.0)
25
+ rspec-core (~> 3.12.0)
26
+ rspec-expectations (~> 3.12.0)
27
+ rspec-mocks (~> 3.12.0)
28
+ rspec-core (3.12.1)
29
+ rspec-support (~> 3.12.0)
30
+ rspec-expectations (3.12.2)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.12.0)
33
+ rspec-mocks (3.12.3)
34
+ diff-lcs (>= 1.2.0, < 2.0)
35
+ rspec-support (~> 3.12.0)
36
+ rspec-support (3.12.0)
37
+ rubocop (1.45.1)
38
+ json (~> 2.3)
39
+ parallel (~> 1.10)
40
+ parser (>= 3.2.0.0)
41
+ rainbow (>= 2.2.2, < 4.0)
42
+ regexp_parser (>= 1.8, < 3.0)
43
+ rexml (>= 3.2.5, < 4.0)
44
+ rubocop-ast (>= 1.24.1, < 2.0)
45
+ ruby-progressbar (~> 1.7)
46
+ unicode-display_width (>= 2.4.0, < 3.0)
47
+ rubocop-ast (1.26.0)
48
+ parser (>= 3.2.1.0)
49
+ ruby-progressbar (1.11.0)
50
+ ruby2_keywords (0.0.5)
51
+ unicode-display_width (2.4.2)
52
+
53
+ PLATFORMS
54
+ arm64-darwin-22
55
+ x86_64-linux
56
+
57
+ DEPENDENCIES
58
+ openai_ruby!
59
+ rake (~> 13.0)
60
+ rspec (~> 3.12)
61
+ rubocop (~> 1.45)
62
+
63
+ BUNDLED WITH
64
+ 2.4.6
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # OpenAI Ruby library
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/openai_ruby.svg)](https://badge.fury.io/rb/openai_ruby)
4
- [![Build Status](https://travis-ci.org/renny-ren/openai_ruby.svg?branch=main)](https://travis-ci.org/renny-ren/openai_ruby)
5
4
  [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/renny-ren/openai_ruby/blob/main/LICENSE)
6
5
 
7
6
  This is a Ruby wrapper for [OpenAI API](https://platform.openai.com/docs/api-reference), which provides convenient access to the OpenAI API from applications written in Ruby.
@@ -23,13 +23,11 @@ module OpenAI
23
23
  connection.post("/v1/chat/completions") do |req|
24
24
  req.body = params.to_json
25
25
  req.options.on_data = proc do |chunk, overall_received_bytes, env|
26
- if block_given?
27
- yield(chunk, overall_received_bytes, env)
28
- end
26
+ yield(chunk, overall_received_bytes, env) if block_given?
29
27
  end
30
28
  end
31
29
  else
32
- connection.post("/v1/chat/completions", params.to_json, headers)
30
+ connection.post("/v1/chat/completions", params.to_json)
33
31
  end
34
32
  end
35
33
 
@@ -41,6 +39,10 @@ module OpenAI
41
39
  )
42
40
  end
43
41
 
42
+ def images
43
+ @images ||= OpenAI::Images.new(connection)
44
+ end
45
+
44
46
  private
45
47
 
46
48
  def connection
@@ -0,0 +1,13 @@
1
+ module OpenAI
2
+ class Images
3
+ attr_reader :connection
4
+
5
+ def initialize(connection)
6
+ @connection = connection
7
+ end
8
+
9
+ def generate(params = {})
10
+ connection.post("/v1/images/generations", params.to_json)
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenAI
4
- VERSION = "0.3.3"
4
+ VERSION = "0.3.5"
5
5
  end
data/lib/openai_ruby.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "faraday"
4
4
  require "openai_ruby/client"
5
+ require "openai_ruby/images"
5
6
  require "openai_ruby/version"
6
7
 
7
8
  module OpenAI
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openai_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renny Ren
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-27 00:00:00.000000000 Z
11
+ date: 2023-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -36,11 +36,13 @@ files:
36
36
  - CHANGELOG.md
37
37
  - CODE_OF_CONDUCT.md
38
38
  - Gemfile
39
+ - Gemfile.lock
39
40
  - LICENSE
40
41
  - README.md
41
42
  - Rakefile
42
43
  - lib/openai_ruby.rb
43
44
  - lib/openai_ruby/client.rb
45
+ - lib/openai_ruby/images.rb
44
46
  - lib/openai_ruby/version.rb
45
47
  - sig/openai_ruby/ruby.rbs
46
48
  homepage: https://github.com/renny-ren/openai_ruby