mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
Feature/externalize model list (#2113)
* fixes * test json * test json * externalize model list * externalize model list * correcting awsChatBedRock Name * lint fixes * externalize models * externalize chat models * externalize chat models * externalize llm models * externalize llm models * lint fixes * addition of models for ChatMistral * updating version numbers for all imapacted nodes. * marketplace template updates * update embeddings, marketplaces, add chatCohere * config changes for new env variable * removal of local models.json * update models json file --------- Co-authored-by: Henry <hzj94@hotmail.com>
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { Bedrock } from '@langchain/community/llms/bedrock'
|
||||
import { BaseCache } from '@langchain/core/caches'
|
||||
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { ICommonObject, INode, INodeData, INodeOptionsValue, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||
import { BaseBedrockInput } from '@langchain/community/dist/utils/bedrock'
|
||||
import { getModels, getRegions, MODEL_TYPE } from '../../../src/modelLoader'
|
||||
|
||||
/**
|
||||
* @author Michael Connor <mlconnor@yahoo.com>
|
||||
@@ -23,7 +24,7 @@ class AWSBedrock_LLMs implements INode {
|
||||
constructor() {
|
||||
this.label = 'AWS Bedrock'
|
||||
this.name = 'awsBedrock'
|
||||
this.version = 3.0
|
||||
this.version = 4.0
|
||||
this.type = 'AWSBedrock'
|
||||
this.icon = 'aws.svg'
|
||||
this.category = 'LLMs'
|
||||
@@ -46,60 +47,15 @@ class AWSBedrock_LLMs implements INode {
|
||||
{
|
||||
label: 'Region',
|
||||
name: 'region',
|
||||
type: 'options',
|
||||
options: [
|
||||
{ label: 'af-south-1', name: 'af-south-1' },
|
||||
{ label: 'ap-east-1', name: 'ap-east-1' },
|
||||
{ label: 'ap-northeast-1', name: 'ap-northeast-1' },
|
||||
{ label: 'ap-northeast-2', name: 'ap-northeast-2' },
|
||||
{ label: 'ap-northeast-3', name: 'ap-northeast-3' },
|
||||
{ label: 'ap-south-1', name: 'ap-south-1' },
|
||||
{ label: 'ap-south-2', name: 'ap-south-2' },
|
||||
{ label: 'ap-southeast-1', name: 'ap-southeast-1' },
|
||||
{ label: 'ap-southeast-2', name: 'ap-southeast-2' },
|
||||
{ label: 'ap-southeast-3', name: 'ap-southeast-3' },
|
||||
{ label: 'ap-southeast-4', name: 'ap-southeast-4' },
|
||||
{ label: 'ap-southeast-5', name: 'ap-southeast-5' },
|
||||
{ label: 'ap-southeast-6', name: 'ap-southeast-6' },
|
||||
{ label: 'ca-central-1', name: 'ca-central-1' },
|
||||
{ label: 'ca-west-1', name: 'ca-west-1' },
|
||||
{ label: 'cn-north-1', name: 'cn-north-1' },
|
||||
{ label: 'cn-northwest-1', name: 'cn-northwest-1' },
|
||||
{ label: 'eu-central-1', name: 'eu-central-1' },
|
||||
{ label: 'eu-central-2', name: 'eu-central-2' },
|
||||
{ label: 'eu-north-1', name: 'eu-north-1' },
|
||||
{ label: 'eu-south-1', name: 'eu-south-1' },
|
||||
{ label: 'eu-south-2', name: 'eu-south-2' },
|
||||
{ label: 'eu-west-1', name: 'eu-west-1' },
|
||||
{ label: 'eu-west-2', name: 'eu-west-2' },
|
||||
{ label: 'eu-west-3', name: 'eu-west-3' },
|
||||
{ label: 'il-central-1', name: 'il-central-1' },
|
||||
{ label: 'me-central-1', name: 'me-central-1' },
|
||||
{ label: 'me-south-1', name: 'me-south-1' },
|
||||
{ label: 'sa-east-1', name: 'sa-east-1' },
|
||||
{ label: 'us-east-1', name: 'us-east-1' },
|
||||
{ label: 'us-east-2', name: 'us-east-2' },
|
||||
{ label: 'us-gov-east-1', name: 'us-gov-east-1' },
|
||||
{ label: 'us-gov-west-1', name: 'us-gov-west-1' },
|
||||
{ label: 'us-west-1', name: 'us-west-1' },
|
||||
{ label: 'us-west-2', name: 'us-west-2' }
|
||||
],
|
||||
type: 'asyncOptions',
|
||||
loadMethod: 'listRegions',
|
||||
default: 'us-east-1'
|
||||
},
|
||||
{
|
||||
label: 'Model Name',
|
||||
name: 'model',
|
||||
type: 'options',
|
||||
options: [
|
||||
{ label: 'amazon.titan-tg1-large', name: 'amazon.titan-tg1-large' },
|
||||
{ label: 'amazon.titan-e1t-medium', name: 'amazon.titan-e1t-medium' },
|
||||
{ label: 'cohere.command-text-v14', name: 'cohere.command-text-v14' },
|
||||
{ label: 'cohere.command-light-text-v14', name: 'cohere.command-light-text-v14' },
|
||||
{ label: 'ai21.j2-grande-instruct', name: 'ai21.j2-grande-instruct' },
|
||||
{ label: 'ai21.j2-jumbo-instruct', name: 'ai21.j2-jumbo-instruct' },
|
||||
{ label: 'ai21.j2-mid', name: 'ai21.j2-mid' },
|
||||
{ label: 'ai21.j2-ultra', name: 'ai21.j2-ultra' }
|
||||
]
|
||||
type: 'asyncOptions',
|
||||
loadMethod: 'listModels'
|
||||
},
|
||||
{
|
||||
label: 'Custom Model Name',
|
||||
@@ -131,6 +87,16 @@ class AWSBedrock_LLMs implements INode {
|
||||
]
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
loadMethods = {
|
||||
async listModels(): Promise<INodeOptionsValue[]> {
|
||||
return await getModels(MODEL_TYPE.LLM, 'awsBedrock')
|
||||
},
|
||||
async listRegions(): Promise<INodeOptionsValue[]> {
|
||||
return await getRegions(MODEL_TYPE.LLM, 'awsBedrock')
|
||||
}
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const iRegion = nodeData.inputs?.region as string
|
||||
const iModel = nodeData.inputs?.model as string
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { AzureOpenAIInput, OpenAI, OpenAIInput } from '@langchain/openai'
|
||||
import { BaseCache } from '@langchain/core/caches'
|
||||
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { ICommonObject, INode, INodeData, INodeOptionsValue, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||
import { getModels, MODEL_TYPE } from '../../../src/modelLoader'
|
||||
|
||||
class AzureOpenAI_LLMs implements INode {
|
||||
label: string
|
||||
@@ -19,7 +20,7 @@ class AzureOpenAI_LLMs implements INode {
|
||||
constructor() {
|
||||
this.label = 'Azure OpenAI'
|
||||
this.name = 'azureOpenAI'
|
||||
this.version = 2.1
|
||||
this.version = 3.0
|
||||
this.type = 'AzureOpenAI'
|
||||
this.icon = 'Azure.svg'
|
||||
this.category = 'LLMs'
|
||||
@@ -41,67 +42,9 @@ class AzureOpenAI_LLMs implements INode {
|
||||
{
|
||||
label: 'Model Name',
|
||||
name: 'modelName',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
label: 'text-davinci-003',
|
||||
name: 'text-davinci-003'
|
||||
},
|
||||
{
|
||||
label: 'ada',
|
||||
name: 'ada'
|
||||
},
|
||||
{
|
||||
label: 'text-ada-001',
|
||||
name: 'text-ada-001'
|
||||
},
|
||||
{
|
||||
label: 'babbage',
|
||||
name: 'babbage'
|
||||
},
|
||||
{
|
||||
label: 'text-babbage-001',
|
||||
name: 'text-babbage-001'
|
||||
},
|
||||
{
|
||||
label: 'curie',
|
||||
name: 'curie'
|
||||
},
|
||||
{
|
||||
label: 'text-curie-001',
|
||||
name: 'text-curie-001'
|
||||
},
|
||||
{
|
||||
label: 'davinci',
|
||||
name: 'davinci'
|
||||
},
|
||||
{
|
||||
label: 'text-davinci-001',
|
||||
name: 'text-davinci-001'
|
||||
},
|
||||
{
|
||||
label: 'text-davinci-002',
|
||||
name: 'text-davinci-002'
|
||||
},
|
||||
{
|
||||
label: 'text-davinci-fine-tune-002',
|
||||
name: 'text-davinci-fine-tune-002'
|
||||
},
|
||||
{
|
||||
label: 'gpt-35-turbo',
|
||||
name: 'gpt-35-turbo'
|
||||
},
|
||||
{
|
||||
label: 'gpt-4',
|
||||
name: 'gpt-4'
|
||||
},
|
||||
{
|
||||
label: 'gpt-4-32k',
|
||||
name: 'gpt-4-32k'
|
||||
}
|
||||
],
|
||||
default: 'text-davinci-003',
|
||||
optional: true
|
||||
type: 'asyncOptions',
|
||||
loadMethod: 'listModels',
|
||||
default: 'text-davinci-003'
|
||||
},
|
||||
{
|
||||
label: 'Temperature',
|
||||
@@ -162,6 +105,13 @@ class AzureOpenAI_LLMs implements INode {
|
||||
]
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
loadMethods = {
|
||||
async listModels(): Promise<INodeOptionsValue[]> {
|
||||
return await getModels(MODEL_TYPE.LLM, 'azureOpenAI')
|
||||
}
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const temperature = nodeData.inputs?.temperature as string
|
||||
const modelName = nodeData.inputs?.modelName as string
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { BaseCache } from '@langchain/core/caches'
|
||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { ICommonObject, INode, INodeData, INodeOptionsValue, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||
import { Cohere, CohereInput } from './core'
|
||||
import { getModels, MODEL_TYPE } from '../../../src/modelLoader'
|
||||
|
||||
class Cohere_LLMs implements INode {
|
||||
label: string
|
||||
@@ -18,7 +19,7 @@ class Cohere_LLMs implements INode {
|
||||
constructor() {
|
||||
this.label = 'Cohere'
|
||||
this.name = 'cohere'
|
||||
this.version = 2.0
|
||||
this.version = 3.0
|
||||
this.type = 'Cohere'
|
||||
this.icon = 'Cohere.svg'
|
||||
this.category = 'LLMs'
|
||||
@@ -40,35 +41,9 @@ class Cohere_LLMs implements INode {
|
||||
{
|
||||
label: 'Model Name',
|
||||
name: 'modelName',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
label: 'command',
|
||||
name: 'command'
|
||||
},
|
||||
{
|
||||
label: 'command-light',
|
||||
name: 'command-light'
|
||||
},
|
||||
{
|
||||
label: 'command-nightly',
|
||||
name: 'command-nightly'
|
||||
},
|
||||
{
|
||||
label: 'command-light-nightly',
|
||||
name: 'command-light-nightly'
|
||||
},
|
||||
{
|
||||
label: 'base',
|
||||
name: 'base'
|
||||
},
|
||||
{
|
||||
label: 'base-light',
|
||||
name: 'base-light'
|
||||
}
|
||||
],
|
||||
default: 'command',
|
||||
optional: true
|
||||
type: 'asyncOptions',
|
||||
loadMethod: 'listModels',
|
||||
default: 'command'
|
||||
},
|
||||
{
|
||||
label: 'Temperature',
|
||||
@@ -88,6 +63,12 @@ class Cohere_LLMs implements INode {
|
||||
]
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
loadMethods = {
|
||||
async listModels(): Promise<INodeOptionsValue[]> {
|
||||
return await getModels(MODEL_TYPE.LLM, 'cohere')
|
||||
}
|
||||
}
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const temperature = nodeData.inputs?.temperature as string
|
||||
const modelName = nodeData.inputs?.modelName as string
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { GooglePaLM, GooglePaLMTextInput } from '@langchain/community/llms/googlepalm'
|
||||
import { BaseCache } from '@langchain/core/caches'
|
||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { ICommonObject, INode, INodeData, INodeOptionsValue, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||
import { getModels, MODEL_TYPE } from '../../../src/modelLoader'
|
||||
|
||||
class GooglePaLM_LLMs implements INode {
|
||||
label: string
|
||||
@@ -18,7 +19,7 @@ class GooglePaLM_LLMs implements INode {
|
||||
constructor() {
|
||||
this.label = 'GooglePaLM'
|
||||
this.name = 'GooglePaLM'
|
||||
this.version = 2.0
|
||||
this.version = 3.0
|
||||
this.type = 'GooglePaLM'
|
||||
this.icon = 'GooglePaLM.svg'
|
||||
this.category = 'LLMs'
|
||||
@@ -40,15 +41,9 @@ class GooglePaLM_LLMs implements INode {
|
||||
{
|
||||
label: 'Model Name',
|
||||
name: 'modelName',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
label: 'models/text-bison-001',
|
||||
name: 'models/text-bison-001'
|
||||
}
|
||||
],
|
||||
default: 'models/text-bison-001',
|
||||
optional: true
|
||||
type: 'asyncOptions',
|
||||
loadMethod: 'listModels',
|
||||
default: 'models/text-bison-001'
|
||||
},
|
||||
{
|
||||
label: 'Temperature',
|
||||
@@ -126,6 +121,13 @@ class GooglePaLM_LLMs implements INode {
|
||||
]
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
loadMethods = {
|
||||
async listModels(): Promise<INodeOptionsValue[]> {
|
||||
return await getModels(MODEL_TYPE.LLM, 'GooglePaLM')
|
||||
}
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const modelName = nodeData.inputs?.modelName as string
|
||||
const temperature = nodeData.inputs?.temperature as string
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { GoogleAuthOptions } from 'google-auth-library'
|
||||
import { BaseCache } from '@langchain/core/caches'
|
||||
import { GoogleVertexAI, GoogleVertexAITextInput } from '@langchain/community/llms/googlevertexai'
|
||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { ICommonObject, INode, INodeData, INodeOptionsValue, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||
import { getModels, MODEL_TYPE } from '../../../src/modelLoader'
|
||||
|
||||
class GoogleVertexAI_LLMs implements INode {
|
||||
label: string
|
||||
@@ -19,7 +20,7 @@ class GoogleVertexAI_LLMs implements INode {
|
||||
constructor() {
|
||||
this.label = 'GoogleVertexAI'
|
||||
this.name = 'googlevertexai'
|
||||
this.version = 2.0
|
||||
this.version = 3.0
|
||||
this.type = 'GoogleVertexAI'
|
||||
this.icon = 'GoogleVertex.svg'
|
||||
this.category = 'LLMs'
|
||||
@@ -44,33 +45,8 @@ class GoogleVertexAI_LLMs implements INode {
|
||||
{
|
||||
label: 'Model Name',
|
||||
name: 'modelName',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
label: 'text-bison',
|
||||
name: 'text-bison'
|
||||
},
|
||||
{
|
||||
label: 'code-bison',
|
||||
name: 'code-bison'
|
||||
},
|
||||
{
|
||||
label: 'code-gecko',
|
||||
name: 'code-gecko'
|
||||
},
|
||||
{
|
||||
label: 'text-bison-32k',
|
||||
name: 'text-bison-32k'
|
||||
},
|
||||
{
|
||||
label: 'code-bison-32k',
|
||||
name: 'code-bison-32k'
|
||||
},
|
||||
{
|
||||
label: 'code-gecko-32k',
|
||||
name: 'code-gecko-32k'
|
||||
}
|
||||
],
|
||||
type: 'asyncOptions',
|
||||
loadMethod: 'listModels',
|
||||
default: 'text-bison'
|
||||
},
|
||||
{
|
||||
@@ -100,6 +76,13 @@ class GoogleVertexAI_LLMs implements INode {
|
||||
]
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
loadMethods = {
|
||||
async listModels(): Promise<INodeOptionsValue[]> {
|
||||
return await getModels(MODEL_TYPE.LLM, 'googlevertexai')
|
||||
}
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const googleApplicationCredentialFilePath = getCredentialParam('googleApplicationCredentialFilePath', credentialData, nodeData)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { OpenAI, OpenAIInput } from '@langchain/openai'
|
||||
import { BaseCache } from '@langchain/core/caches'
|
||||
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { ICommonObject, INode, INodeData, INodeOptionsValue, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||
import { getModels, MODEL_TYPE } from '../../../src/modelLoader'
|
||||
|
||||
class OpenAI_LLMs implements INode {
|
||||
label: string
|
||||
@@ -19,7 +20,7 @@ class OpenAI_LLMs implements INode {
|
||||
constructor() {
|
||||
this.label = 'OpenAI'
|
||||
this.name = 'openAI'
|
||||
this.version = 3.0
|
||||
this.version = 4.0
|
||||
this.type = 'OpenAI'
|
||||
this.icon = 'openai.svg'
|
||||
this.category = 'LLMs'
|
||||
@@ -41,23 +42,9 @@ class OpenAI_LLMs implements INode {
|
||||
{
|
||||
label: 'Model Name',
|
||||
name: 'modelName',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
label: 'gpt-3.5-turbo-instruct',
|
||||
name: 'gpt-3.5-turbo-instruct'
|
||||
},
|
||||
{
|
||||
label: 'babbage-002',
|
||||
name: 'babbage-002'
|
||||
},
|
||||
{
|
||||
label: 'davinci-002',
|
||||
name: 'davinci-002'
|
||||
}
|
||||
],
|
||||
default: 'gpt-3.5-turbo-instruct',
|
||||
optional: true
|
||||
type: 'asyncOptions',
|
||||
loadMethod: 'listModels',
|
||||
default: 'gpt-3.5-turbo-instruct'
|
||||
},
|
||||
{
|
||||
label: 'Temperature',
|
||||
@@ -140,6 +127,13 @@ class OpenAI_LLMs implements INode {
|
||||
]
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
loadMethods = {
|
||||
async listModels(): Promise<INodeOptionsValue[]> {
|
||||
return await getModels(MODEL_TYPE.LLM, 'openAI')
|
||||
}
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const temperature = nodeData.inputs?.temperature as string
|
||||
const modelName = nodeData.inputs?.modelName as string
|
||||
|
||||
Reference in New Issue
Block a user