Skip to content

Commit

Permalink
change response generation model to gpt-4
Browse files Browse the repository at this point in the history
  • Loading branch information
valkjsaaa committed Nov 27, 2023
1 parent a090660 commit 89a968d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
26 changes: 18 additions & 8 deletions lib/nl/nl-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,26 @@ export class NlParser {
result: string
): Promise<string | null> {
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();
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 89a968d

Please sign in to comment.