mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
Chore/cohere embed models (#2035)
* Update of Cohere embedding models * Update of Cohere embedding models * adding official docs link to inputType
This commit is contained in:
@@ -17,7 +17,7 @@ class CohereEmbedding_Embeddings implements INode {
|
||||
constructor() {
|
||||
this.label = 'Cohere Embeddings'
|
||||
this.name = 'cohereEmbeddings'
|
||||
this.version = 1.0
|
||||
this.version = 2.0
|
||||
this.type = 'CohereEmbeddings'
|
||||
this.icon = 'Cohere.svg'
|
||||
this.category = 'Embeddings'
|
||||
@@ -35,27 +35,82 @@ class CohereEmbedding_Embeddings implements INode {
|
||||
name: 'modelName',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
label: 'embed-english-v3.0',
|
||||
name: 'embed-english-v3.0',
|
||||
description: 'Embedding Dimensions: 1024'
|
||||
},
|
||||
{
|
||||
label: 'embed-english-light-v3.0',
|
||||
name: 'embed-english-light-v3.0',
|
||||
description: 'Embedding Dimensions: 384'
|
||||
},
|
||||
{
|
||||
label: 'embed-multilingual-v3.0',
|
||||
name: 'embed-multilingual-v3.0',
|
||||
description: 'Embedding Dimensions: 1024'
|
||||
},
|
||||
{
|
||||
label: 'embed-multilingual-light-v3.0',
|
||||
name: 'embed-multilingual-light-v3.0',
|
||||
description: 'Embedding Dimensions: 384'
|
||||
},
|
||||
{
|
||||
label: 'embed-english-v2.0',
|
||||
name: 'embed-english-v2.0'
|
||||
name: 'embed-english-v2.0',
|
||||
description: 'Embedding Dimensions: 4096'
|
||||
},
|
||||
{
|
||||
label: 'embed-english-light-v2.0',
|
||||
name: 'embed-english-light-v2.0'
|
||||
name: 'embed-english-light-v2.0',
|
||||
description: 'Embedding Dimensions: 1024'
|
||||
},
|
||||
{
|
||||
label: 'embed-multilingual-v2.0',
|
||||
name: 'embed-multilingual-v2.0'
|
||||
name: 'embed-multilingual-v2.0',
|
||||
description: 'Embedding Dimensions: 768'
|
||||
}
|
||||
],
|
||||
default: 'embed-english-v2.0',
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Type',
|
||||
name: 'inputType',
|
||||
type: 'options',
|
||||
description:
|
||||
'Specifies the type of input passed to the model. Required for embedding models v3 and higher. <a target="_blank" href="https://docs.cohere.com/reference/embed">Official Docs</a>',
|
||||
options: [
|
||||
{
|
||||
label: 'search_document',
|
||||
name: 'search_document',
|
||||
description: 'Use this to encode documents for embeddings that you store in a vector database for search use-cases'
|
||||
},
|
||||
{
|
||||
label: 'search_query',
|
||||
name: 'search_query',
|
||||
description: 'Use this when you query your vector DB to find relevant documents.'
|
||||
},
|
||||
{
|
||||
label: 'classification',
|
||||
name: 'classification',
|
||||
description: 'Use this when you use the embeddings as an input to a text classifier'
|
||||
},
|
||||
{
|
||||
label: 'clustering',
|
||||
name: 'clustering',
|
||||
description: 'Use this when you want to cluster the embeddings.'
|
||||
}
|
||||
],
|
||||
default: 'search_query',
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const modelName = nodeData.inputs?.modelName as string
|
||||
const inputType = nodeData.inputs?.inputType as string
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const cohereApiKey = getCredentialParam('cohereApiKey', credentialData, nodeData)
|
||||
@@ -65,6 +120,7 @@ class CohereEmbedding_Embeddings implements INode {
|
||||
}
|
||||
|
||||
if (modelName) obj.model = modelName
|
||||
if (inputType) obj.inputType = inputType
|
||||
|
||||
const model = new CohereEmbeddings(obj)
|
||||
return model
|
||||
|
||||
Reference in New Issue
Block a user