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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b72775b6b21c9acf9e84b91f1a2e177fe2a7917cfd1e5605d416bbd7766d70f9
4
- data.tar.gz: 2cbabd62e83e190ad1f4730cd9782eecb0732739f16f8c81ba7de77b14ecd4b6
3
+ metadata.gz: bdfaef88879152f3de0bd34e96e5cce4c669693347715a4cc776cd2da4e27864
4
+ data.tar.gz: 171f6b21eb32a63142a11c7964d3f1871343634bbe845c30a56a9ff72ea912dc
5
5
  SHA512:
6
- metadata.gz: 15538510ea113eea5317c58d8d82c0f697ea0e05272ab56b5f6decccf12f53e6a88aa2a1cb728c26d5a0a59865b8b310ebbe1f5de90f5d24ba0c725546564b68
7
- data.tar.gz: f523f707a1ff262791dfec83dc809a01a30b33556d595a424ca330887919f97e7d1c45e33988c7567b842a1de9f18ac4681d2b0ea4edb75b195f1b06d70fd779
6
+ metadata.gz: 2471a90fddcad074339e338f24df56980ab47c76b70aa3f4f4d5676b6e8d841525a5d911ee69d586165697ecd177d3b9f9d11bec93a7c73f7ecc1a6df5fb4036
7
+ data.tar.gz: 41c2a29991c0b60cc574fe65fdf3043fe610a96e36075ee963882bee2b52e741d1cb57ad8a95e4a02c72eabcbb3999318ddad7f822c9b27d92802d33ae66cc47
@@ -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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-openai (0.1.4)
4
+ ruby-openai (0.2.0)
5
5
  dotenv (~> 2.7.6)
6
6
  httparty (~> 0.18.1)
7
7
 
@@ -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: "v1")
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
@@ -1,5 +1,5 @@
1
1
  module Ruby
2
2
  module OpenAI
3
- VERSION = "0.1.4".freeze
3
+ VERSION = "0.2.0".freeze
4
4
  end
5
5
  end
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
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-10-18 00:00:00.000000000 Z
11
+ date: 2020-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv