mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
New Feature : Redis Vector Store
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { ICommonObject, INode, INodeData } from '../../../src/Interface'
|
||||
import { Embeddings } from 'langchain/embeddings/base'
|
||||
import { VectorStore } from 'langchain/vectorstores/base'
|
||||
import { RedisVectorStore, RedisVectorStoreConfig } from 'langchain/vectorstores/redis'
|
||||
import { Document } from 'langchain/document'
|
||||
|
||||
import { RedisSearchBase } from './RedisSearchBase'
|
||||
|
||||
class RedisExisting_VectorStores extends RedisSearchBase implements INode {
|
||||
constructor() {
|
||||
super()
|
||||
this.label = 'Redis Load Existing Index'
|
||||
this.name = 'RedisIndex'
|
||||
this.version = 1.0
|
||||
this.description = 'Load existing index from Redis (i.e: Document has been upserted)'
|
||||
}
|
||||
|
||||
async constructVectorStore(embeddings: Embeddings, indexName: string, _: Document<Record<string, any>>[]): Promise<VectorStore> {
|
||||
const storeConfig: RedisVectorStoreConfig = {
|
||||
redisClient: this.redisClient,
|
||||
indexName: indexName
|
||||
}
|
||||
|
||||
return new RedisVectorStore(embeddings, storeConfig)
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
return super.init(nodeData, _, options, undefined)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: RedisExisting_VectorStores }
|
||||
Reference in New Issue
Block a user