diff --git a/lib/nl/nl-parser.ts b/lib/nl/nl-parser.ts index 854174a..665ea01 100644 --- a/lib/nl/nl-parser.ts +++ b/lib/nl/nl-parser.ts @@ -83,16 +83,26 @@ export class NlParser { result: string ): Promise { const prompt = this.prompt.response_prompt(nl, parsed, result); - const response = await this.openAiApi.createCompletion({ - model: "gpt-3.5-turbo-instruct", - prompt: prompt, - temperature: 0.7, - max_tokens: 512, + const response = await this.openAiApi.createChatCompletion({ + model: "gpt-4", + temperature: 0, top_p: 1, - frequency_penalty: 0, + n: 1, + stream: false, + max_tokens: 256, presence_penalty: 0, - stop: ["\n", "user:"], + frequency_penalty: 0, + messages: [ + { + role: "system", + content: "only generate one line of response", + }, + { + role: "user", + content: prompt, + }, + ], }); - return await response.data.choices[0]?.text.trim(); + return await response.data.choices[0]?.message.content.trim(); } } diff --git a/package-lock.json b/package-lock.json index eec5f28..c6b5549 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "reactgenie-dsl", - "version": "0.0.53", + "version": "0.0.54", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "reactgenie-dsl", - "version": "0.0.53", + "version": "0.0.54", "license": "Apache-2.0", "dependencies": { "@babel/cli": "^7.23.0", diff --git a/package.json b/package.json index 70df3ee..34645f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "reactgenie-dsl", - "version": "0.0.53", + "version": "0.0.54", "description": "A natural language parser based on a large language model", "scripts": { "prepare": "peggy lib/dsl/parser.pegjs -o lib/dsl/parser.gen.js && tsc",