Skip to content

Commit

Permalink
Edit api.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
HyeonseoNam committed Mar 16, 2023
1 parent d8a697b commit cb7599d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ export class ChatGPT {
static async callAPI(
prompt: string,
apiKey: string,
model = 'gpt-3.5-turbo',
maxTokens = 100,
temperature = 0.7): Promise<string> {
model = 'text-davinci-003',
maxTokens = 256,
temperature = 0.7,
top_p=1,
frequency_penalty=0,
presence_penalty=0): Promise<string> {


const headers = new Headers({
Expand All @@ -18,8 +21,12 @@ export class ChatGPT {
prompt: prompt,
max_tokens: maxTokens,
n: 1,
// stop: '\n',
stop: null,
temperature: temperature,
top_p: top_p,
frequency_penalty: frequency_penalty,
presence_penalty: presence_penalty
});

const response = await fetch(`${this.baseUrl}/${model}/completions`, {
Expand Down

0 comments on commit cb7599d

Please sign in to comment.