openai-api
Advanced tools
Comparing version 1.2.5 to 1.2.6
@@ -6,2 +6,4 @@ "use strict"; | ||
const DEFAULT_ENGINE = "davinci"; | ||
class OpenAI { | ||
@@ -35,3 +37,3 @@ constructor(api_key) { | ||
complete(opts) { | ||
const url = config.completionURL(opts.engine); | ||
const url = config.completionURL(opts.engine || DEFAULT_ENGINE); | ||
delete opts.engine; | ||
@@ -48,3 +50,3 @@ | ||
search(opts) { | ||
const url = config.searchURL(opts.engine) | ||
const url = config.searchURL(opts.engine || DEFAULT_ENGINE) | ||
delete opts.engine; | ||
@@ -51,0 +53,0 @@ return this._send_request(url, 'post', opts); |
{ | ||
"name": "openai-api", | ||
"version": "1.2.5", | ||
"version": "1.2.6", | ||
"description": "A tiny client module for the openAI API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -76,2 +76,14 @@ require('dotenv').config(); | ||
it('should use the davinci engine by default', async function () { | ||
const result = await openai.complete({ | ||
prompt: "this is a test", | ||
maxTokens: 5, | ||
temperature: 0.9, | ||
frequencyPenalty: 0, | ||
bestOf: 1, | ||
stop: ["\n", "engine test"] | ||
}); | ||
expect(result).to.be.ok; | ||
}); | ||
it('should return a default value from the encode function', async function () { | ||
@@ -78,0 +90,0 @@ const result = await openai.encode('this is a string') |
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
11000
226