openai-client 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +26 -0
- data/Rakefile +7 -0
- data/lib/openai/client/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: 3cbf3dd44125f32b91842962afe23cd6c9598d1860134d9bbdf00f7aee8a0324
|
4
|
+
data.tar.gz: 5082017517a67520e653376ee73bc267c7775d2e85979b7fb38ef8a19267fc20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24b0f29f7e4c58a3f881fcd06a68d833e8c3185990d572983f43e68d86a97ec4911d2ffa9f906c5408b0aac142e7a8fca6029f406325f3082dcf695a83e8c605
|
7
|
+
data.tar.gz: f82ba652ebcaea9407f6b4667a5b98351af1352c48e112a0a90773a909bd1f043979a1cd2fc261be9bd714c1fe85298b3a95eec32bd2878168307e1336724de9
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -5,14 +5,20 @@ This gem is a wrapper for calling the OpenAI and GPT-3 APIs.
|
|
5
5
|
* [Installation](#installation)
|
6
6
|
* [Usage](#usage)
|
7
7
|
* [OpenAI Models API](#openai-models-api)
|
8
|
+
* [List Models](#list-models)
|
9
|
+
* [Find Model](#find-model)
|
8
10
|
* [OpenAI Completions API](#openai-completions-api)
|
11
|
+
* [Create Completion](#create-completion)
|
9
12
|
* [OpenAI Edits API](#openai-edits-api)
|
13
|
+
* [Create Edit](#create-edit)
|
10
14
|
* [OpenAI Image API](#openai-image-api)
|
11
15
|
* [Create an Image](#create-an-image)
|
12
16
|
* [Create an Image Edit](#create-an-image-edit)
|
13
17
|
* [Create an Image Variation](#create-an-image-variation)
|
14
18
|
* [OpenAI Embeddings API](#openai-embeddings-api)
|
19
|
+
* [Create Embeddings](#create-embeddings)
|
15
20
|
* [OpenAI Moderations API](#openai-moderations-api)
|
21
|
+
* [Create Moderation](#create-moderation)
|
16
22
|
* [OpenAI Files API](#openai-files-api)
|
17
23
|
* [List Files](#list-files)
|
18
24
|
* [Find File](#find-file)
|
@@ -63,6 +69,18 @@ end
|
|
63
69
|
|
64
70
|
## OpenAI Models API
|
65
71
|
|
72
|
+
### List Models
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
Openai::Client.models.list
|
76
|
+
```
|
77
|
+
|
78
|
+
### Find Model
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
Openai::Client.models.find(model_id)
|
82
|
+
```
|
83
|
+
|
66
84
|
```ruby
|
67
85
|
# Models
|
68
86
|
Openai::Client.models.list
|
@@ -73,6 +91,8 @@ Openai::Client.models.find(model_id)
|
|
73
91
|
|
74
92
|
## OpenAI Completions API
|
75
93
|
|
94
|
+
### Create Completion
|
95
|
+
|
76
96
|
```ruby
|
77
97
|
request_body = {
|
78
98
|
model: 'text-davinci-003',
|
@@ -92,6 +112,8 @@ Openai::Client.completions.create(request_body)
|
|
92
112
|
|
93
113
|
## OpenAI Edits API
|
94
114
|
|
115
|
+
### Create Edit
|
116
|
+
|
95
117
|
```ruby
|
96
118
|
request_body = {
|
97
119
|
model: 'text-davinci-edit-001',
|
@@ -156,6 +178,8 @@ response = Openai::Client.images.variations(request_body)
|
|
156
178
|
|
157
179
|
## OpenAI Embeddings API
|
158
180
|
|
181
|
+
### Create Embeddings
|
182
|
+
|
159
183
|
```ruby
|
160
184
|
request_body = {
|
161
185
|
model: 'text-embedding-ada-002',
|
@@ -168,6 +192,8 @@ Openai::Client.embeddings.create(request_body)
|
|
168
192
|
|
169
193
|
## OpenAI Moderations API
|
170
194
|
|
195
|
+
### Create Moderation
|
196
|
+
|
171
197
|
```ruby
|
172
198
|
request_body = {
|
173
199
|
model: 'text-moderation-latest', # text-moderation-stable or text-moderation-latest
|
data/Rakefile
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rspec/core/rake_task'
|
5
|
+
require 'yard'
|
5
6
|
|
6
7
|
RSpec::Core::RakeTask.new(:spec)
|
7
8
|
|
@@ -10,3 +11,9 @@ require 'rubocop/rake_task'
|
|
10
11
|
RuboCop::RakeTask.new
|
11
12
|
|
12
13
|
task default: %i[spec rubocop]
|
14
|
+
|
15
|
+
YARD::Rake::YardocTask.new do |t|
|
16
|
+
t.files = ['lib/**/*.rb'] # optional
|
17
|
+
t.options = ['--any', '--extra', '--opts'] # optional
|
18
|
+
t.stats_options = ['--list-undoc'] # optional
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openai-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ihor Tykhonenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|