Skip to content

Commit d372aa0

Browse files
authored
Merge pull request #374 from assassinliujie/main
fix the max tokens for gpt-4-turbo 128K
2 parents b4f138d + ea1369c commit d372aa0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

service/src/chatgpt/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ export async function initApi(key: KeyConfig, chatModel: string) {
5454
// Set the token limits based on the model's type. This is because different models have different token limits.
5555
// The token limit includes the token count from both the message array sent and the model response.
5656
// 'gpt-35-turbo' has a limit of 4096 tokens, 'gpt-4' and 'gpt-4-32k' have limits of 8192 and 32768 tokens respectively.
57-
57+
// Check if the model type is GPT-4-turbo
58+
if (model.toLowerCase().includes('1106-preview')) {
59+
//If it's a '1106-preview' model, set the maxModelTokens to 131072
60+
options.maxModelTokens = 131072
61+
options.maxResponseTokens = 32768
62+
}
5863
// Check if the model type includes '16k'
5964
if (model.toLowerCase().includes('16k')) {
6065
// If it's a '16k' model, set the maxModelTokens to 16384 and maxResponseTokens to 4096

0 commit comments

Comments
 (0)