update bedrock

This commit is contained in:
Henry
2023-12-15 17:49:29 +00:00
parent 1b0b1f13fa
commit 6e4822c3bb
3 changed files with 39 additions and 11 deletions
@@ -27,7 +27,7 @@ class AWSBedrock_LLMs implements INode {
constructor() {
this.label = 'AWS Bedrock'
this.name = 'awsBedrock'
this.version = 2.0
this.version = 3.0
this.type = 'AWSBedrock'
this.icon = 'awsBedrock.png'
this.category = 'LLMs'
@@ -105,6 +105,13 @@ class AWSBedrock_LLMs implements INode {
{ label: 'ai21.j2-ultra', name: 'ai21.j2-ultra' }
]
},
{
label: 'Custom Model Name',
name: 'customModel',
description: 'If provided, will override model selected from Model Name option',
type: 'string',
optional: true
},
{
label: 'Temperature',
name: 'temperature',
@@ -112,6 +119,7 @@ class AWSBedrock_LLMs implements INode {
step: 0.1,
description: 'Temperature parameter may not apply to certain model. Please check available model parameters',
optional: true,
additionalParams: true,
default: 0.7
},
{
@@ -121,6 +129,7 @@ class AWSBedrock_LLMs implements INode {
step: 10,
description: 'Max Tokens parameter may not apply to certain model. Please check available model parameters',
optional: true,
additionalParams: true,
default: 200
}
]
@@ -129,11 +138,12 @@ class AWSBedrock_LLMs implements INode {
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
const iRegion = nodeData.inputs?.region as string
const iModel = nodeData.inputs?.model as string
const customModel = nodeData.inputs?.customModel as string
const iTemperature = nodeData.inputs?.temperature as string
const iMax_tokens_to_sample = nodeData.inputs?.max_tokens_to_sample as string
const cache = nodeData.inputs?.cache as BaseCache
const obj: Partial<BaseBedrockInput> & BaseLLMParams = {
model: iModel,
model: customModel ?? iModel,
region: iRegion,
temperature: parseFloat(iTemperature),
maxTokens: parseInt(iMax_tokens_to_sample, 10)