mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 07:01:04 +03:00
Document Store - Phase 2 (#2912)
* Document Store - Phase 2 * Adding additional columns for vector store config, document store phase 2 * Adding additional columns for vector store config, document store phase 2 * Document Store - Phase 2 - Upsert and Query * ux cleanup * retrieval settings and more ux changes * adding MMR params to execution * Making the upsert process async. * add upsert history changes * making the searchParams dynamic * removing unnecessary params * add ability to delete data from vector store * update margin for vector store query * adding option to save config in the retrieval playground * adding chunk number for query return chunks * Adding a Document Store node in the VectorStore category * update doc store status, ui touchup --------- Co-authored-by: Henry <hzj94@hotmail.com>
This commit is contained in:
@@ -184,6 +184,45 @@ class Pinecone_VectorStores implements INode {
|
||||
} catch (e) {
|
||||
throw new Error(e)
|
||||
}
|
||||
},
|
||||
async delete(nodeData: INodeData, ids: string[], options: ICommonObject): Promise<void> {
|
||||
const _index = nodeData.inputs?.pineconeIndex as string
|
||||
const pineconeNamespace = nodeData.inputs?.pineconeNamespace as string
|
||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||
const pineconeTextKey = nodeData.inputs?.pineconeTextKey as string
|
||||
const recordManager = nodeData.inputs?.recordManager
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData)
|
||||
|
||||
const client = getPineconeClient({ apiKey: pineconeApiKey })
|
||||
|
||||
const pineconeIndex = client.Index(_index)
|
||||
|
||||
const obj: PineconeStoreParams = {
|
||||
pineconeIndex,
|
||||
textKey: pineconeTextKey || 'text'
|
||||
}
|
||||
|
||||
if (pineconeNamespace) obj.namespace = pineconeNamespace
|
||||
const pineconeStore = new PineconeStore(embeddings, obj)
|
||||
|
||||
try {
|
||||
if (recordManager) {
|
||||
const vectorStoreName = pineconeNamespace
|
||||
await recordManager.createSchema()
|
||||
;(recordManager as any).namespace = (recordManager as any).namespace + '_' + vectorStoreName
|
||||
const keys: string[] = await recordManager.listKeys({})
|
||||
|
||||
await pineconeStore.delete({ ids: keys })
|
||||
await recordManager.deleteKeys(keys)
|
||||
} else {
|
||||
const pineconeStore = new PineconeStore(embeddings, obj)
|
||||
await pineconeStore.delete({ ids })
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user