Skip to content

Commit

Permalink
feat(Anthropic Chat Model Node): Add support for Claude 3.5 Sonnet (n…
Browse files Browse the repository at this point in the history
…8n-io#9832)

Signed-off-by: Oleg Ivaniv <[email protected]>
  • Loading branch information
OlegIvaniv authored Jun 21, 2024
1 parent b592302 commit 2ce97be
Showing 1 changed file with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
import {
NodeConnectionType,
type INodePropertyOptions,
type INodeProperties,
type IExecuteFunctions,
type INodeType,
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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 } }],
},
},
},
Expand Down

0 comments on commit 2ce97be

Please sign in to comment.