ruby-openai 0.1.4 → 0.2.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.lock +1 -1
- data/lib/ruby/openai/client.rb +20 -1
- 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: bdfaef88879152f3de0bd34e96e5cce4c669693347715a4cc776cd2da4e27864
|
4
|
+
data.tar.gz: 171f6b21eb32a63142a11c7964d3f1871343634bbe845c30a56a9ff72ea912dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2471a90fddcad074339e338f24df56980ab47c76b70aa3f4f4d5676b6e8d841525a5d911ee69d586165697ecd177d3b9f9d11bec93a7c73f7ecc1a6df5fb4036
|
7
|
+
data.tar.gz: 41c2a29991c0b60cc574fe65fdf3043fe610a96e36075ee963882bee2b52e741d1cb57ad8a95e4a02c72eabcbb3999318ddad7f822c9b27d92802d33ae66cc47
|
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
|
+
## [0.2.0] - 2020-11-22
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Add method to use the search endpoint.
|
13
|
+
|
8
14
|
## [0.1.4] - 2020-10-18
|
9
15
|
|
10
16
|
### Changed
|
data/Gemfile.lock
CHANGED
data/lib/ruby/openai/client.rb
CHANGED
@@ -7,7 +7,7 @@ module OpenAI
|
|
7
7
|
@access_token = access_token || ENV["OPENAI_ACCESS_TOKEN"]
|
8
8
|
end
|
9
9
|
|
10
|
-
def call(engine:, prompt:, max_tokens:, version:
|
10
|
+
def call(engine:, prompt:, max_tokens:, version: default_version)
|
11
11
|
self.class.post(
|
12
12
|
"/#{version}/engines/#{engine}/completions",
|
13
13
|
headers: {
|
@@ -19,5 +19,24 @@ module OpenAI
|
|
19
19
|
}.to_json
|
20
20
|
)
|
21
21
|
end
|
22
|
+
|
23
|
+
def search(engine:, documents:, query:, version: default_version)
|
24
|
+
self.class.post(
|
25
|
+
"/#{version}/engines/#{engine}/search",
|
26
|
+
headers: {
|
27
|
+
"Content-Type" => "application/json",
|
28
|
+
"Authorization" => "Bearer #{@access_token}"
|
29
|
+
},
|
30
|
+
body: {
|
31
|
+
documents: documents, query: query
|
32
|
+
}.to_json
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def default_version
|
39
|
+
"v1".freeze
|
40
|
+
end
|
22
41
|
end
|
23
42
|
end
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|