mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 09:01:06 +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 { AnthropicInput, ChatAnthropic as LangchainChatAnthropic } from '@langchain/anthropic'
|
||||
import { BaseCache } from '@langchain/core/caches'
|
||||
import { BaseLLMParams } from '@langchain/core/language_models/llms'
|
||||
import { ICommonObject, IMultiModalOption, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { ICommonObject, IMultiModalOption, INode, INodeData, INodeOptionsValue, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||
import { ChatAnthropic } from './FlowiseChatAnthropic'
|
||||
import { getModels, MODEL_TYPE } from '../../../src/modelLoader'
|
||||
|
||||
class ChatAnthropic_ChatModels implements INode {
|
||||
label: string
|
||||
@@ -20,7 +21,7 @@ class ChatAnthropic_ChatModels implements INode {
|
||||
constructor() {
|
||||
this.label = 'ChatAnthropic'
|
||||
this.name = 'chatAnthropic'
|
||||
this.version = 5.0
|
||||
this.version = 6.0
|
||||
this.type = 'ChatAnthropic'
|
||||
this.icon = 'Anthropic.svg'
|
||||
this.category = 'Chat Models'
|
||||
@@ -42,41 +43,9 @@ class ChatAnthropic_ChatModels implements INode {
|
||||
{
|
||||
label: 'Model Name',
|
||||
name: 'modelName',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
label: 'claude-3-haiku',
|
||||
name: 'claude-3-haiku-20240307',
|
||||
description: 'Fastest and most compact model, designed for near-instant responsiveness'
|
||||
},
|
||||
{
|
||||
label: 'claude-3-opus',
|
||||
name: 'claude-3-opus-20240229',
|
||||
description: 'Most powerful model for highly complex tasks'
|
||||
},
|
||||
{
|
||||
label: 'claude-3-sonnet',
|
||||
name: 'claude-3-sonnet-20240229',
|
||||
description: 'Ideal balance of intelligence and speed for enterprise workloads'
|
||||
},
|
||||
{
|
||||
label: 'claude-2.0 (legacy)',
|
||||
name: 'claude-2.0',
|
||||
description: 'Claude 2 latest major version, automatically get updates to the model as they are released'
|
||||
},
|
||||
{
|
||||
label: 'claude-2.1 (legacy)',
|
||||
name: 'claude-2.1',
|
||||
description: 'Claude 2 latest full version'
|
||||
},
|
||||
{
|
||||
label: 'claude-instant-1.2 (legacy)',
|
||||
name: 'claude-instant-1.2',
|
||||
description: 'Claude Instant latest major version, automatically get updates to the model as they are released'
|
||||
}
|
||||
],
|
||||
default: 'claude-3-haiku',
|
||||
optional: true
|
||||
type: 'asyncOptions',
|
||||
loadMethod: 'listModels',
|
||||
default: 'claude-3-haiku'
|
||||
},
|
||||
{
|
||||
label: 'Temperature',
|
||||
@@ -122,6 +91,13 @@ class ChatAnthropic_ChatModels implements INode {
|
||||
]
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
loadMethods = {
|
||||
async listModels(): Promise<INodeOptionsValue[]> {
|
||||
return await getModels(MODEL_TYPE.CHAT, 'chatAnthropic')
|
||||
}
|
||||
}
|
||||
|
||||
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