lib/pwn/plugins/ollama.rb in pwn-0.5.70 vs lib/pwn/plugins/ollama.rb in pwn-0.5.71
- old
+ new
@@ -99,40 +99,10 @@
ensure
spinner.stop
end
# Supported Method Parameters::
- # response = PWN::Plugins::Ollama.get_key(
- # fqdn: 'required - base URI for the Ollama API',
- # user: 'required - ollama user',
- # pass: 'required - ollama password',
- # )
-
- public_class_method def self.get_key(opts = {})
- fqdn = opts[:fqdn]
- user = opts[:user]
- pass = opts[:pass]
-
- http_body = {
- email: user,
- password: pass
- }
-
- response = ollama_rest_call(
- fqdn: fqdn,
- http_method: :post,
- rest_call: 'api/v1/auths/signin',
- http_body: http_body
- )
-
- json_resp = JSON.parse(response, symbolize_names: true)
- json_resp[:token]
- rescue StandardError => e
- raise e
- end
-
- # Supported Method Parameters::
# response = PWN::Plugins::Ollama.get_models(
# token: 'required - Bearer token',
# timeout: 'optional timeout in seconds (defaults to 300)'
# )
@@ -167,13 +137,13 @@
fqdn = opts[:fqdn]
token = opts[:token]
request = opts[:request]
model = opts[:model]
- model ||= 'llama2:latest'
+ raise 'ERROR: Model is required. Call #get_models method for details' if model.nil?
temp = opts[:temp].to_f
- temp = 0 unless temp.positive?
+ temp = 1 if temp.zero?
rest_call = 'ollama/v1/chat/completions'
response_history = opts[:response_history]