mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
Merge pull request #20 from mileszim/feat/cohere-embeddings
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 |
@@ -22,6 +22,7 @@
|
||||
"axios": "^0.27.2",
|
||||
"cheerio": "^1.0.0-rc.12",
|
||||
"chromadb": "^1.3.1",
|
||||
"cohere-ai": "^6.2.0",
|
||||
"d3-dsv": "2",
|
||||
"dotenv": "^16.0.0",
|
||||
"express": "^4.17.3",
|
||||
|
||||
Reference in New Issue
Block a user