mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-05-13 07:46:47 +00:00
🧮 feat: Add GPT-5.5 Token Definitions (#12973)
* fix: add gpt-5.5 token definitions * fix: align gpt-5.5 context limit
This commit is contained in:
parent
09c8c05c06
commit
56b87f70bd
2 changed files with 43 additions and 0 deletions
|
|
@ -233,6 +233,31 @@ describe('getModelMaxTokens', () => {
|
|||
);
|
||||
});
|
||||
|
||||
test('should return correct tokens for gpt-5.5 matches', () => {
|
||||
expect(maxTokensMap[EModelEndpoint.openAI]['gpt-5.5']).toBe(
|
||||
maxTokensMap[EModelEndpoint.openAI]['gpt-5.5-pro'],
|
||||
);
|
||||
expect(getModelMaxTokens('gpt-5.5')).toBe(maxTokensMap[EModelEndpoint.openAI]['gpt-5.5']);
|
||||
expect(getModelMaxTokens('gpt-5.5-thinking')).toBe(
|
||||
maxTokensMap[EModelEndpoint.openAI]['gpt-5.5'],
|
||||
);
|
||||
expect(getModelMaxTokens('openai/gpt-5.5')).toBe(
|
||||
maxTokensMap[EModelEndpoint.openAI]['gpt-5.5'],
|
||||
);
|
||||
expect(getModelMaxTokens('gpt-5.5-2026-04-23')).toBe(
|
||||
maxTokensMap[EModelEndpoint.openAI]['gpt-5.5'],
|
||||
);
|
||||
});
|
||||
|
||||
test('should return correct tokens for gpt-5.5-pro matches', () => {
|
||||
expect(getModelMaxTokens('gpt-5.5-pro')).toBe(
|
||||
maxTokensMap[EModelEndpoint.openAI]['gpt-5.5-pro'],
|
||||
);
|
||||
expect(getModelMaxTokens('openai/gpt-5.5-pro')).toBe(
|
||||
maxTokensMap[EModelEndpoint.openAI]['gpt-5.5-pro'],
|
||||
);
|
||||
});
|
||||
|
||||
test('should return correct tokens for Anthropic models', () => {
|
||||
const models = [
|
||||
'claude-2.1',
|
||||
|
|
@ -516,6 +541,8 @@ describe('getModelMaxTokens', () => {
|
|||
'gpt-5.3',
|
||||
'gpt-5.4',
|
||||
'gpt-5.4-pro',
|
||||
'gpt-5.5',
|
||||
'gpt-5.5-pro',
|
||||
'gpt-5-mini',
|
||||
'gpt-5-nano',
|
||||
'gpt-5-pro',
|
||||
|
|
@ -567,6 +594,12 @@ describe('findMatchingPattern - longest match wins', () => {
|
|||
);
|
||||
});
|
||||
|
||||
test('should match gpt-5.5-pro over shorter patterns', () => {
|
||||
expect(getModelMaxTokens('gpt-5.5-pro-2026-04-23')).toBe(
|
||||
maxTokensMap[EModelEndpoint.openAI]['gpt-5.5-pro'],
|
||||
);
|
||||
});
|
||||
|
||||
test('should match gpt-5-mini over gpt-5 for mini variants', () => {
|
||||
expect(getModelMaxTokens('gpt-5-mini-chat-2025-01-01')).toBe(
|
||||
maxTokensMap[EModelEndpoint.openAI]['gpt-5-mini'],
|
||||
|
|
@ -831,6 +864,12 @@ describe('matchModelName', () => {
|
|||
expect(matchModelName('gpt-5.4-pro')).toBe('gpt-5.4-pro');
|
||||
});
|
||||
|
||||
it('should return the closest matching key for gpt-5.5 matches', () => {
|
||||
expect(matchModelName('openai/gpt-5.5')).toBe('gpt-5.5');
|
||||
expect(matchModelName('gpt-5.5-thinking')).toBe('gpt-5.5');
|
||||
expect(matchModelName('gpt-5.5-pro')).toBe('gpt-5.5-pro');
|
||||
});
|
||||
|
||||
it('should return the input model name if no match is found - Google models', () => {
|
||||
expect(matchModelName('unknown-google-model', EModelEndpoint.google)).toBe(
|
||||
'unknown-google-model',
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ const openAIModels = {
|
|||
'gpt-5.3': 400000,
|
||||
'gpt-5.4': 272000, // standard context; 1M experimental available via API opt-in (2x rate)
|
||||
'gpt-5.4-pro': 272000, // same window as gpt-5.4
|
||||
'gpt-5.5': 1050000,
|
||||
'gpt-5.5-pro': 1050000,
|
||||
'gpt-5-mini': 400000,
|
||||
'gpt-5-nano': 400000,
|
||||
'gpt-5-pro': 400000,
|
||||
|
|
@ -368,6 +370,8 @@ export const modelMaxOutputs = {
|
|||
'gpt-5.3': 128000,
|
||||
'gpt-5.4': 128000,
|
||||
'gpt-5.4-pro': 128000,
|
||||
'gpt-5.5': 128000,
|
||||
'gpt-5.5-pro': 128000,
|
||||
'gpt-5-mini': 128000,
|
||||
'gpt-5-nano': 128000,
|
||||
'gpt-5-pro': 128000,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue