Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit b06f11f

Browse files
committed
support for gpt-4 128k
1 parent 44244a9 commit b06f11f

File tree

2 files changed

+44
-27
lines changed

2 files changed

+44
-27
lines changed

dist/index.js

+22-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/limits.ts

+22-12
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,28 @@ export class TokenLimits {
66

77
constructor(model = 'gpt-3.5-turbo') {
88
this.knowledgeCutOff = '2021-09-01'
9-
if (model === 'gpt-4-32k') {
10-
this.maxTokens = 32600
11-
this.responseTokens = 4000
12-
} else if (model === 'gpt-3.5-turbo-16k') {
13-
this.maxTokens = 16300
14-
this.responseTokens = 3000
15-
} else if (model === 'gpt-4') {
16-
this.maxTokens = 8000
17-
this.responseTokens = 2000
18-
} else {
19-
this.maxTokens = 4000
20-
this.responseTokens = 1000
9+
switch (model) {
10+
case 'gpt-4-1106-preview':
11+
this.maxTokens = 128000
12+
this.responseTokens = 4000
13+
this.knowledgeCutOff = '2023-04-01'
14+
break
15+
case 'gpt-4':
16+
this.maxTokens = 8000
17+
this.responseTokens = 2000
18+
break
19+
case 'gpt-4-32k':
20+
this.maxTokens = 32600
21+
this.responseTokens = 4000
22+
break
23+
case 'gpt-3.5-turbo-16k':
24+
this.maxTokens = 16300
25+
this.responseTokens = 3000
26+
break
27+
default:
28+
this.maxTokens = 4000
29+
this.responseTokens = 1000
30+
break
2131
}
2232
// provide some margin for the request tokens
2333
this.requestTokens = this.maxTokens - this.responseTokens - 100

0 commit comments

Comments
 (0)