openai.rb 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +7 -0
- data/lib/openai/api/cache.rb +4 -0
- data/lib/openai/api/client.rb +4 -0
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +9 -0
- 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: a36b209f6540c340ca79cfa0e245d373db12c20b1d33f4fdd418c56bfa33961d
|
4
|
+
data.tar.gz: a30abc667ce81ffa59ec3a65c260193554cff814d03805921f745ec9140f2942
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0aacdfd81c1a7bbd88c2fceed1e9c3aaf38f7cc948467b45a2c3e607d5eaf6bafa084ba2a8accd08aa7430c67b08df4da810ef2e07349359b601258c9f14c550
|
7
|
+
data.tar.gz: c6c89ccafded9440f5a472afbcee736307e7f2daa4f82b2028515cec86cd22a224e3006bd1d858c7faa7b495e7d889691c4af76ea4720972b50022890b01d18a
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -51,6 +51,13 @@ openai.api.completions.create(model: 'text-davinci-002', prompt: 'Say hi')
|
|
51
51
|
|
52
52
|
NOTE: Delete requests are not cached
|
53
53
|
|
54
|
+
To temporarily use the client without caching:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
openai = OpenAI.create(ENV.fetch('OPENAI_API_KEY'), cache: cache_dir)
|
58
|
+
openai.without_cache.api.completions.create(...)
|
59
|
+
```
|
60
|
+
|
54
61
|
### Tokens
|
55
62
|
|
56
63
|
```ruby
|
data/lib/openai/api/cache.rb
CHANGED
data/lib/openai/api/client.rb
CHANGED
data/lib/openai/version.rb
CHANGED
data/lib/openai.rb
CHANGED
@@ -41,8 +41,17 @@ class OpenAI
|
|
41
41
|
new(client, logger)
|
42
42
|
end
|
43
43
|
|
44
|
+
# @api private
|
45
|
+
def self.build(api_client, logger)
|
46
|
+
new(api_client, logger)
|
47
|
+
end
|
48
|
+
|
44
49
|
private_class_method :new
|
45
50
|
|
51
|
+
def without_cache
|
52
|
+
self.class.build(api_client.without_cache, logger)
|
53
|
+
end
|
54
|
+
|
46
55
|
def api
|
47
56
|
API.new(api_client)
|
48
57
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openai.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-04-
|
12
|
+
date: 2023-04-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: abstract_type
|