ruby-openai 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +7 -7
- data/README.md +17 -2
- data/lib/openai/client.rb +4 -0
- data/lib/openai/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3d2b8f98be44b7f33fce40f271bccc3dc1c72237df7ad64baed43f4ea79fb51
|
4
|
+
data.tar.gz: f19cc5e7155b47e6f7ccb7c5642679e5d8f7a6600e6d4f9e592ebc16313b74f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f2c05fae48718593ea7990c480f6108844a698a943c8db2e3e01f3e31e95ede1ca2a5bd0dec5364a9b1730698c3802e24eecec585d20e59b03e1a421c8a3c4e
|
7
|
+
data.tar.gz: 303d6df6cea50a4f9ac50f8cab7329e585e201aeb2532709b161b830896cc1e733e0c48dfa6ebff22d13d930c3a0ff76425b8e0294c7e175a1bc4e07b84710a2
|
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
|
+
## [3.4.0] - 2023-03-01
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Add Client#chat endpoint - ChatGPT over the wire!
|
13
|
+
|
8
14
|
## [3.3.0] - 2023-02-15
|
9
15
|
|
10
16
|
### Changed
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ruby-openai (3.
|
4
|
+
ruby-openai (3.4.0)
|
5
5
|
httparty (>= 0.18.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -23,7 +23,7 @@ GEM
|
|
23
23
|
mini_mime (1.1.2)
|
24
24
|
multi_xml (0.6.0)
|
25
25
|
parallel (1.22.1)
|
26
|
-
parser (3.2.
|
26
|
+
parser (3.2.1.0)
|
27
27
|
ast (~> 2.4.1)
|
28
28
|
public_suffix (5.0.1)
|
29
29
|
rainbow (3.1.1)
|
@@ -43,18 +43,18 @@ GEM
|
|
43
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
44
44
|
rspec-support (~> 3.12.0)
|
45
45
|
rspec-support (3.12.0)
|
46
|
-
rubocop (1.
|
46
|
+
rubocop (1.46.0)
|
47
47
|
json (~> 2.3)
|
48
48
|
parallel (~> 1.10)
|
49
49
|
parser (>= 3.2.0.0)
|
50
50
|
rainbow (>= 2.2.2, < 4.0)
|
51
51
|
regexp_parser (>= 1.8, < 3.0)
|
52
52
|
rexml (>= 3.2.5, < 4.0)
|
53
|
-
rubocop-ast (>= 1.
|
53
|
+
rubocop-ast (>= 1.26.0, < 2.0)
|
54
54
|
ruby-progressbar (~> 1.7)
|
55
55
|
unicode-display_width (>= 2.4.0, < 3.0)
|
56
|
-
rubocop-ast (1.
|
57
|
-
parser (>= 3.
|
56
|
+
rubocop-ast (1.26.0)
|
57
|
+
parser (>= 3.2.1.0)
|
58
58
|
ruby-progressbar (1.11.0)
|
59
59
|
unicode-display_width (2.4.2)
|
60
60
|
vcr (6.1.0)
|
@@ -71,7 +71,7 @@ DEPENDENCIES
|
|
71
71
|
dotenv (~> 2.8.1)
|
72
72
|
rake (~> 13.0)
|
73
73
|
rspec (~> 3.12)
|
74
|
-
rubocop (~> 1.
|
74
|
+
rubocop (~> 1.46.0)
|
75
75
|
ruby-openai!
|
76
76
|
vcr (~> 6.1.0)
|
77
77
|
webmock (~> 3.18.1)
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
Use the [OpenAI API](https://openai.com/blog/openai-api/) with Ruby! 🤖❤️
|
9
9
|
|
10
|
-
Generate text with
|
10
|
+
Generate text with ChatGPT, create images with DALL·E, or write code with Codex...
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
@@ -89,9 +89,24 @@ There are different models that can be used to generate text. For a full list an
|
|
89
89
|
- code-davinci-002
|
90
90
|
- code-cushman-001
|
91
91
|
|
92
|
+
### ChatGPT
|
93
|
+
|
94
|
+
ChatGPT is a model that can be used to generate text in a conversational style. You can use it to generate a response to a sequence of [messages](https://platform.openai.com/docs/guides/chat/introduction):
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
response = client.chat(
|
98
|
+
parameters: {
|
99
|
+
model: "gpt-3.5-turbo",
|
100
|
+
messages: [{ role: "user", content: "Hello!"}],
|
101
|
+
})
|
102
|
+
puts response.dig("choices", 0, "message", "content")
|
103
|
+
=> "Hello! How may I assist you today?"
|
104
|
+
|
105
|
+
```
|
106
|
+
|
92
107
|
### Completions
|
93
108
|
|
94
|
-
Hit the OpenAI API for a completion:
|
109
|
+
Hit the OpenAI API for a completion using other GPT-3 models:
|
95
110
|
|
96
111
|
```ruby
|
97
112
|
response = client.completions(
|
data/lib/openai/client.rb
CHANGED
@@ -7,6 +7,10 @@ module OpenAI
|
|
7
7
|
OpenAI.configuration.organization_id = organization_id if organization_id
|
8
8
|
end
|
9
9
|
|
10
|
+
def chat(parameters: {})
|
11
|
+
OpenAI::Client.json_post(path: "/chat/completions", parameters: parameters)
|
12
|
+
end
|
13
|
+
|
10
14
|
def completions(parameters: {})
|
11
15
|
OpenAI::Client.json_post(path: "/completions", parameters: parameters)
|
12
16
|
end
|
data/lib/openai/version.rb
CHANGED
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: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.18.1
|
27
|
-
description:
|
27
|
+
description:
|
28
28
|
email:
|
29
29
|
- alexrudall@users.noreply.github.com
|
30
30
|
executables: []
|
@@ -85,8 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
|
-
rubygems_version: 3.4.
|
89
|
-
signing_key:
|
88
|
+
rubygems_version: 3.4.6
|
89
|
+
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: A Ruby gem for the OpenAI GPT-3 API
|
92
92
|
test_files: []
|