feat(Anthropic Chat Model Node): Add support for Claude 3.5 Sonnet (#9832)

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
oleg 2024-06-21 13:55:37 +02:00 committed by GitHub
parent b5923020d7
commit 2ce97be33e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,7 @@
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
import {
NodeConnectionType,
type INodePropertyOptions,
type INodeProperties,
type IExecuteFunctions,
type INodeType,
@ -23,6 +24,10 @@ const modelField: INodeProperties = {
name: 'Claude 3 Opus(20240229)',
value: 'claude-3-opus-20240229',
},
{
name: 'Claude 3.5 Sonnet(20240620)',
value: 'claude-3-5-sonnet-20240620',
},
{
name: 'Claude 3 Sonnet(20240229)',
value: 'claude-3-sonnet-20240229',
@ -60,7 +65,8 @@ export class LmChatAnthropic implements INodeType {
name: 'lmChatAnthropic',
icon: 'file:anthropic.svg',
group: ['transform'],
version: [1, 1.1],
version: [1, 1.1, 1.2],
defaultVersion: 1.2,
description: 'Language Model Anthropic',
defaults: {
name: 'Anthropic Chat Model',
@ -104,8 +110,20 @@ export class LmChatAnthropic implements INodeType {
...modelField,
default: 'claude-3-sonnet-20240229',
displayOptions: {
hide: {
'@version': [1],
show: {
'@version': [1.1],
},
},
},
{
...modelField,
default: 'claude-3-5-sonnet-20240620',
options: (modelField.options ?? []).filter(
(o): o is INodePropertyOptions => 'name' in o && !o.name.toString().startsWith('LEGACY'),
),
displayOptions: {
show: {
'@version': [{ _cnd: { gte: 1.2 } }],
},
},
},