adding performance config option to the AWS ChatBedrock component (#4777)

* adding performance config option to the AWS ChatBedrock component

* Update AWSChatBedrock.ts

* Update pnpm-lock.yaml

---------

Co-authored-by: Henry Heng <henryheng@flowiseai.com>
This commit is contained in:
Abdullatif 2025-07-02 21:15:39 +03:00 committed by GitHub
parent bbf6970600
commit 0627693133
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 38748 additions and 38736 deletions

View File

@ -23,7 +23,7 @@ class AWSChatBedrock_ChatModels implements INode {
constructor() { constructor() {
this.label = 'AWS ChatBedrock' this.label = 'AWS ChatBedrock'
this.name = 'awsChatBedrock' this.name = 'awsChatBedrock'
this.version = 6.0 this.version = 6.1
this.type = 'AWSChatBedrock' this.type = 'AWSChatBedrock'
this.icon = 'aws.svg' this.icon = 'aws.svg'
this.category = 'Chat Models' this.category = 'Chat Models'
@ -100,6 +100,16 @@ class AWSChatBedrock_ChatModels implements INode {
'Allow image input. Refer to the <a href="https://docs.flowiseai.com/using-flowise/uploads#image" target="_blank">docs</a> for more details.', 'Allow image input. Refer to the <a href="https://docs.flowiseai.com/using-flowise/uploads#image" target="_blank">docs</a> for more details.',
default: false, default: false,
optional: true optional: true
},
{
label: 'Latency Optimized',
name: 'latencyOptimized',
type: 'boolean',
description:
'Enable latency optimized configuration for supported models. Refer to the supported <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/latency-optimized-inference.html" target="_blank">latecny optimized models</a> for more details.',
default: false,
optional: true,
additionalParams: true
} }
] ]
} }
@ -122,6 +132,7 @@ class AWSChatBedrock_ChatModels implements INode {
const iMax_tokens_to_sample = nodeData.inputs?.max_tokens_to_sample as string const iMax_tokens_to_sample = nodeData.inputs?.max_tokens_to_sample as string
const cache = nodeData.inputs?.cache as BaseCache const cache = nodeData.inputs?.cache as BaseCache
const streaming = nodeData.inputs?.streaming as boolean const streaming = nodeData.inputs?.streaming as boolean
const latencyOptimized = nodeData.inputs?.latencyOptimized as boolean
const obj: ChatBedrockConverseInput = { const obj: ChatBedrockConverseInput = {
region: iRegion, region: iRegion,
@ -131,6 +142,10 @@ class AWSChatBedrock_ChatModels implements INode {
streaming: streaming ?? true streaming: streaming ?? true
} }
if (latencyOptimized) {
obj.performanceConfig = { latency: 'optimized' }
}
/** /**
* Long-term credentials specified in LLM configuration are optional. * Long-term credentials specified in LLM configuration are optional.
* Bedrock's credential provider falls back to the AWS SDK to fetch * Bedrock's credential provider falls back to the AWS SDK to fetch

View File

@ -38,7 +38,7 @@
"@google/generative-ai": "^0.24.0", "@google/generative-ai": "^0.24.0",
"@huggingface/inference": "^2.6.1", "@huggingface/inference": "^2.6.1",
"@langchain/anthropic": "0.3.14", "@langchain/anthropic": "0.3.14",
"@langchain/aws": "0.1.4", "@langchain/aws": "^0.1.11",
"@langchain/baidu-qianfan": "^0.1.0", "@langchain/baidu-qianfan": "^0.1.0",
"@langchain/cohere": "^0.0.7", "@langchain/cohere": "^0.0.7",
"@langchain/community": "^0.3.29", "@langchain/community": "^0.3.29",

File diff suppressed because one or more lines are too long