Skip to content

Commit

Permalink
chore: add max_tokens env var
Browse files Browse the repository at this point in the history
  • Loading branch information
anc95 committed Jun 14, 2023
1 parent 357ab36 commit 1432c3f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ LANGUAGE=
MODEL=
temperature=
top_p=
max_tokens=
TARGET_LABEL=
PROMPT=Below there is a code diff please help me do a code review
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ jobs:
# Optional
LANGUAGE: Chinese
OPENAI_API_ENDPOINT: https://api.openai.com/v1
MODEL:
MODEL: gpt-turbo-3.5-0613
PROMPT:
top_p: 1
temperature: 1
max_tokens: 10000
```
## Self-hosting
Expand Down
3 changes: 3 additions & 0 deletions action/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -148256,6 +148256,9 @@ class Chat {
model: process.env.MODEL || 'gpt-3.5-turbo',
temperature: +(process.env.temperature || 0) || 1,
top_p: +(process.env.top_p || 0) || 1,
max_tokens: process.env.max_tokens
? +process.env.max_tokens
: undefined,
},
});
}
Expand Down
6 changes: 5 additions & 1 deletion src/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ export class Chat {
constructor(apikey: string) {
this.chatAPI = new ChatGPTAPI({
apiKey: apikey,
apiBaseUrl: process.env.OPENAI_API_ENDPOINT || 'https://api.openai.com/v1',
apiBaseUrl:
process.env.OPENAI_API_ENDPOINT || 'https://api.openai.com/v1',
completionParams: {
model: process.env.MODEL || 'gpt-3.5-turbo',
temperature: +(process.env.temperature || 0) || 1,
top_p: +(process.env.top_p || 0) || 1,
max_tokens: process.env.max_tokens
? +process.env.max_tokens
: undefined,
},
});
}
Expand Down

0 comments on commit 1432c3f

Please sign in to comment.