ruby-openai 0.1.2 → 0.1.3
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 -1
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/ruby/openai/client.rb +3 -3
- data/lib/ruby/openai/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: 71c408c413328ed3d7f4066f0c3acc607a6d2b6c9918ffe1bca87f8d3b343dcb
|
4
|
+
data.tar.gz: e1d93dc12a9de54840a8b962c9446217a85e53c7fc65e6b75ef4a396ade25c13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b66811a2da4ef122581cd8f7599db0930fffe4fa23008319e4df54067dca54ea8f4e0ac37f94cd120736fe8535a8cf613c63bb0661f13d01b33022d026eb74f9
|
7
|
+
data.tar.gz: e488a7710073d74f86e0ac1867757489d6861958aa9232a8e167865091678ef55445e4870baabe4c57cd8038f66feca4c01878adb39af044ded31d7a1f1f1c0b
|
data/CHANGELOG.md
CHANGED
@@ -5,7 +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
|
-
## [
|
8
|
+
## [0.1.3] - 2020-09-09
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
- Add ability to change API version in the future.
|
13
|
+
- Fix README typos.
|
9
14
|
|
10
15
|
## [0.1.2] - 2020-09-09
|
11
16
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -31,7 +31,7 @@ Get your API key from [https://beta.openai.com/docs/developer-quickstart/your-ap
|
|
31
31
|
If you're using [dotenv](https://github.com/motdotla/dotenv), you can add your secret key to your .env file:
|
32
32
|
|
33
33
|
```
|
34
|
-
OPENAI_ACCESS_TOKEN=
|
34
|
+
OPENAI_ACCESS_TOKEN=access_token_goes_here
|
35
35
|
```
|
36
36
|
|
37
37
|
And create a client:
|
@@ -42,7 +42,7 @@ And create a client:
|
|
42
42
|
|
43
43
|
### Without dotenv
|
44
44
|
|
45
|
-
|
45
|
+
Alternatively you can pass your key directly to a new client:
|
46
46
|
|
47
47
|
```
|
48
48
|
client = OpenAI::Client.new(access_token: "access_token_goes_here")
|
data/lib/ruby/openai/client.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
module OpenAI
|
2
2
|
class Client
|
3
3
|
include HTTParty
|
4
|
-
base_uri "https://api.openai.com
|
4
|
+
base_uri "https://api.openai.com"
|
5
5
|
|
6
6
|
def initialize(access_token: nil)
|
7
7
|
@access_token = access_token || ENV["OPENAI_ACCESS_TOKEN"]
|
8
8
|
end
|
9
9
|
|
10
|
-
def call(engine:, prompt:, max_tokens:)
|
10
|
+
def call(engine:, prompt:, max_tokens:, version: "v1")
|
11
11
|
self.class.post(
|
12
|
-
"/#{engine}/completions",
|
12
|
+
"/#{version}/engines/#{engine}/completions",
|
13
13
|
headers: {
|
14
14
|
"Content-Type" => "application/json",
|
15
15
|
"Authorization" => "Bearer #{@access_token}"
|
data/lib/ruby/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: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|