openai_ruby 0.3.2 → 0.3.3
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/README.md +1 -1
- data/lib/openai_ruby/client.rb +6 -8
- data/lib/openai_ruby/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: 33013deb6a09941565ac13e9b3ee5de96d220b54c5c18f691201312237625ed1
|
4
|
+
data.tar.gz: f0e635b8af085b9111f83e3575e125a6de7a931793df2f75cca27f84abb6ccac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8b07aafb4694d054618c56808fd8e9fd12d246f24003c5d8ad1672dff02a75e9c91c2d656f0e537e9f25dfe2d1402a84ec3f0d0f8491a1310b06c936b483b09
|
7
|
+
data.tar.gz: f32b7a3a048742c1d2ec478ede1082176ad00a7351ee7b9de094ab2e2315e7153b2de3c641d5474ba85109b21eddbe334209c4800060dd87bb89e8433e553765
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[](https://travis-ci.org/renny-ren/openai_ruby)
|
5
5
|
[](https://github.com/renny-ren/openai_ruby/blob/main/LICENSE)
|
6
6
|
|
7
|
-
This is a Ruby wrapper for [OpenAI API](https://openai.com/api
|
7
|
+
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
8
|
|
9
9
|
Let's build next-gen apps with OpenAI’s powerful models.
|
10
10
|
|
data/lib/openai_ruby/client.rb
CHANGED
@@ -18,20 +18,18 @@ 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
|
+
if block_given?
|
27
|
+
yield(chunk, overall_received_bytes, env)
|
28
|
+
end
|
27
29
|
end
|
28
30
|
end
|
29
31
|
else
|
30
|
-
connection.post(
|
31
|
-
"/v1/chat/completions",
|
32
|
-
params.to_json,
|
33
|
-
headers
|
34
|
-
)
|
32
|
+
connection.post("/v1/chat/completions", params.to_json, headers)
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
data/lib/openai_ruby/version.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.3
|
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-
|
11
|
+
date: 2023-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|