From 1ceb29c708c37e7caf52483f67911cc7f2ae3709 Mon Sep 17 00:00:00 2001 From: Colin Eberhardt Date: Tue, 9 Nov 2021 18:07:28 +0000 Subject: [PATCH] feat: allow the specification of a model for fine tuned completion --- config.js | 3 +++ index.js | 4 +++- package-lock.json | 5 ++--- 3 files changed, 8 insertions(+), 4 deletions(-) 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",