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:
Vinod Kiran
2024-04-12 17:16:10 +05:30
committed by GitHub
parent 4daf29db80
commit 788d40f26b
76 changed files with 789 additions and 4044 deletions
@@ -15,8 +15,9 @@ import {
ChatMessageChunk
} from '@langchain/core/messages'
import { ChatMistralAI as LangchainChatMistralAI, ChatMistralAIInput } from '@langchain/mistralai'
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'
interface TokenUsage {
completionTokens?: number
@@ -46,7 +47,7 @@ class ChatMistral_ChatModels implements INode {
constructor() {
this.label = 'ChatMistralAI'
this.name = 'chatMistralAI'
this.version = 2.0
this.version = 3.0
this.type = 'ChatMistralAI'
this.icon = 'MistralAI.svg'
this.category = 'Chat Models'
@@ -68,9 +69,8 @@ class ChatMistral_ChatModels implements INode {
{
label: 'Model Name',
name: 'modelName',
type: 'string',
description:
'Refer to <a target="_blank" href="https://docs.mistral.ai/guides/model-selection/">Model Selection</a> for more available models',
type: 'asyncOptions',
loadMethod: 'listModels',
default: 'mistral-tiny'
},
{
@@ -129,6 +129,13 @@ class ChatMistral_ChatModels implements INode {
]
}
//@ts-ignore
loadMethods = {
async listModels(): Promise<INodeOptionsValue[]> {
return await getModels(MODEL_TYPE.CHAT, 'chatMistralAI')
}
}
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
const apiKey = getCredentialParam('mistralAIAPIKey', credentialData, nodeData)