mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-15 12:16:33 +01:00
🤖 feat: Claude Sonnet 4.6 support (#11829)
Some checks are pending
Docker Dev Images Build / build (Dockerfile, librechat-dev, node) (push) Waiting to run
Docker Dev Images Build / build (Dockerfile.multi, librechat-dev-api, api-build) (push) Waiting to run
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
Some checks are pending
Docker Dev Images Build / build (Dockerfile, librechat-dev, node) (push) Waiting to run
Docker Dev Images Build / build (Dockerfile.multi, librechat-dev-api, api-build) (push) Waiting to run
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
* 🤖 feat: Claude Sonnet 4.6 support
- Updated .env.example to include claude-sonnet-4-6 in the list of available models.
- Enhanced token value assignments in api/models/tx.js and packages/api/src/utils/tokens.ts to accommodate claude-sonnet-4-6.
- Added tests in packages/data-provider/specs/bedrock.spec.ts to verify support for claude-sonnet-4-6 in adaptive thinking and context-1m functionalities.
- Modified bedrock.ts to correctly parse and identify the version of claude-sonnet-4-6 for adaptive thinking checks.
- Included claude-sonnet-4-6 in sharedAnthropicModels and bedrockModels for consistent model availability.
* chore: additional Claude Sonnet 4.6 tests
- Added unit tests for Claude Sonnet 4.6 in `tokens.spec.js` to verify context length and max output tokens.
- Updated `helpers.ts` documentation to reflect adaptive thinking support for Sonnet 4.6.
- Enhanced `llm.spec.ts` with tests for context headers and adaptive thinking configurations for Claude Sonnet 4.6.
- Improved `bedrock.spec.ts` to ensure correct parsing and handling of Claude Sonnet 4.6 model variations with adaptive thinking.
This commit is contained in:
parent
e710a12bfb
commit
0697e8cd60
9 changed files with 218 additions and 16 deletions
|
|
@ -46,6 +46,30 @@ describe('supportsAdaptiveThinking', () => {
|
|||
expect(supportsAdaptiveThinking('claude-opus-4-0')).toBe(false);
|
||||
});
|
||||
|
||||
test('should return true for claude-sonnet-4-6', () => {
|
||||
expect(supportsAdaptiveThinking('claude-sonnet-4-6')).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true for claude-sonnet-4.6', () => {
|
||||
expect(supportsAdaptiveThinking('claude-sonnet-4.6')).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true for claude-sonnet-4-7 (future)', () => {
|
||||
expect(supportsAdaptiveThinking('claude-sonnet-4-7')).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true for anthropic.claude-sonnet-4-6 (Bedrock)', () => {
|
||||
expect(supportsAdaptiveThinking('anthropic.claude-sonnet-4-6')).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true for us.anthropic.claude-sonnet-4-6 (cross-region Bedrock)', () => {
|
||||
expect(supportsAdaptiveThinking('us.anthropic.claude-sonnet-4-6')).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true for claude-4-6-sonnet (alternate naming)', () => {
|
||||
expect(supportsAdaptiveThinking('claude-4-6-sonnet')).toBe(true);
|
||||
});
|
||||
|
||||
test('should return false for claude-sonnet-4-5', () => {
|
||||
expect(supportsAdaptiveThinking('claude-sonnet-4-5')).toBe(false);
|
||||
});
|
||||
|
|
@ -104,6 +128,14 @@ describe('supportsContext1m', () => {
|
|||
expect(supportsContext1m('claude-sonnet-4-5')).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true for claude-sonnet-4-6', () => {
|
||||
expect(supportsContext1m('claude-sonnet-4-6')).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true for anthropic.claude-sonnet-4-6 (Bedrock)', () => {
|
||||
expect(supportsContext1m('anthropic.claude-sonnet-4-6')).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true for claude-sonnet-5 (future)', () => {
|
||||
expect(supportsContext1m('claude-sonnet-5')).toBe(true);
|
||||
});
|
||||
|
|
@ -237,14 +269,42 @@ describe('bedrockInputParser', () => {
|
|||
]);
|
||||
});
|
||||
|
||||
test('should match anthropic.claude-4-7-sonnet model with 1M context header', () => {
|
||||
test('should match anthropic.claude-sonnet-4-6 with adaptive thinking and 1M context header', () => {
|
||||
const input = {
|
||||
model: 'anthropic.claude-sonnet-4-6',
|
||||
};
|
||||
const result = bedrockInputParser.parse(input) as Record<string, unknown>;
|
||||
const additionalFields = result.additionalModelRequestFields as Record<string, unknown>;
|
||||
expect(additionalFields.thinking).toEqual({ type: 'adaptive' });
|
||||
expect(additionalFields.thinkingBudget).toBeUndefined();
|
||||
expect(additionalFields.anthropic_beta).toEqual([
|
||||
'output-128k-2025-02-19',
|
||||
'context-1m-2025-08-07',
|
||||
]);
|
||||
});
|
||||
|
||||
test('should match us.anthropic.claude-sonnet-4-6 with adaptive thinking and 1M context header', () => {
|
||||
const input = {
|
||||
model: 'us.anthropic.claude-sonnet-4-6',
|
||||
};
|
||||
const result = bedrockInputParser.parse(input) as Record<string, unknown>;
|
||||
const additionalFields = result.additionalModelRequestFields as Record<string, unknown>;
|
||||
expect(additionalFields.thinking).toEqual({ type: 'adaptive' });
|
||||
expect(additionalFields.thinkingBudget).toBeUndefined();
|
||||
expect(additionalFields.anthropic_beta).toEqual([
|
||||
'output-128k-2025-02-19',
|
||||
'context-1m-2025-08-07',
|
||||
]);
|
||||
});
|
||||
|
||||
test('should match anthropic.claude-4-7-sonnet model with adaptive thinking and 1M context header', () => {
|
||||
const input = {
|
||||
model: 'anthropic.claude-4-7-sonnet',
|
||||
};
|
||||
const result = bedrockInputParser.parse(input) as Record<string, unknown>;
|
||||
const additionalFields = result.additionalModelRequestFields as Record<string, unknown>;
|
||||
expect(additionalFields.thinking).toBe(true);
|
||||
expect(additionalFields.thinkingBudget).toBe(2000);
|
||||
expect(additionalFields.thinking).toEqual({ type: 'adaptive' });
|
||||
expect(additionalFields.thinkingBudget).toBeUndefined();
|
||||
expect(additionalFields.anthropic_beta).toEqual([
|
||||
'output-128k-2025-02-19',
|
||||
'context-1m-2025-08-07',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue