pwn 0.4.659 → 0.4.661
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/README.md +2 -2
- data/lib/pwn/plugins/open_ai.rb +12 -3
- data/lib/pwn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bd98af58e97c52c8924292ab003cfa70bb8ae714506e962a278f233702cce8b4
|
|
4
|
+
data.tar.gz: ecca1f74b783a92ed4b8f31b23d088f2dddeb851cc37a95b63fba2a972f29313
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8b3e154756cc071989a9aacee9cb0292bc42e48f58b3a0e085a0e27013336fdf2dab4f815a7e679920dc8c9c02992098d332553ab3e9001131880ea872dfd858
|
|
7
|
+
data.tar.gz: e5096825172efab4cf82f8389e118b96a0fba392649e37072b0a4cda4c123143a58ed4209662496b054d88a3d90b8536156c0b7c931450f8e973946ef5375080
|
data/README.md
CHANGED
|
@@ -37,7 +37,7 @@ $ rvm use ruby-3.2.2@pwn
|
|
|
37
37
|
$ rvm list gemsets
|
|
38
38
|
$ gem install --verbose pwn
|
|
39
39
|
$ pwn
|
|
40
|
-
pwn[v0.4.
|
|
40
|
+
pwn[v0.4.661]:001 >>> PWN.help
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.2.2@pwn
|
|
|
52
52
|
$ gem uninstall --all --executables pwn
|
|
53
53
|
$ gem install --verbose pwn
|
|
54
54
|
$ pwn
|
|
55
|
-
pwn[v0.4.
|
|
55
|
+
pwn[v0.4.661]:001 >>> PWN.help
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
|
data/lib/pwn/plugins/open_ai.rb
CHANGED
|
@@ -146,13 +146,14 @@ module PWN
|
|
|
146
146
|
|
|
147
147
|
gpt = true if model.include?('gpt-3.5') || model.include?('gpt-4')
|
|
148
148
|
|
|
149
|
+
max_tokens = 4_096 - (request.to_s.length / 4)
|
|
150
|
+
|
|
149
151
|
if gpt
|
|
150
152
|
rest_call = 'chat/completions'
|
|
151
153
|
|
|
152
154
|
response_history = opts[:response_history]
|
|
153
155
|
|
|
154
156
|
max_tokens = response_history[:usage][:total_tokens] unless response_history.nil?
|
|
155
|
-
max_tokens ||= 4_096 - (request.to_s.length / 4)
|
|
156
157
|
max_tokens = 8_192 - (request.to_s.length / 4) if model.include?('gpt-4')
|
|
157
158
|
max_tokens = 32_768 - (request.to_s.length / 4) if model.include?('gpt-4-32k')
|
|
158
159
|
max_tokens = 300 unless max_tokens.positive?
|
|
@@ -191,7 +192,6 @@ module PWN
|
|
|
191
192
|
else
|
|
192
193
|
# Per https://openai.com/pricing:
|
|
193
194
|
# For English text, 1 token is approximately 4 characters or 0.75 words.
|
|
194
|
-
max_tokens = 4_097 - (request.to_s.length / 4)
|
|
195
195
|
max_tokens = 300 unless max_tokens.positive?
|
|
196
196
|
|
|
197
197
|
rest_call = 'completions'
|
|
@@ -541,7 +541,6 @@ module PWN
|
|
|
541
541
|
public_class_method def self.delete_file(opts = {})
|
|
542
542
|
token = opts[:token]
|
|
543
543
|
file = opts[:file]
|
|
544
|
-
raise "ERROR: #{file} not found." unless File.exist?(file)
|
|
545
544
|
|
|
546
545
|
response = list_files(token: token)
|
|
547
546
|
file_id = response[:data].select { |f| f if f[:filename] == File.basename(file) }.first[:id]
|
|
@@ -643,11 +642,21 @@ module PWN
|
|
|
643
642
|
fine_tune_id: 'required - respective :id value returned from #list_fine_tunes',
|
|
644
643
|
)
|
|
645
644
|
|
|
645
|
+
response = #{self}.cancel_fine_tune(
|
|
646
|
+
token: 'required - Bearer token',
|
|
647
|
+
fine_tune_id: 'required - respective :id value returned from #list_fine_tunes',
|
|
648
|
+
)
|
|
649
|
+
|
|
646
650
|
response = #{self}.get_fine_tune_events(
|
|
647
651
|
token: 'required - Bearer token',
|
|
648
652
|
fine_tune_id: 'required - respective :id value returned from #list_fine_tunes',
|
|
649
653
|
)
|
|
650
654
|
|
|
655
|
+
response = #{self}.delete_fine_tune_model(
|
|
656
|
+
token: 'required - Bearer token',
|
|
657
|
+
model: 'required - model to delete'
|
|
658
|
+
)
|
|
659
|
+
|
|
651
660
|
response = #{self}.list_files(
|
|
652
661
|
token: 'required - Bearer token'
|
|
653
662
|
)
|
data/lib/pwn/version.rb
CHANGED