mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 11:01:22 +03:00
feat(components): cohere.ai embeddings node
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { CohereEmbeddings } from 'langchain/embeddings/cohere'
|
||||
|
||||
class CohereEmbedding_Embeddings implements INode {
|
||||
label: string
|
||||
name: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
description: string
|
||||
baseClasses: string[]
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Cohere Embeddings'
|
||||
this.name = 'cohereEmbeddings'
|
||||
this.type = 'CohereEmbeddings'
|
||||
this.icon = 'cohere.png'
|
||||
this.category = 'Embeddings'
|
||||
this.description = 'Cohere API to generate embeddings for a given text'
|
||||
this.baseClasses = [this.type, ...getBaseClasses(CohereEmbeddings)]
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Cohere API Key',
|
||||
name: 'cohereApiKey',
|
||||
type: 'password'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const apiKey = nodeData.inputs?.cohereApiKey as string
|
||||
|
||||
const model = new CohereEmbeddings({ apiKey })
|
||||
return model
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: CohereEmbedding_Embeddings }
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
@@ -21,10 +21,11 @@
|
||||
"@pinecone-database/pinecone": "^0.0.12",
|
||||
"axios": "^0.27.2",
|
||||
"chromadb": "^1.3.1",
|
||||
"cohere-ai": "^6.2.0",
|
||||
"dotenv": "^16.0.0",
|
||||
"express": "^4.17.3",
|
||||
"form-data": "^4.0.0",
|
||||
"langchain": "^0.0.53",
|
||||
"langchain": "^0.0.56",
|
||||
"moment": "^2.29.3",
|
||||
"node-fetch": "2",
|
||||
"pdf-parse": "^1.1.1",
|
||||
|
||||
Reference in New Issue
Block a user