Skip to content

Commit 80513ae

Browse files
jeanpaulclaude
andauthored
feat(AWS Bedrock Chat Model Node): Add inference profile support (#17807)
Co-authored-by: Claude <[email protected]>
1 parent 1c5a27d commit 80513ae

File tree

1 file changed

+88
-1
lines changed

1 file changed

+88
-1
lines changed

packages/@n8n/nodes-langchain/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.ts

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class LmChatAwsBedrock implements INodeType {
2020
name: 'lmChatAwsBedrock',
2121
icon: 'file:bedrock.svg',
2222
group: ['transform'],
23-
version: 1,
23+
version: [1, 1.1],
2424
description: 'Language Model AWS Bedrock',
2525
defaults: {
2626
name: 'AWS Bedrock Chat Model',
@@ -56,14 +56,45 @@ export class LmChatAwsBedrock implements INodeType {
5656
},
5757
properties: [
5858
getConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiChain]),
59+
{
60+
displayName: 'Model Source',
61+
name: 'modelSource',
62+
type: 'options',
63+
displayOptions: {
64+
show: {
65+
'@version': [{ _cnd: { gte: 1.1 } }],
66+
},
67+
},
68+
options: [
69+
{
70+
name: 'On-Demand Models',
71+
value: 'onDemand',
72+
description: 'Standard foundation models with on-demand pricing',
73+
},
74+
{
75+
name: 'Inference Profiles',
76+
value: 'inferenceProfile',
77+
description:
78+
'Cross-region inference profiles (required for models like Claude Sonnet 4 and others)',
79+
},
80+
],
81+
default: 'onDemand',
82+
description: 'Choose between on-demand foundation models or inference profiles',
83+
},
5984
{
6085
displayName: 'Model',
6186
name: 'model',
6287
type: 'options',
6388
allowArbitraryValues: true, // Hide issues when model name is specified in the expression and does not match any of the options
6489
description:
6590
'The model which will generate the completion. <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/foundation-models.html">Learn more</a>.',
91+
displayOptions: {
92+
hide: {
93+
modelSource: ['inferenceProfile'],
94+
},
95+
},
6696
typeOptions: {
97+
loadOptionsDependsOn: ['modelSource'],
6798
loadOptions: {
6899
routing: {
69100
request: {
@@ -105,6 +136,62 @@ export class LmChatAwsBedrock implements INodeType {
105136
},
106137
default: '',
107138
},
139+
{
140+
displayName: 'Model',
141+
name: 'model',
142+
type: 'options',
143+
allowArbitraryValues: true,
144+
description:
145+
'The inference profile which will generate the completion. <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-use.html">Learn more</a>.',
146+
displayOptions: {
147+
show: {
148+
modelSource: ['inferenceProfile'],
149+
},
150+
},
151+
typeOptions: {
152+
loadOptionsDependsOn: ['modelSource'],
153+
loadOptions: {
154+
routing: {
155+
request: {
156+
method: 'GET',
157+
url: '/inference-profiles?maxResults=1000',
158+
},
159+
output: {
160+
postReceive: [
161+
{
162+
type: 'rootProperty',
163+
properties: {
164+
property: 'inferenceProfileSummaries',
165+
},
166+
},
167+
{
168+
type: 'setKeyValue',
169+
properties: {
170+
name: '={{$responseItem.inferenceProfileName}}',
171+
description:
172+
'={{$responseItem.description || $responseItem.inferenceProfileArn}}',
173+
value: '={{$responseItem.inferenceProfileId}}',
174+
},
175+
},
176+
{
177+
type: 'sort',
178+
properties: {
179+
key: 'name',
180+
},
181+
},
182+
],
183+
},
184+
},
185+
},
186+
},
187+
routing: {
188+
send: {
189+
type: 'body',
190+
property: 'model',
191+
},
192+
},
193+
default: '',
194+
},
108195
{
109196
displayName: 'Options',
110197
name: 'options',

0 commit comments

Comments
 (0)