@n8n/n8n-nodes-langchain 1.118.1 → 1.119.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,10 +21,13 @@ __export(EmbeddingsAwsBedrock_node_exports, {
21
21
  EmbeddingsAwsBedrock: () => EmbeddingsAwsBedrock
22
22
  });
23
23
  module.exports = __toCommonJS(EmbeddingsAwsBedrock_node_exports);
24
+ var import_client_bedrock_runtime = require("@aws-sdk/client-bedrock-runtime");
24
25
  var import_aws = require("@langchain/aws");
25
- var import_n8n_workflow = require("n8n-workflow");
26
+ var import_node_http_handler = require("@smithy/node-http-handler");
27
+ var import_httpProxyAgent = require("../../../utils/httpProxyAgent");
26
28
  var import_logWrapper = require("../../../utils/logWrapper");
27
29
  var import_sharedFields = require("../../../utils/sharedFields");
30
+ var import_n8n_workflow = require("n8n-workflow");
28
31
  class EmbeddingsAwsBedrock {
29
32
  constructor() {
30
33
  this.description = {
@@ -118,15 +121,27 @@ class EmbeddingsAwsBedrock {
118
121
  async supplyData(itemIndex) {
119
122
  const credentials = await this.getCredentials("aws");
120
123
  const modelName = this.getNodeParameter("model", itemIndex);
121
- const embeddings = new import_aws.BedrockEmbeddings({
124
+ const clientConfig = {
122
125
  region: credentials.region,
123
- model: modelName,
124
- maxRetries: 3,
125
126
  credentials: {
126
127
  secretAccessKey: credentials.secretAccessKey,
127
128
  accessKeyId: credentials.accessKeyId,
128
129
  sessionToken: credentials.sessionToken
129
130
  }
131
+ };
132
+ const proxyAgent = (0, import_httpProxyAgent.getNodeProxyAgent)();
133
+ if (proxyAgent) {
134
+ clientConfig.requestHandler = new import_node_http_handler.NodeHttpHandler({
135
+ httpAgent: proxyAgent,
136
+ httpsAgent: proxyAgent
137
+ });
138
+ }
139
+ const client = new import_client_bedrock_runtime.BedrockRuntimeClient(clientConfig);
140
+ const embeddings = new import_aws.BedrockEmbeddings({
141
+ client,
142
+ model: modelName,
143
+ maxRetries: 3,
144
+ region: credentials.region
130
145
  });
131
146
  return {
132
147
  response: (0, import_logWrapper.logWrapper)(embeddings, this)
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/embeddings/EmbeddingsAwsBedrock/EmbeddingsAwsBedrock.node.ts"],"sourcesContent":["import { BedrockEmbeddings } from '@langchain/aws';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport { logWrapper } from '@utils/logWrapper';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nexport class EmbeddingsAwsBedrock implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Embeddings AWS Bedrock',\n\t\tname: 'embeddingsAwsBedrock',\n\t\ticon: 'file:bedrock.svg',\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'aws',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tdescription: 'Use Embeddings AWS Bedrock',\n\t\tdefaults: {\n\t\t\tname: 'Embeddings AWS Bedrock',\n\t\t},\n\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Embeddings'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.embeddingsawsbedrock/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\n\t\tinputs: [],\n\n\t\toutputs: [NodeConnectionTypes.AiEmbedding],\n\t\toutputNames: ['Embeddings'],\n\t\trequestDefaults: {\n\t\t\tignoreHttpStatusErrors: true,\n\t\t\tbaseURL: '=https://bedrock.{{$credentials?.region ?? \"eu-central-1\"}}.amazonaws.com',\n\t\t},\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiVectorStore]),\n\t\t\t{\n\t\t\t\tdisplayName: 'Model',\n\t\t\t\tname: 'model',\n\t\t\t\ttype: 'options',\n\t\t\t\tdescription:\n\t\t\t\t\t'The model which will generate the completion. <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/foundation-models.html\">Learn more</a>.',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tloadOptions: {\n\t\t\t\t\t\trouting: {\n\t\t\t\t\t\t\trequest: {\n\t\t\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\t\t\turl: '/foundation-models?byInferenceType=ON_DEMAND&byOutputModality=EMBEDDING',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\toutput: {\n\t\t\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'rootProperty',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tproperty: 'modelSummaries',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'setKeyValue',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tname: '={{$responseItem.modelName}}',\n\t\t\t\t\t\t\t\t\t\t\tdescription: '={{$responseItem.modelArn}}',\n\t\t\t\t\t\t\t\t\t\t\tvalue: '={{$responseItem.modelId}}',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'sort',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tkey: 'name',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trouting: {\n\t\t\t\t\tsend: {\n\t\t\t\t\t\ttype: 'body',\n\t\t\t\t\t\tproperty: 'model',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst credentials = await this.getCredentials('aws');\n\t\tconst modelName = this.getNodeParameter('model', itemIndex) as string;\n\n\t\tconst embeddings = new BedrockEmbeddings({\n\t\t\tregion: credentials.region as string,\n\t\t\tmodel: modelName,\n\t\t\tmaxRetries: 3,\n\t\t\tcredentials: {\n\t\t\t\tsecretAccessKey: credentials.secretAccessKey as string,\n\t\t\t\taccessKeyId: credentials.accessKeyId as string,\n\t\t\t\tsessionToken: credentials.sessionToken as string,\n\t\t\t},\n\t\t});\n\n\t\treturn {\n\t\t\tresponse: logWrapper(embeddings, this),\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkC;AAClC,0BAMO;AAEP,wBAA2B;AAC3B,0BAA6C;AAEtC,MAAM,qBAA0C;AAAA,EAAhD;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,UACN,UAAU;AAAA,QACX;AAAA,MACD;AAAA,MACA,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MAEA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,YAAY;AAAA,QAClB;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;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,YAAY;AAAA,QAC7B,aAAa,YAAY;AAAA,QACzB,cAAc,YAAY;AAAA,MAC3B;AAAA,IACD,CAAC;AAED,WAAO;AAAA,MACN,cAAU,8BAAW,YAAY,IAAI;AAAA,IACtC;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../../nodes/embeddings/EmbeddingsAwsBedrock/EmbeddingsAwsBedrock.node.ts"],"sourcesContent":["import type { BedrockRuntimeClientConfig } from '@aws-sdk/client-bedrock-runtime';\nimport { BedrockRuntimeClient } from '@aws-sdk/client-bedrock-runtime';\nimport { BedrockEmbeddings } from '@langchain/aws';\nimport { NodeHttpHandler } from '@smithy/node-http-handler';\nimport { getNodeProxyAgent } from '@utils/httpProxyAgent';\nimport { logWrapper } from '@utils/logWrapper';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nexport class EmbeddingsAwsBedrock implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Embeddings AWS Bedrock',\n\t\tname: 'embeddingsAwsBedrock',\n\t\ticon: 'file:bedrock.svg',\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'aws',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tdescription: 'Use Embeddings AWS Bedrock',\n\t\tdefaults: {\n\t\t\tname: 'Embeddings AWS Bedrock',\n\t\t},\n\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Embeddings'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.embeddingsawsbedrock/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\n\t\tinputs: [],\n\n\t\toutputs: [NodeConnectionTypes.AiEmbedding],\n\t\toutputNames: ['Embeddings'],\n\t\trequestDefaults: {\n\t\t\tignoreHttpStatusErrors: true,\n\t\t\tbaseURL: '=https://bedrock.{{$credentials?.region ?? \"eu-central-1\"}}.amazonaws.com',\n\t\t},\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiVectorStore]),\n\t\t\t{\n\t\t\t\tdisplayName: 'Model',\n\t\t\t\tname: 'model',\n\t\t\t\ttype: 'options',\n\t\t\t\tdescription:\n\t\t\t\t\t'The model which will generate the completion. <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/foundation-models.html\">Learn more</a>.',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tloadOptions: {\n\t\t\t\t\t\trouting: {\n\t\t\t\t\t\t\trequest: {\n\t\t\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\t\t\turl: '/foundation-models?byInferenceType=ON_DEMAND&byOutputModality=EMBEDDING',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\toutput: {\n\t\t\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'rootProperty',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tproperty: 'modelSummaries',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'setKeyValue',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tname: '={{$responseItem.modelName}}',\n\t\t\t\t\t\t\t\t\t\t\tdescription: '={{$responseItem.modelArn}}',\n\t\t\t\t\t\t\t\t\t\t\tvalue: '={{$responseItem.modelId}}',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'sort',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tkey: 'name',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trouting: {\n\t\t\t\t\tsend: {\n\t\t\t\t\t\ttype: 'body',\n\t\t\t\t\t\tproperty: 'model',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst credentials = await this.getCredentials<{\n\t\t\tregion: string;\n\t\t\tsecretAccessKey: string;\n\t\t\taccessKeyId: string;\n\t\t\tsessionToken: string;\n\t\t}>('aws');\n\t\tconst modelName = this.getNodeParameter('model', itemIndex) as string;\n\n\t\tconst clientConfig: BedrockRuntimeClientConfig = {\n\t\t\tregion: credentials.region,\n\t\t\tcredentials: {\n\t\t\t\tsecretAccessKey: credentials.secretAccessKey,\n\t\t\t\taccessKeyId: credentials.accessKeyId,\n\t\t\t\tsessionToken: credentials.sessionToken,\n\t\t\t},\n\t\t};\n\n\t\tconst proxyAgent = getNodeProxyAgent();\n\t\tif (proxyAgent) {\n\t\t\tclientConfig.requestHandler = new NodeHttpHandler({\n\t\t\t\thttpAgent: proxyAgent,\n\t\t\t\thttpsAgent: proxyAgent,\n\t\t\t});\n\t\t}\n\n\t\tconst client = new BedrockRuntimeClient(clientConfig);\n\t\tconst embeddings = new BedrockEmbeddings({\n\t\t\tclient,\n\t\t\tmodel: modelName,\n\t\t\tmaxRetries: 3,\n\t\t\tregion: credentials.region,\n\t\t});\n\n\t\treturn {\n\t\t\tresponse: logWrapper(embeddings, this),\n\t\t};\n\t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,oBACA;AAAA,sBACC,MAAM;AAAA,sBACN,YAAY;AAAA,wBACX,MAAM;AAAA,wBACN,aAAa;AAAA,wBACb,OAAO;AAAA,sBACR;AAAA,oBACD;AAAA,oBACA;AAAA,sBACC,MAAM;AAAA,sBACN,YAAY;AAAA,wBACX,KAAK;AAAA,sBACN;AAAA,oBACD;AAAA,kBACD;AAAA,gBACD;AAAA,cACD;AAAA,YACD;AAAA,UACD;AAAA,UACA,SAAS;AAAA,YACR,MAAM;AAAA,cACL,MAAM;AAAA,cACN,UAAU;AAAA,YACX;AAAA,UACD;AAAA,UACA,SAAS;AAAA,QACV;AAAA,MACD;AAAA,IACD;AAAA;AAAA,EAEA,MAAM,WAAuC,WAAwC;AACpF,UAAM,cAAc,MAAM,KAAK,eAK5B,KAAK;AACR,UAAM,YAAY,KAAK,iBAAiB,SAAS,SAAS;AAE1D,UAAM,eAA2C;AAAA,MAChD,QAAQ,YAAY;AAAA,MACpB,aAAa;AAAA,QACZ,iBAAiB,YAAY;AAAA,QAC7B,aAAa,YAAY;AAAA,QACzB,cAAc,YAAY;AAAA,MAC3B;AAAA,IACD;AAEA,UAAM,iBAAa,yCAAkB;AACrC,QAAI,YAAY;AACf,mBAAa,iBAAiB,IAAI,yCAAgB;AAAA,QACjD,WAAW;AAAA,QACX,YAAY;AAAA,MACb,CAAC;AAAA,IACF;AAEA,UAAM,SAAS,IAAI,mDAAqB,YAAY;AACpD,UAAM,aAAa,IAAI,6BAAkB;AAAA,MACxC;AAAA,MACA,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,QAAQ,YAAY;AAAA,IACrB,CAAC;AAED,WAAO;AAAA,MACN,cAAU,8BAAW,YAAY,IAAI;AAAA,IACtC;AAAA,EACD;AACD;","names":[]}
@@ -21,10 +21,12 @@ __export(LmChatAwsBedrock_node_exports, {
21
21
  LmChatAwsBedrock: () => LmChatAwsBedrock
22
22
  });
23
23
  module.exports = __toCommonJS(LmChatAwsBedrock_node_exports);
24
+ var import_client_bedrock_runtime = require("@aws-sdk/client-bedrock-runtime");
24
25
  var import_aws = require("@langchain/aws");
25
- var import_n8n_workflow = require("n8n-workflow");
26
+ var import_node_http_handler = require("@smithy/node-http-handler");
26
27
  var import_httpProxyAgent = require("../../../utils/httpProxyAgent");
27
28
  var import_sharedFields = require("../../../utils/sharedFields");
29
+ var import_n8n_workflow = require("n8n-workflow");
28
30
  var import_n8nLlmFailedAttemptHandler = require("../n8nLlmFailedAttemptHandler");
29
31
  var import_N8nLlmTracing = require("../N8nLlmTracing");
30
32
  class LmChatAwsBedrock {
@@ -233,19 +235,28 @@ class LmChatAwsBedrock {
233
235
  const credentials = await this.getCredentials("aws");
234
236
  const modelName = this.getNodeParameter("model", itemIndex);
235
237
  const options = this.getNodeParameter("options", itemIndex, {});
236
- const model = new import_aws.ChatBedrockConverse({
238
+ const proxyAgent = (0, import_httpProxyAgent.getNodeProxyAgent)();
239
+ const clientConfig = {
237
240
  region: credentials.region,
238
- model: modelName,
239
- temperature: options.temperature,
240
- maxTokens: options.maxTokensToSample,
241
- clientConfig: {
242
- httpAgent: (0, import_httpProxyAgent.getProxyAgent)()
243
- },
244
241
  credentials: {
245
242
  secretAccessKey: credentials.secretAccessKey,
246
243
  accessKeyId: credentials.accessKeyId,
247
- sessionToken: credentials.sessionToken
248
- },
244
+ ...credentials.sessionToken && { sessionToken: credentials.sessionToken }
245
+ }
246
+ };
247
+ if (proxyAgent) {
248
+ clientConfig.requestHandler = new import_node_http_handler.NodeHttpHandler({
249
+ httpAgent: proxyAgent,
250
+ httpsAgent: proxyAgent
251
+ });
252
+ }
253
+ const client = new import_client_bedrock_runtime.BedrockRuntimeClient(clientConfig);
254
+ const model = new import_aws.ChatBedrockConverse({
255
+ client,
256
+ model: modelName,
257
+ region: credentials.region,
258
+ temperature: options.temperature,
259
+ maxTokens: options.maxTokensToSample,
249
260
  callbacks: [new import_N8nLlmTracing.N8nLlmTracing(this)],
250
261
  onFailedAttempt: (0, import_n8nLlmFailedAttemptHandler.makeN8nLlmFailedAttemptHandler)(this)
251
262
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.ts"],"sourcesContent":["import { ChatBedrockConverse } from '@langchain/aws';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport { getProxyAgent } from '@utils/httpProxyAgent';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\n\nimport { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';\nimport { N8nLlmTracing } from '../N8nLlmTracing';\n\nexport class LmChatAwsBedrock implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'AWS Bedrock Chat Model',\n\n\t\tname: 'lmChatAwsBedrock',\n\t\ticon: 'file:bedrock.svg',\n\t\tgroup: ['transform'],\n\t\tversion: [1, 1.1],\n\t\tdescription: 'Language Model AWS Bedrock',\n\t\tdefaults: {\n\t\t\tname: 'AWS Bedrock Chat Model',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Language Models', 'Root Nodes'],\n\t\t\t\t'Language Models': ['Chat Models (Recommended)'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatawsbedrock/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\n\t\tinputs: [],\n\n\t\toutputs: [NodeConnectionTypes.AiLanguageModel],\n\t\toutputNames: ['Model'],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'aws',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\trequestDefaults: {\n\t\t\tignoreHttpStatusErrors: true,\n\t\t\tbaseURL: '=https://bedrock.{{$credentials?.region ?? \"eu-central-1\"}}.amazonaws.com',\n\t\t},\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiChain]),\n\t\t\t{\n\t\t\t\tdisplayName: 'Model Source',\n\t\t\t\tname: 'modelSource',\n\t\t\t\ttype: 'options',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.1 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'On-Demand Models',\n\t\t\t\t\t\tvalue: 'onDemand',\n\t\t\t\t\t\tdescription: 'Standard foundation models with on-demand pricing',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Inference Profiles',\n\t\t\t\t\t\tvalue: 'inferenceProfile',\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Cross-region inference profiles (required for models like Claude Sonnet 4 and others)',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'onDemand',\n\t\t\t\tdescription: 'Choose between on-demand foundation models or inference profiles',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Model',\n\t\t\t\tname: 'model',\n\t\t\t\ttype: 'options',\n\t\t\t\tallowArbitraryValues: true, // Hide issues when model name is specified in the expression and does not match any of the options\n\t\t\t\tdescription:\n\t\t\t\t\t'The model which will generate the completion. <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/foundation-models.html\">Learn more</a>.',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\thide: {\n\t\t\t\t\t\tmodelSource: ['inferenceProfile'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tloadOptionsDependsOn: ['modelSource'],\n\t\t\t\t\tloadOptions: {\n\t\t\t\t\t\trouting: {\n\t\t\t\t\t\t\trequest: {\n\t\t\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\t\t\turl: '/foundation-models?&byOutputModality=TEXT&byInferenceType=ON_DEMAND',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\toutput: {\n\t\t\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'rootProperty',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tproperty: 'modelSummaries',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'setKeyValue',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tname: '={{$responseItem.modelName}}',\n\t\t\t\t\t\t\t\t\t\t\tdescription: '={{$responseItem.modelArn}}',\n\t\t\t\t\t\t\t\t\t\t\tvalue: '={{$responseItem.modelId}}',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'sort',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tkey: 'name',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trouting: {\n\t\t\t\t\tsend: {\n\t\t\t\t\t\ttype: 'body',\n\t\t\t\t\t\tproperty: 'model',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Model',\n\t\t\t\tname: 'model',\n\t\t\t\ttype: 'options',\n\t\t\t\tallowArbitraryValues: true,\n\t\t\t\tdescription:\n\t\t\t\t\t'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>.',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmodelSource: ['inferenceProfile'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tloadOptionsDependsOn: ['modelSource'],\n\t\t\t\t\tloadOptions: {\n\t\t\t\t\t\trouting: {\n\t\t\t\t\t\t\trequest: {\n\t\t\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\t\t\turl: '/inference-profiles?maxResults=1000',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\toutput: {\n\t\t\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'rootProperty',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tproperty: 'inferenceProfileSummaries',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'setKeyValue',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tname: '={{$responseItem.inferenceProfileName}}',\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'={{$responseItem.description || $responseItem.inferenceProfileArn}}',\n\t\t\t\t\t\t\t\t\t\t\tvalue: '={{$responseItem.inferenceProfileId}}',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'sort',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tkey: 'name',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trouting: {\n\t\t\t\t\tsend: {\n\t\t\t\t\t\ttype: 'body',\n\t\t\t\t\t\tproperty: 'model',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\tplaceholder: 'Add Option',\n\t\t\t\tdescription: 'Additional options to add',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Maximum Number of Tokens',\n\t\t\t\t\t\tname: 'maxTokensToSample',\n\t\t\t\t\t\tdefault: 2000,\n\t\t\t\t\t\tdescription: 'The maximum number of tokens to generate in the completion',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Sampling Temperature',\n\t\t\t\t\t\tname: 'temperature',\n\t\t\t\t\t\tdefault: 0.7,\n\t\t\t\t\t\ttypeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive.',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst credentials = await this.getCredentials('aws');\n\t\tconst modelName = this.getNodeParameter('model', itemIndex) as string;\n\t\tconst options = this.getNodeParameter('options', itemIndex, {}) as {\n\t\t\ttemperature: number;\n\t\t\tmaxTokensToSample: number;\n\t\t};\n\n\t\tconst model = new ChatBedrockConverse({\n\t\t\tregion: credentials.region as string,\n\t\t\tmodel: modelName,\n\t\t\ttemperature: options.temperature,\n\t\t\tmaxTokens: options.maxTokensToSample,\n\t\t\tclientConfig: {\n\t\t\t\thttpAgent: getProxyAgent(),\n\t\t\t},\n\t\t\tcredentials: {\n\t\t\t\tsecretAccessKey: credentials.secretAccessKey as string,\n\t\t\t\taccessKeyId: credentials.accessKeyId as string,\n\t\t\t\tsessionToken: credentials.sessionToken as string,\n\t\t\t},\n\t\t\tcallbacks: [new N8nLlmTracing(this)],\n\t\t\tonFailedAttempt: makeN8nLlmFailedAttemptHandler(this),\n\t\t});\n\n\t\treturn {\n\t\t\tresponse: model,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoC;AACpC,0BAMO;AAEP,4BAA8B;AAC9B,0BAA6C;AAE7C,wCAA+C;AAC/C,2BAA8B;AAEvB,MAAM,iBAAsC;AAAA,EAA5C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MAEb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS,CAAC,GAAG,GAAG;AAAA,MAChB,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,mBAAmB,YAAY;AAAA,UACpC,mBAAmB,CAAC,2BAA2B;AAAA,QAChD;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MAEA,QAAQ,CAAC;AAAA,MAET,SAAS,CAAC,wCAAoB,eAAe;AAAA,MAC7C,aAAa,CAAC,OAAO;AAAA,MACrB,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,UACN,UAAU;AAAA,QACX;AAAA,MACD;AAAA,MACA,iBAAiB;AAAA,QAChB,wBAAwB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AA,YACP;AAAA,YACA;AAAA,cACC,aAAa;AAAA,cACb,MAAM;AAAA,cACN,SAAS;AAAA,cACT,aAAa,EAAE,UAAU,GAAG,UAAU,GAAG,iBAAiB,EAAE;AAAA,cAC5D,aACC;AAAA,cACD,MAAM;AAAA,YACP;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA;AAAA,EAEA,MAAM,WAAuC,WAAwC;AACpF,UAAM,cAAc,MAAM,KAAK,eAAe,KAAK;AACnD,UAAM,YAAY,KAAK,iBAAiB,SAAS,SAAS;AAC1D,UAAM,UAAU,KAAK,iBAAiB,WAAW,WAAW,CAAC,CAAC;AAK9D,UAAM,QAAQ,IAAI,+BAAoB;AAAA,MACrC,QAAQ,YAAY;AAAA,MACpB,OAAO;AAAA,MACP,aAAa,QAAQ;AAAA,MACrB,WAAW,QAAQ;AAAA,MACnB,cAAc;AAAA,QACb,eAAW,qCAAc;AAAA,MAC1B;AAAA,MACA,aAAa;AAAA,QACZ,iBAAiB,YAAY;AAAA,QAC7B,aAAa,YAAY;AAAA,QACzB,cAAc,YAAY;AAAA,MAC3B;AAAA,MACA,WAAW,CAAC,IAAI,mCAAc,IAAI,CAAC;AAAA,MACnC,qBAAiB,kEAA+B,IAAI;AAAA,IACrD,CAAC;AAED,WAAO;AAAA,MACN,UAAU;AAAA,IACX;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../../nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.ts"],"sourcesContent":["import type { BedrockRuntimeClientConfig } from '@aws-sdk/client-bedrock-runtime';\nimport { BedrockRuntimeClient } from '@aws-sdk/client-bedrock-runtime';\nimport { ChatBedrockConverse } from '@langchain/aws';\nimport { NodeHttpHandler } from '@smithy/node-http-handler';\nimport { getNodeProxyAgent } from '@utils/httpProxyAgent';\nimport { getConnectionHintNoticeField } from '@utils/sharedFields';\nimport {\n\tNodeConnectionTypes,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ISupplyDataFunctions,\n\ttype SupplyData,\n} from 'n8n-workflow';\n\nimport { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';\nimport { N8nLlmTracing } from '../N8nLlmTracing';\n\nexport class LmChatAwsBedrock implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'AWS Bedrock Chat Model',\n\n\t\tname: 'lmChatAwsBedrock',\n\t\ticon: 'file:bedrock.svg',\n\t\tgroup: ['transform'],\n\t\tversion: [1, 1.1],\n\t\tdescription: 'Language Model AWS Bedrock',\n\t\tdefaults: {\n\t\t\tname: 'AWS Bedrock Chat Model',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['AI'],\n\t\t\tsubcategories: {\n\t\t\t\tAI: ['Language Models', 'Root Nodes'],\n\t\t\t\t'Language Models': ['Chat Models (Recommended)'],\n\t\t\t},\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatawsbedrock/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\n\t\tinputs: [],\n\n\t\toutputs: [NodeConnectionTypes.AiLanguageModel],\n\t\toutputNames: ['Model'],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'aws',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\trequestDefaults: {\n\t\t\tignoreHttpStatusErrors: true,\n\t\t\tbaseURL: '=https://bedrock.{{$credentials?.region ?? \"eu-central-1\"}}.amazonaws.com',\n\t\t},\n\t\tproperties: [\n\t\t\tgetConnectionHintNoticeField([NodeConnectionTypes.AiChain, NodeConnectionTypes.AiChain]),\n\t\t\t{\n\t\t\t\tdisplayName: 'Model Source',\n\t\t\t\tname: 'modelSource',\n\t\t\t\ttype: 'options',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.1 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'On-Demand Models',\n\t\t\t\t\t\tvalue: 'onDemand',\n\t\t\t\t\t\tdescription: 'Standard foundation models with on-demand pricing',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Inference Profiles',\n\t\t\t\t\t\tvalue: 'inferenceProfile',\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Cross-region inference profiles (required for models like Claude Sonnet 4 and others)',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'onDemand',\n\t\t\t\tdescription: 'Choose between on-demand foundation models or inference profiles',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Model',\n\t\t\t\tname: 'model',\n\t\t\t\ttype: 'options',\n\t\t\t\tallowArbitraryValues: true, // Hide issues when model name is specified in the expression and does not match any of the options\n\t\t\t\tdescription:\n\t\t\t\t\t'The model which will generate the completion. <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/foundation-models.html\">Learn more</a>.',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\thide: {\n\t\t\t\t\t\tmodelSource: ['inferenceProfile'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tloadOptionsDependsOn: ['modelSource'],\n\t\t\t\t\tloadOptions: {\n\t\t\t\t\t\trouting: {\n\t\t\t\t\t\t\trequest: {\n\t\t\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\t\t\turl: '/foundation-models?&byOutputModality=TEXT&byInferenceType=ON_DEMAND',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\toutput: {\n\t\t\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'rootProperty',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tproperty: 'modelSummaries',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'setKeyValue',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tname: '={{$responseItem.modelName}}',\n\t\t\t\t\t\t\t\t\t\t\tdescription: '={{$responseItem.modelArn}}',\n\t\t\t\t\t\t\t\t\t\t\tvalue: '={{$responseItem.modelId}}',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'sort',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tkey: 'name',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trouting: {\n\t\t\t\t\tsend: {\n\t\t\t\t\t\ttype: 'body',\n\t\t\t\t\t\tproperty: 'model',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Model',\n\t\t\t\tname: 'model',\n\t\t\t\ttype: 'options',\n\t\t\t\tallowArbitraryValues: true,\n\t\t\t\tdescription:\n\t\t\t\t\t'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>.',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmodelSource: ['inferenceProfile'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tloadOptionsDependsOn: ['modelSource'],\n\t\t\t\t\tloadOptions: {\n\t\t\t\t\t\trouting: {\n\t\t\t\t\t\t\trequest: {\n\t\t\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\t\t\turl: '/inference-profiles?maxResults=1000',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\toutput: {\n\t\t\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'rootProperty',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tproperty: 'inferenceProfileSummaries',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'setKeyValue',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tname: '={{$responseItem.inferenceProfileName}}',\n\t\t\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\t\t'={{$responseItem.description || $responseItem.inferenceProfileArn}}',\n\t\t\t\t\t\t\t\t\t\t\tvalue: '={{$responseItem.inferenceProfileId}}',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'sort',\n\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\tkey: 'name',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trouting: {\n\t\t\t\t\tsend: {\n\t\t\t\t\t\ttype: 'body',\n\t\t\t\t\t\tproperty: 'model',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\tplaceholder: 'Add Option',\n\t\t\t\tdescription: 'Additional options to add',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Maximum Number of Tokens',\n\t\t\t\t\t\tname: 'maxTokensToSample',\n\t\t\t\t\t\tdefault: 2000,\n\t\t\t\t\t\tdescription: 'The maximum number of tokens to generate in the completion',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Sampling Temperature',\n\t\t\t\t\t\tname: 'temperature',\n\t\t\t\t\t\tdefault: 0.7,\n\t\t\t\t\t\ttypeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive.',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst credentials = await this.getCredentials<{\n\t\t\tregion: string;\n\t\t\tsecretAccessKey: string;\n\t\t\taccessKeyId: string;\n\t\t\tsessionToken: string;\n\t\t}>('aws');\n\t\tconst modelName = this.getNodeParameter('model', itemIndex) as string;\n\t\tconst options = this.getNodeParameter('options', itemIndex, {}) as {\n\t\t\ttemperature: number;\n\t\t\tmaxTokensToSample: number;\n\t\t};\n\n\t\t// We set-up client manually to pass httpAgent and httpsAgent\n\t\tconst proxyAgent = getNodeProxyAgent();\n\t\tconst clientConfig: BedrockRuntimeClientConfig = {\n\t\t\tregion: credentials.region,\n\t\t\tcredentials: {\n\t\t\t\tsecretAccessKey: credentials.secretAccessKey,\n\t\t\t\taccessKeyId: credentials.accessKeyId,\n\t\t\t\t...(credentials.sessionToken && { sessionToken: credentials.sessionToken }),\n\t\t\t},\n\t\t};\n\n\t\tif (proxyAgent) {\n\t\t\tclientConfig.requestHandler = new NodeHttpHandler({\n\t\t\t\thttpAgent: proxyAgent,\n\t\t\t\thttpsAgent: proxyAgent,\n\t\t\t});\n\t\t}\n\n\t\t// Pass the pre-configured client to avoid credential resolution proxy issues\n\t\tconst client = new BedrockRuntimeClient(clientConfig);\n\n\t\tconst model = new ChatBedrockConverse({\n\t\t\tclient,\n\t\t\tmodel: modelName,\n\t\t\tregion: credentials.region,\n\t\t\ttemperature: options.temperature,\n\t\t\tmaxTokens: options.maxTokensToSample,\n\t\t\tcallbacks: [new N8nLlmTracing(this)],\n\t\t\tonFailedAttempt: makeN8nLlmFailedAttemptHandler(this),\n\t\t});\n\n\t\treturn {\n\t\t\tresponse: model,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oCAAqC;AACrC,iBAAoC;AACpC,+BAAgC;AAChC,4BAAkC;AAClC,0BAA6C;AAC7C,0BAMO;AAEP,wCAA+C;AAC/C,2BAA8B;AAEvB,MAAM,iBAAsC;AAAA,EAA5C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MAEb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS,CAAC,GAAG,GAAG;AAAA,MAChB,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,OAAO;AAAA,QACN,YAAY,CAAC,IAAI;AAAA,QACjB,eAAe;AAAA,UACd,IAAI,CAAC,mBAAmB,YAAY;AAAA,UACpC,mBAAmB,CAAC,2BAA2B;AAAA,QAChD;AAAA,QACA,WAAW;AAAA,UACV,sBAAsB;AAAA,YACrB;AAAA,cACC,KAAK;AAAA,YACN;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MAEA,QAAQ,CAAC;AAAA,MAET,SAAS,CAAC,wCAAoB,eAAe;AAAA,MAC7C,aAAa,CAAC,O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var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var httpProxyAgent_exports = {};
30
30
  __export(httpProxyAgent_exports, {
31
+ getNodeProxyAgent: () => getNodeProxyAgent,
31
32
  getProxyAgent: () => getProxyAgent
32
33
  });
33
34
  module.exports = __toCommonJS(httpProxyAgent_exports);
35
+ var import_https_proxy_agent = require("https-proxy-agent");
34
36
  var import_proxy_from_env = __toESM(require("proxy-from-env"));
35
37
  var import_undici = require("undici");
38
+ function getProxyUrlFromEnv(targetUrl) {
39
+ return import_proxy_from_env.default.getProxyForUrl(targetUrl ?? "https://example.nonexistent/");
40
+ }
36
41
  function getProxyAgent(targetUrl) {
37
- const proxyUrl = import_proxy_from_env.default.getProxyForUrl(targetUrl ?? "https://example.nonexistent/");
42
+ const proxyUrl = getProxyUrlFromEnv(targetUrl);
38
43
  if (!proxyUrl) {
39
44
  return void 0;
40
45
  }
41
46
  return new import_undici.ProxyAgent(proxyUrl);
42
47
  }
48
+ function getNodeProxyAgent(targetUrl) {
49
+ const proxyUrl = getProxyUrlFromEnv(targetUrl);
50
+ if (!proxyUrl) {
51
+ return void 0;
52
+ }
53
+ return new import_https_proxy_agent.HttpsProxyAgent(proxyUrl);
54
+ }
43
55
  // Annotate the CommonJS export names for ESM import in node:
44
56
  0 && (module.exports = {
57
+ getNodeProxyAgent,
45
58
  getProxyAgent
46
59
  });
47
60
  //# sourceMappingURL=httpProxyAgent.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../utils/httpProxyAgent.ts"],"sourcesContent":["import proxyFromEnv from 'proxy-from-env';\nimport { ProxyAgent } from 'undici';\n\n/**\n * Returns a ProxyAgent or undefined based on the environment variables and target URL.\n * When target URL is not provided, NO_PROXY environment variable is not respected.\n */\nexport function getProxyAgent(targetUrl?: string) {\n\t// There are cases where we don't know the target URL in advance (e.g. when we need to provide a proxy agent to ChatAwsBedrock)\n\t// In such case we use a dummy URL.\n\t// This will lead to `NO_PROXY` environment variable not being respected, but it is better than not having a proxy agent at all.\n\tconst proxyUrl = proxyFromEnv.getProxyForUrl(targetUrl ?? 'https://example.nonexistent/');\n\n\tif (!proxyUrl) {\n\t\treturn undefined;\n\t}\n\n\treturn new ProxyAgent(proxyUrl);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAyB;AACzB,oBAA2B;AAMpB,SAAS,cAAc,WAAoB;AAIjD,QAAM,WAAW,sBAAAA,QAAa,eAAe,aAAa,8BAA8B;AAExF,MAAI,CAAC,UAAU;AACd,WAAO;AAAA,EACR;AAEA,SAAO,IAAI,yBAAW,QAAQ;AAC/B;","names":["proxyFromEnv"]}
1
+ {"version":3,"sources":["../../utils/httpProxyAgent.ts"],"sourcesContent":["import { HttpsProxyAgent } from 'https-proxy-agent';\nimport proxyFromEnv from 'proxy-from-env';\nimport { ProxyAgent } from 'undici';\n\n/**\n * Resolves the proxy URL from environment variables for a given target URL.\n *\n * @param targetUrl - The target URL to check proxy configuration for (optional)\n * @returns The proxy URL string or undefined if no proxy is configured\n *\n * @remarks\n * There are cases where we don't know the target URL in advance (e.g. when we need to provide a proxy agent to ChatAwsBedrock).\n * In such case we use a dummy URL.\n * This will lead to `NO_PROXY` environment variable not being respected, but it is better than not having a proxy agent at all.\n */\nfunction getProxyUrlFromEnv(targetUrl?: string): string {\n\treturn proxyFromEnv.getProxyForUrl(targetUrl ?? 'https://example.nonexistent/');\n}\n\n/**\n * Returns a ProxyAgent or undefined based on the environment variables and target URL.\n * When target URL is not provided, NO_PROXY environment variable is not respected.\n */\nexport function getProxyAgent(targetUrl?: string) {\n\tconst proxyUrl = getProxyUrlFromEnv(targetUrl);\n\n\tif (!proxyUrl) {\n\t\treturn undefined;\n\t}\n\n\treturn new ProxyAgent(proxyUrl);\n}\n\n/**\n * Returns a Node.js HTTP/HTTPS proxy agent for use with AWS SDK v3 clients.\n * AWS SDK v3 requires Node.js http.Agent/https.Agent instances (not undici ProxyAgent).\n *\n * @param targetUrl - The target URL to check proxy configuration for\n * @returns HttpsProxyAgent instance or undefined if no proxy is configured\n */\nexport function getNodeProxyAgent(targetUrl?: string) {\n\tconst proxyUrl = getProxyUrlFromEnv(targetUrl);\n\n\tif (!proxyUrl) {\n\t\treturn undefined;\n\t}\n\n\treturn new HttpsProxyAgent(proxyUrl);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAgC;AAChC,4BAAyB;AACzB,oBAA2B;AAa3B,SAAS,mBAAmB,WAA4B;AACvD,SAAO,sBAAAA,QAAa,eAAe,aAAa,8BAA8B;AAC/E;AAMO,SAAS,cAAc,WAAoB;AACjD,QAAM,WAAW,mBAAmB,SAAS;AAE7C,MAAI,CAAC,UAAU;AACd,WAAO;AAAA,EACR;AAEA,SAAO,IAAI,yBAAW,QAAQ;AAC/B;AASO,SAAS,kBAAkB,WAAoB;AACrD,QAAM,WAAW,mBAAmB,SAAS;AAE7C,MAAI,CAAC,UAAU;AACd,WAAO;AAAA,EACR;AAEA,SAAO,IAAI,yCAAgB,QAAQ;AACpC;","names":["proxyFromEnv"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n8n/n8n-nodes-langchain",
3
- "version": "1.118.1",
3
+ "version": "1.119.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -157,7 +157,7 @@
157
157
  "jest-mock-extended": "^3.0.4",
158
158
  "tsup": "^8.5.0",
159
159
  "@n8n/eslint-plugin-community-nodes": "0.6.0",
160
- "n8n-core": "1.118.1"
160
+ "n8n-core": "1.119.2"
161
161
  },
162
162
  "dependencies": {
163
163
  "@aws-sdk/client-sso-oidc": "3.808.0",
@@ -187,7 +187,7 @@
187
187
  "@langchain/weaviate": "0.2.0",
188
188
  "@modelcontextprotocol/sdk": "1.20.0",
189
189
  "@mozilla/readability": "0.6.0",
190
- "@n8n/typeorm": "0.3.20-14",
190
+ "@n8n/typeorm": "0.3.20-15",
191
191
  "@n8n/vm2": "3.9.25",
192
192
  "@pinecone-database/pinecone": "^5.0.2",
193
193
  "@qdrant/js-client-rest": "1.14.1",
@@ -224,14 +224,14 @@
224
224
  "weaviate-client": "3.6.2",
225
225
  "zod": "3.25.67",
226
226
  "zod-to-json-schema": "3.23.3",
227
- "@n8n/di": "0.9.0",
228
227
  "@n8n/client-oauth2": "0.31.0",
229
- "@n8n/config": "1.61.1",
230
- "@n8n/errors": "^0.5.0",
228
+ "@n8n/di": "0.9.0",
229
+ "@n8n/config": "1.62.1",
231
230
  "@n8n/json-schema-to-zod": "1.5.0",
231
+ "@n8n/errors": "^0.5.0",
232
232
  "@n8n/typescript-config": "1.3.0",
233
- "n8n-workflow": "1.116.0",
234
- "n8n-nodes-base": "1.117.1"
233
+ "n8n-nodes-base": "1.118.1",
234
+ "n8n-workflow": "1.117.0"
235
235
  },
236
236
  "license": "SEE LICENSE IN LICENSE.md",
237
237
  "homepage": "https://n8n.io",