diff --git a/config.js b/config.js index 08d2fd3..e16d9f0 100644 --- a/config.js +++ b/config.js @@ -7,6 +7,9 @@ module.exports = { completionURL(engine) { return `${OPEN_AI_URL}/engines/${engine}/completions`; }, + fineTunedCompletionURL() { + return `${OPEN_AI_URL}/completions`; + }, searchURL(engine) { return `${OPEN_AI_URL}/engines/${engine}/search`; }, diff --git a/index.js b/index.js index f9b0151..3c33a54 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,9 @@ class OpenAI { } complete(opts) { - const url = config.completionURL(opts.engine || DEFAULT_ENGINE); + const url = opts.model + ? config.fineTunedCompletionURL() + : config.completionURL(opts.engine || DEFAULT_ENGINE); delete opts.engine; return this._send_request(url, 'post', opts); diff --git a/package-lock.json b/package-lock.json index 38c94e6..6ff0ba5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,11 @@ { "name": "openai-api", - "version": "1.1.2", + "version": "1.2.6", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "openai-api", - "version": "1.1.2", + "version": "1.2.6", "license": "ISC", "dependencies": { "axios": "^0.21.1",