diff --git a/dist/index.js b/dist/index.js index a6f49664..4e563a51 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6525,21 +6525,28 @@ class TokenLimits { knowledgeCutOff; constructor(model = 'gpt-3.5-turbo') { this.knowledgeCutOff = '2021-09-01'; - if (model === 'gpt-4-32k') { - this.maxTokens = 32600; - this.responseTokens = 4000; - } - else if (model === 'gpt-3.5-turbo-16k') { - this.maxTokens = 16300; - this.responseTokens = 3000; - } - else if (model === 'gpt-4') { - this.maxTokens = 8000; - this.responseTokens = 2000; - } - else { - this.maxTokens = 4000; - this.responseTokens = 1000; + switch (model) { + case 'gpt-4-1106-preview': + this.maxTokens = 128000; + this.responseTokens = 4000; + this.knowledgeCutOff = '2023-04-01'; + break; + case 'gpt-4': + this.maxTokens = 8000; + this.responseTokens = 2000; + break; + case 'gpt-4-32k': + this.maxTokens = 32600; + this.responseTokens = 4000; + break; + case 'gpt-3.5-turbo-16k': + this.maxTokens = 16300; + this.responseTokens = 3000; + break; + default: + this.maxTokens = 4000; + this.responseTokens = 1000; + break; } // provide some margin for the request tokens this.requestTokens = this.maxTokens - this.responseTokens - 100; diff --git a/src/limits.ts b/src/limits.ts index aca807f6..cd95a2ce 100644 --- a/src/limits.ts +++ b/src/limits.ts @@ -6,18 +6,28 @@ export class TokenLimits { constructor(model = 'gpt-3.5-turbo') { this.knowledgeCutOff = '2021-09-01' - if (model === 'gpt-4-32k') { - this.maxTokens = 32600 - this.responseTokens = 4000 - } else if (model === 'gpt-3.5-turbo-16k') { - this.maxTokens = 16300 - this.responseTokens = 3000 - } else if (model === 'gpt-4') { - this.maxTokens = 8000 - this.responseTokens = 2000 - } else { - this.maxTokens = 4000 - this.responseTokens = 1000 + switch (model) { + case 'gpt-4-1106-preview': + this.maxTokens = 128000 + this.responseTokens = 4000 + this.knowledgeCutOff = '2023-04-01' + break + case 'gpt-4': + this.maxTokens = 8000 + this.responseTokens = 2000 + break + case 'gpt-4-32k': + this.maxTokens = 32600 + this.responseTokens = 4000 + break + case 'gpt-3.5-turbo-16k': + this.maxTokens = 16300 + this.responseTokens = 3000 + break + default: + this.maxTokens = 4000 + this.responseTokens = 1000 + break } // provide some margin for the request tokens this.requestTokens = this.maxTokens - this.responseTokens - 100