pwn 0.4.619 → 0.4.620
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 +7 -36
- 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: fafd153cff40ac71671f4350a1b00459b355b9648797f013c206272d42fa1d7e
|
|
4
|
+
data.tar.gz: 1915f04c0ee44c2e71a3b90208e3bffed04a2445a2bba3151900fb36fd46ad6c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff8533d123cd6ba697cd452d8526d11c82bed093f28cb2d5146396ebbf4df8b56ffffe343e32770f36cd9a12627b7a174d8b6bac8cc4ca4c569039a60e7c7dba
|
|
7
|
+
data.tar.gz: c4d482bd29938edf14ca98510ebc3885563f55000127c8a01d252a744dc6b671d4419bf89876dd3bafcfc8779c92b925785faeb605139d22b5c5ddb8501afbf3
|
data/README.md
CHANGED
|
@@ -37,7 +37,7 @@ $ rvm use ruby-ruby-3.2.1@pwn
|
|
|
37
37
|
$ rvm list gemsets
|
|
38
38
|
$ gem install --verbose pwn
|
|
39
39
|
$ pwn
|
|
40
|
-
pwn[v0.4.
|
|
40
|
+
pwn[v0.4.620]:001 >>> PWN.help
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
|
@@ -52,7 +52,7 @@ $ rvm use ruby-ruby-3.2.1@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.620]:001 >>> PWN.help
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
|
data/lib/pwn/plugins/open_ai.rb
CHANGED
|
@@ -90,40 +90,6 @@ module PWN
|
|
|
90
90
|
raise e
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
# Supported Method Parameters::
|
|
94
|
-
# response = PWN::Plugins::OpenAI.legacy_chat(
|
|
95
|
-
# token: 'required - Bearer token',
|
|
96
|
-
# request: 'required - message to ChatGPT'
|
|
97
|
-
# model: 'optional - model to use for text generation (defaults to gpt-3.5-turbo)',
|
|
98
|
-
# temp: 'optional - creative response float (deafults to 0)',
|
|
99
|
-
# max_tokens: 'optional - integer (defaults to 4_097 - request.length || 300)'
|
|
100
|
-
# )
|
|
101
|
-
|
|
102
|
-
public_class_method def self.legacy_chat(opts = {})
|
|
103
|
-
token = opts[:token]
|
|
104
|
-
request = opts[:request]
|
|
105
|
-
model = opts[:model]
|
|
106
|
-
model ||= 'text-davinci-003'
|
|
107
|
-
temp = opts[:temp].to_f
|
|
108
|
-
temp = 0 unless temp.positive?
|
|
109
|
-
max_tokens = opts[:max_tokens].to_i
|
|
110
|
-
max_tokens = 4_097 - request.to_s.length
|
|
111
|
-
max_tokens = 300 unless max_tokens.positive?
|
|
112
|
-
|
|
113
|
-
rest_call = 'completions'
|
|
114
|
-
|
|
115
|
-
response = open_ai_rest_call(
|
|
116
|
-
http_method: :post,
|
|
117
|
-
token: token,
|
|
118
|
-
rest_call: rest_call,
|
|
119
|
-
http_body: http_body.to_json
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
JSON.parse(response, symbolize_names: true)
|
|
123
|
-
rescue StandardError => e
|
|
124
|
-
raise e
|
|
125
|
-
end
|
|
126
|
-
|
|
127
93
|
# Supported Method Parameters::
|
|
128
94
|
# response = PWN::Plugins::OpenAI.chat(
|
|
129
95
|
# token: 'required - Bearer token',
|
|
@@ -138,17 +104,19 @@ module PWN
|
|
|
138
104
|
request = opts[:request]
|
|
139
105
|
model = opts[:model]
|
|
140
106
|
model ||= 'gpt-3.5-turbo'
|
|
107
|
+
# model ||= 'text-davinci-003'
|
|
141
108
|
temp = opts[:temp].to_f
|
|
142
109
|
temp = 0 unless temp.positive?
|
|
143
110
|
max_tokens = opts[:max_tokens].to_i
|
|
144
111
|
max_tokens = 4_097 - request.to_s.length
|
|
145
112
|
max_tokens = 300 unless max_tokens.positive?
|
|
146
113
|
|
|
147
|
-
rest_call = 'chat/completions'
|
|
148
|
-
|
|
149
114
|
case model
|
|
150
115
|
when 'text-davinci-002',
|
|
151
116
|
'text-davinci-003'
|
|
117
|
+
|
|
118
|
+
rest_call = 'completions'
|
|
119
|
+
|
|
152
120
|
http_body = {
|
|
153
121
|
model: model,
|
|
154
122
|
prompt: request,
|
|
@@ -157,6 +125,9 @@ module PWN
|
|
|
157
125
|
}
|
|
158
126
|
when 'gpt-3.5-turbo',
|
|
159
127
|
'gpt-4'
|
|
128
|
+
|
|
129
|
+
rest_call = 'chat/completions'
|
|
130
|
+
|
|
160
131
|
http_body = {
|
|
161
132
|
model: model,
|
|
162
133
|
messages: [
|
data/lib/pwn/version.rb
CHANGED