Merge pull request #540 from alibaba/feat/claude-opus-4-8

feat(llms): add Claude Opus 4.8 support
This commit is contained in:
Simon
2026-06-08 22:27:53 +08:00
committed by GitHub
3 changed files with 20 additions and 2 deletions

View File

@@ -67,6 +67,18 @@ describe('modelPatch', () => {
expect(body).not.toHaveProperty('temperature')
})
it('claude-opus-4-8: drops temperature', () => {
const body = baseBody('claude-opus-4-8')
modelPatch(body)
expect(body).not.toHaveProperty('temperature')
})
it('claude-opus-48 (alt id form): drops temperature', () => {
const body = baseBody('claude-opus-48-20251210')
modelPatch(body)
expect(body).not.toHaveProperty('temperature')
})
it('grok: removes tool_choice and disables reasoning/thinking', () => {
const body = baseBody('grok-4')
modelPatch(body)

View File

@@ -56,8 +56,13 @@ export function modelPatch(body: Record<string, any>) {
// TODO: Claude naming pattern has changed
// needs proper handling
if (modelName.startsWith('claude-opus-4-7') || modelName.startsWith('claude-opus-47')) {
debug('Applying Claude-4.7 patch: remove temperature')
if (
modelName.startsWith('claude-opus-4-7') ||
modelName.startsWith('claude-opus-47') ||
modelName.startsWith('claude-opus-4-8') ||
modelName.startsWith('claude-opus-48')
) {
debug('Applying Claude-4.7/4.8 patch: remove temperature')
delete body.temperature
}
}

View File

@@ -42,6 +42,7 @@ const MODEL_GROUPS: Record<string, string[]> = {
DeepSeek: ['deepseek-v4-pro', 'deepseek-v4-flash', 'deepseek-3.2'],
Google: ['gemini-3.1-flash-lite', 'gemini-3-pro', 'gemini-3-flash', 'gemini-2.5'],
Anthropic: [
'claude-opus-4.8',
'claude-opus-4.7',
'claude-opus-4.6',
'claude-opus-4.5',