openai-api
Advanced tools
Comparing version 1.0.7 to 1.0.8
20
index.js
@@ -8,14 +8,14 @@ "use strict"; | ||
constructor(api_key) { | ||
this.__api_key = api_key; | ||
this._api_key = api_key; | ||
} | ||
__safe_cast = (number) => { | ||
_safe_cast = (number) => { | ||
return number ? Number(number) : null; | ||
} | ||
__send_request = (opts) => { | ||
_send_request = (opts) => { | ||
const url = config.completionURL(opts.engine); | ||
const reqOpts = { | ||
headers: { | ||
'Authorization': `Bearer ${this.__api_key}`, | ||
'Authorization': `Bearer ${this._api_key}`, | ||
'Content-Type': 'application/json' | ||
@@ -26,6 +26,6 @@ } | ||
prompt: opts.prompt, | ||
max_tokens: this.__safe_cast(opts.maxTokens), | ||
temperature: this.__safe_cast(opts.temperature), | ||
top_p: this.__safe_cast(opts.topP), | ||
n: this.__safe_cast(opts.n), | ||
max_tokens: this._safe_cast(opts.maxTokens), | ||
temperature: this._safe_cast(opts.temperature), | ||
top_p: this._safe_cast(opts.topP), | ||
n: this._safe_cast(opts.n), | ||
stream: opts.stream, | ||
@@ -38,3 +38,3 @@ stop: opts.stop | ||
complete = function (opts) { | ||
return this.__send_request(opts); | ||
return this._send_request(opts); | ||
} | ||
@@ -46,3 +46,3 @@ | ||
headers: { | ||
'Authorization': `Bearer ${this.__api_key}`, | ||
'Authorization': `Bearer ${this._api_key}`, | ||
'Content-Type': 'application/json' | ||
@@ -49,0 +49,0 @@ } |
{ | ||
"name": "openai-api", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "A tiny client module for the openAI API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -33,3 +33,3 @@ # openai-api | ||
stream: false, | ||
stop: ['\n', "testing"] | ||
stop: ['\n', "testing"]in | ||
}); | ||
@@ -36,0 +36,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4641