Skip to content

Commit 1432c3f

Browse files
committed
chore: add max_tokens env var
1 parent 357ab36 commit 1432c3f

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ LANGUAGE=
1717
MODEL=
1818
temperature=
1919
top_p=
20+
max_tokens=
2021
TARGET_LABEL=
2122
PROMPT=Below there is a code diff please help me do a code review

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ jobs:
6161
# Optional
6262
LANGUAGE: Chinese
6363
OPENAI_API_ENDPOINT: https://api.openai.com/v1
64-
MODEL:
64+
MODEL: gpt-turbo-3.5-0613
6565
PROMPT:
6666
top_p: 1
6767
temperature: 1
68+
max_tokens: 10000
6869
```
6970
7071
## Self-hosting

action/index.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148256,6 +148256,9 @@ class Chat {
148256148256
model: process.env.MODEL || 'gpt-3.5-turbo',
148257148257
temperature: +(process.env.temperature || 0) || 1,
148258148258
top_p: +(process.env.top_p || 0) || 1,
148259+
max_tokens: process.env.max_tokens
148260+
? +process.env.max_tokens
148261+
: undefined,
148259148262
},
148260148263
});
148261148264
}

src/chat.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ export class Chat {
55
constructor(apikey: string) {
66
this.chatAPI = new ChatGPTAPI({
77
apiKey: apikey,
8-
apiBaseUrl: process.env.OPENAI_API_ENDPOINT || 'https://api.openai.com/v1',
8+
apiBaseUrl:
9+
process.env.OPENAI_API_ENDPOINT || 'https://api.openai.com/v1',
910
completionParams: {
1011
model: process.env.MODEL || 'gpt-3.5-turbo',
1112
temperature: +(process.env.temperature || 0) || 1,
1213
top_p: +(process.env.top_p || 0) || 1,
14+
max_tokens: process.env.max_tokens
15+
? +process.env.max_tokens
16+
: undefined,
1317
},
1418
});
1519
}

0 commit comments

Comments
 (0)