mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-04 14:57:42 +00:00
🤖 feat: Latest Grok Model Pricing & Context Rates (#10727)
* 🤖 feat: Latest Grok Model Pricing & Context Rates - Introduced 'grok-4-fast', 'grok-4-1-fast', and 'grok-code-fast' models with their respective prompt and completion rates. - Enhanced unit tests to validate prompt and completion rates for the new models, including variations with prefixes. - Updated token limits for the new models in the tokens utility, ensuring accurate handling in tests. * 🔧 refactor: Optimize JSON Export Logic in useExportConversation Hook Updated the export logic to create a Blob from the JSON string before downloading, improving compatibility and performance for file downloads. This change enhances the handling of deeply nested exports while maintaining the file size reduction achieved in previous updates.
This commit is contained in:
parent
2ccaf6be6d
commit
d7ce19e15a
5 changed files with 103 additions and 1 deletions
|
|
@ -778,6 +778,16 @@ describe('Grok Model Tests - Tokens', () => {
|
|||
expect(getModelMaxTokens('grok-4-0709')).toBe(256000);
|
||||
});
|
||||
|
||||
test('should return correct tokens for Grok 4 Fast and Grok 4.1 Fast models', () => {
|
||||
expect(getModelMaxTokens('grok-4-fast')).toBe(2000000);
|
||||
expect(getModelMaxTokens('grok-4-1-fast-reasoning')).toBe(2000000);
|
||||
expect(getModelMaxTokens('grok-4-1-fast-non-reasoning')).toBe(2000000);
|
||||
});
|
||||
|
||||
test('should return correct tokens for Grok Code Fast model', () => {
|
||||
expect(getModelMaxTokens('grok-code-fast-1')).toBe(256000);
|
||||
});
|
||||
|
||||
test('should handle partial matches for Grok models with prefixes', () => {
|
||||
// Vision models should match before general models
|
||||
expect(getModelMaxTokens('xai/grok-2-vision-1212')).toBe(32768);
|
||||
|
|
@ -797,6 +807,12 @@ describe('Grok Model Tests - Tokens', () => {
|
|||
expect(getModelMaxTokens('xai/grok-3-mini-fast')).toBe(131072);
|
||||
// Grok 4 model
|
||||
expect(getModelMaxTokens('xai/grok-4-0709')).toBe(256000);
|
||||
// Grok 4 Fast and 4.1 Fast models
|
||||
expect(getModelMaxTokens('xai/grok-4-fast')).toBe(2000000);
|
||||
expect(getModelMaxTokens('xai/grok-4-1-fast-reasoning')).toBe(2000000);
|
||||
expect(getModelMaxTokens('xai/grok-4-1-fast-non-reasoning')).toBe(2000000);
|
||||
// Grok Code Fast model
|
||||
expect(getModelMaxTokens('xai/grok-code-fast-1')).toBe(256000);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -820,6 +836,12 @@ describe('Grok Model Tests - Tokens', () => {
|
|||
expect(matchModelName('grok-3-mini-fast')).toBe('grok-3-mini-fast');
|
||||
// Grok 4 model
|
||||
expect(matchModelName('grok-4-0709')).toBe('grok-4');
|
||||
// Grok 4 Fast and 4.1 Fast models
|
||||
expect(matchModelName('grok-4-fast')).toBe('grok-4-fast');
|
||||
expect(matchModelName('grok-4-1-fast-reasoning')).toBe('grok-4-1-fast');
|
||||
expect(matchModelName('grok-4-1-fast-non-reasoning')).toBe('grok-4-1-fast');
|
||||
// Grok Code Fast model
|
||||
expect(matchModelName('grok-code-fast-1')).toBe('grok-code-fast');
|
||||
});
|
||||
|
||||
test('should match Grok model variations with prefixes', () => {
|
||||
|
|
@ -841,6 +863,12 @@ describe('Grok Model Tests - Tokens', () => {
|
|||
expect(matchModelName('xai/grok-3-mini-fast')).toBe('grok-3-mini-fast');
|
||||
// Grok 4 model
|
||||
expect(matchModelName('xai/grok-4-0709')).toBe('grok-4');
|
||||
// Grok 4 Fast and 4.1 Fast models
|
||||
expect(matchModelName('xai/grok-4-fast')).toBe('grok-4-fast');
|
||||
expect(matchModelName('xai/grok-4-1-fast-reasoning')).toBe('grok-4-1-fast');
|
||||
expect(matchModelName('xai/grok-4-1-fast-non-reasoning')).toBe('grok-4-1-fast');
|
||||
// Grok Code Fast model
|
||||
expect(matchModelName('xai/grok-code-fast-1')).toBe('grok-code-fast');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue