mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 07:01:04 +03:00
bca4de0c63
* update build functions * sequential agents * update langchain to 0.2, added sequential agent nodes * add marketplace templates * update howto wordings * Merge branch 'main' into feature/Seq-Agents # Conflicts: # pnpm-lock.yaml * update deprecated functions and add new sequential nodes * add marketplace templates * update marketplace templates, add structured output to llm node * add multi agents template * update llm node with bindmodels * update cypress version * update templates sticky note wordings * update tool node to include human in loop action * update structured outputs error from models * update cohere package to resolve google genai pipeThrough bug * update mistral package version, added message reconstruction before invoke seq agent * add HITL to agent * update state messages restructuring * update load and split methods for s3 directory
67 lines
2.3 KiB
TypeScript
67 lines
2.3 KiB
TypeScript
import { TogetherAIEmbeddings, TogetherAIEmbeddingsParams } from '@langchain/community/embeddings/togetherai'
|
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
|
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
|
|
|
class TogetherAIEmbedding_Embeddings implements INode {
|
|
label: string
|
|
name: string
|
|
version: number
|
|
type: string
|
|
icon: string
|
|
category: string
|
|
description: string
|
|
baseClasses: string[]
|
|
inputs: INodeParams[]
|
|
credential: INodeParams
|
|
|
|
constructor() {
|
|
this.label = 'TogetherAIEmbedding'
|
|
this.name = 'togetherAIEmbedding'
|
|
this.version = 1.0
|
|
this.type = 'TogetherAIEmbedding'
|
|
this.icon = 'togetherai.png'
|
|
this.category = 'Embeddings'
|
|
this.description = 'TogetherAI Embedding models to generate embeddings for a given text'
|
|
this.baseClasses = [this.type, ...getBaseClasses(TogetherAIEmbeddings)]
|
|
this.credential = {
|
|
label: 'Connect Credential',
|
|
name: 'credential',
|
|
type: 'credential',
|
|
credentialNames: ['togetherAIApi']
|
|
}
|
|
this.inputs = [
|
|
{
|
|
label: 'Cache',
|
|
name: 'cache',
|
|
type: 'BaseCache',
|
|
optional: true
|
|
},
|
|
{
|
|
label: 'Model Name',
|
|
name: 'modelName',
|
|
type: 'string',
|
|
placeholder: 'sentence-transformers/msmarco-bert-base-dot-v5',
|
|
description: 'Refer to <a target="_blank" href="https://docs.together.ai/docs/embedding-models">embedding models</a> page'
|
|
}
|
|
]
|
|
}
|
|
|
|
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
|
const modelName = nodeData.inputs?.modelName as string
|
|
|
|
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
|
const togetherAIApiKey = getCredentialParam('togetherAIApiKey', credentialData, nodeData)
|
|
|
|
const obj: Partial<TogetherAIEmbeddingsParams> = {
|
|
modelName: modelName,
|
|
apiKey: togetherAIApiKey,
|
|
model: modelName
|
|
}
|
|
|
|
const model = new TogetherAIEmbeddings(obj)
|
|
return model
|
|
}
|
|
}
|
|
|
|
module.exports = { nodeClass: TogetherAIEmbedding_Embeddings }
|