openai_ruby 0.3.2 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +64 -0
- data/README.md +1 -2
- data/lib/openai_ruby/client.rb +8 -8
- data/lib/openai_ruby/version.rb +1 -1
- data/lib/openai_ruby.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbcaf002cd9527eee42cef58128dadfcc4e2bb68ea1594f2897b6f512960cf04
|
4
|
+
data.tar.gz: 2c53e131223a867ca02431988864f9a26e9127cb8c13f7dd7b00cac0938d5579
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63d7d58dc8d47d73b35469e500fe0f10164291e4ca673c859c0af57a6c588f4147dd010d568c297cef5cff540655d6627607d2e85e7e0c4366e0961725755acc
|
7
|
+
data.tar.gz: c2da02b0a4c211e8a4439b2c08b0b0f69694db28c6839baacc5aa2f33aa04611219eb38d7d363980efb726ea85cad33b5caa02a970a069c2f77189df4edf758b
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
openai_ruby (0.3.3)
|
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,10 +1,9 @@
|
|
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
|
-
This is a Ruby wrapper for [OpenAI API](https://openai.com/api
|
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.
|
8
7
|
|
9
8
|
Let's build next-gen apps with OpenAI’s powerful models.
|
10
9
|
|
data/lib/openai_ruby/client.rb
CHANGED
@@ -18,20 +18,16 @@ module OpenAI
|
|
18
18
|
)
|
19
19
|
end
|
20
20
|
|
21
|
-
def create_chat_completion(params = {}
|
21
|
+
def create_chat_completion(params = {})
|
22
22
|
if params[:stream]
|
23
23
|
connection.post("/v1/chat/completions") do |req|
|
24
24
|
req.body = params.to_json
|
25
|
-
req.options.on_data =
|
26
|
-
|
25
|
+
req.options.on_data = proc do |chunk, overall_received_bytes, env|
|
26
|
+
yield(chunk, overall_received_bytes, env) if block_given?
|
27
27
|
end
|
28
28
|
end
|
29
29
|
else
|
30
|
-
connection.post(
|
31
|
-
"/v1/chat/completions",
|
32
|
-
params.to_json,
|
33
|
-
headers
|
34
|
-
)
|
30
|
+
connection.post("/v1/chat/completions", params.to_json)
|
35
31
|
end
|
36
32
|
end
|
37
33
|
|
@@ -43,6 +39,10 @@ module OpenAI
|
|
43
39
|
)
|
44
40
|
end
|
45
41
|
|
42
|
+
def images
|
43
|
+
@images ||= OpenAI::Images.new(connection)
|
44
|
+
end
|
45
|
+
|
46
46
|
private
|
47
47
|
|
48
48
|
def connection
|
data/lib/openai_ruby/version.rb
CHANGED
data/lib/openai_ruby.rb
CHANGED
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.
|
4
|
+
version: 0.3.4
|
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-
|
11
|
+
date: 2023-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -36,6 +36,7 @@ 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
|