@@ -59,37 +59,28 @@ export async function initApi(key: KeyConfig, chatModel: string, maxContextCount
59
59
// The token limit includes the token count from both the message array sent and the model response.
60
60
61
61
// Check if the model type is GPT-4-turbo or newer
62
+ if ( model . toLowerCase ( ) . includes ( 'gpt-4o-2024-08-06' ) || model . toLowerCase ( ) . includes ( 'chatgpt-4o-latest' ) ) {
63
+ // 'gpt-4o-2024-08-06'/'chatgpt-4o-latest'
64
+ options . maxModelTokens = 128000
65
+ options . maxResponseTokens = 16384
66
+ }
62
67
if ( model . toLowerCase ( ) . includes ( 'gpt-4o' ) || model . toLowerCase ( ) . includes ( 'gpt-4-turbo' ) || model . toLowerCase ( ) . includes ( '-preview' ) ) {
63
- // If it's a ' gpt-4o'/'gpt-4-turbo'/'xxxx-preview' model, set the maxModelTokens to 128000
68
+ // ' gpt-4o'/'gpt-4-turbo'/'xxxx-preview'
64
69
options . maxModelTokens = 128000
65
70
options . maxResponseTokens = 4096
66
71
}
67
72
else if ( model . toLowerCase ( ) . includes ( 'gpt-4' ) ) {
68
- // If it's a ' gpt-4' model, set the maxModelTokens and maxResponseTokens to 8192 and 2048 respectively
73
+ // ' gpt-4'
69
74
options . maxModelTokens = 8192
70
- options . maxResponseTokens = 2048
75
+ options . maxResponseTokens = 8192
71
76
}
72
- // Check if the model type includes 'gpt-3.5-turbo'
73
- else if ( model . toLowerCase ( ) . includes ( 'gpt-3.5-turbo-instruct' ) || model . toLowerCase ( ) . includes ( 'gpt-3.5-turbo-0613' ) ) {
74
- // If it's a old 'gpt-3.5-turbo' model, set the maxModelTokens to 4096 and maxResponseTokens to 1024
77
+ else if ( model . toLowerCase ( ) . includes ( 'gpt-3.5-turbo-instruct' ) ) {
78
+ // 'gpt-3.5-turbo-instruct'
75
79
options . maxModelTokens = 4096
76
- options . maxResponseTokens = 1024
77
- }
78
- // Check if the model type includes 'gpt-3.5-turbo'
79
- else if ( model . toLowerCase ( ) . includes ( 'gpt-3.5-turbo' ) ) {
80
- // If it's a 'gpt-3.5-turbo' model, set the maxModelTokens to 16385 and maxResponseTokens to 4096
81
- options . maxModelTokens = 16385
82
80
options . maxResponseTokens = 4096
83
81
}
84
- // Check if the model type includes '32k'
85
- else if ( model . toLowerCase ( ) . includes ( '32k' ) ) {
86
- // If it's a '32k' model, set the maxModelTokens to 32768 and maxResponseTokens to 8192
87
- options . maxModelTokens = 32768
88
- options . maxResponseTokens = 8192
89
- }
90
- // Check if the model type includes '16k'
91
- else if ( model . toLowerCase ( ) . includes ( '16k' ) ) {
92
- // If it's a '16k' model, set the maxModelTokens to 16385 and maxResponseTokens to 4096
82
+ else if ( model . toLowerCase ( ) . includes ( 'gpt-3.5-turbo' ) ) {
83
+ // 'gpt-3.5-turbo'
93
84
options . maxModelTokens = 16385
94
85
options . maxResponseTokens = 4096
95
86
}
0 commit comments