mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
Merge branch 'main' into feature/LlamaIndex
# Conflicts: # packages/components/nodes/agents/ConversationalAgent/ConversationalAgent.ts # packages/components/nodes/agents/ConversationalRetrievalAgent/ConversationalRetrievalAgent.ts # packages/components/nodes/agents/OpenAIAssistant/OpenAIAssistant.ts # packages/components/nodes/agents/OpenAIFunctionAgent/OpenAIFunctionAgent.ts # packages/components/nodes/chains/ConversationChain/ConversationChain.ts # packages/components/nodes/chains/ConversationalRetrievalQAChain/ConversationalRetrievalQAChain.ts # packages/components/nodes/memory/BufferMemory/BufferMemory.ts # packages/components/nodes/memory/BufferWindowMemory/BufferWindowMemory.ts # packages/components/nodes/memory/ConversationSummaryMemory/ConversationSummaryMemory.ts # packages/components/nodes/memory/DynamoDb/DynamoDb.ts # packages/components/nodes/memory/MongoDBMemory/MongoDBMemory.ts # packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts # packages/components/nodes/memory/RedisBackedChatMemory/RedisBackedChatMemory.ts # packages/components/nodes/memory/UpstashRedisBackedChatMemory/UpstashRedisBackedChatMemory.ts # packages/components/nodes/memory/ZepMemory/ZepMemory.ts # packages/components/src/utils.ts # packages/server/marketplaces/chatflows/Long Term Memory.json # packages/server/src/index.ts # packages/server/src/utils/index.ts
This commit is contained in:
@@ -5,6 +5,7 @@ import { Embeddings } from 'langchain/embeddings/base'
|
||||
import { Document } from 'langchain/document'
|
||||
import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||
import { addMMRInputParams, resolveVectorStoreOrRetriever } from '../VectorStoreUtils'
|
||||
|
||||
class Pinecone_VectorStores implements INode {
|
||||
label: string
|
||||
@@ -23,11 +24,11 @@ class Pinecone_VectorStores implements INode {
|
||||
constructor() {
|
||||
this.label = 'Pinecone'
|
||||
this.name = 'pinecone'
|
||||
this.version = 1.0
|
||||
this.version = 2.0
|
||||
this.type = 'Pinecone'
|
||||
this.icon = 'pinecone.png'
|
||||
this.icon = 'pinecone.svg'
|
||||
this.category = 'Vector Stores'
|
||||
this.description = `Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database`
|
||||
this.description = `Upsert embedded data and perform similarity or mmr search using Pinecone, a leading fully managed hosted vector database`
|
||||
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
|
||||
this.badge = 'NEW'
|
||||
this.credential = {
|
||||
@@ -79,6 +80,7 @@ class Pinecone_VectorStores implements INode {
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
addMMRInputParams(this.inputs)
|
||||
this.outputs = [
|
||||
{
|
||||
label: 'Pinecone Retriever',
|
||||
@@ -103,11 +105,9 @@ class Pinecone_VectorStores implements INode {
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData)
|
||||
const pineconeEnv = getCredentialParam('pineconeEnv', credentialData, nodeData)
|
||||
|
||||
const client = new Pinecone({
|
||||
apiKey: pineconeApiKey,
|
||||
environment: pineconeEnv
|
||||
apiKey: pineconeApiKey
|
||||
})
|
||||
|
||||
const pineconeIndex = client.Index(index)
|
||||
@@ -140,17 +140,12 @@ class Pinecone_VectorStores implements INode {
|
||||
const pineconeMetadataFilter = nodeData.inputs?.pineconeMetadataFilter
|
||||
const docs = nodeData.inputs?.document as Document[]
|
||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||
const output = nodeData.outputs?.output as string
|
||||
const topK = nodeData.inputs?.topK as string
|
||||
const k = topK ? parseFloat(topK) : 4
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData)
|
||||
const pineconeEnv = getCredentialParam('pineconeEnv', credentialData, nodeData)
|
||||
|
||||
const client = new Pinecone({
|
||||
apiKey: pineconeApiKey,
|
||||
environment: pineconeEnv
|
||||
apiKey: pineconeApiKey
|
||||
})
|
||||
|
||||
const pineconeIndex = client.Index(index)
|
||||
@@ -175,14 +170,7 @@ class Pinecone_VectorStores implements INode {
|
||||
|
||||
const vectorStore = await PineconeStore.fromExistingIndex(embeddings, obj)
|
||||
|
||||
if (output === 'retriever') {
|
||||
const retriever = vectorStore.asRetriever(k)
|
||||
return retriever
|
||||
} else if (output === 'vectorStore') {
|
||||
;(vectorStore as any).k = k
|
||||
return vectorStore
|
||||
}
|
||||
return vectorStore
|
||||
return resolveVectorStoreOrRetriever(nodeData, vectorStore)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class Pinecone_Existing_VectorStores implements INode {
|
||||
this.name = 'pineconeExistingIndex'
|
||||
this.version = 1.0
|
||||
this.type = 'Pinecone'
|
||||
this.icon = 'pinecone.png'
|
||||
this.icon = 'pinecone.svg'
|
||||
this.category = 'Vector Stores'
|
||||
this.description = 'Load existing index from Pinecone (i.e: Document has been upserted)'
|
||||
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
|
||||
@@ -95,11 +95,9 @@ class Pinecone_Existing_VectorStores implements INode {
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData)
|
||||
const pineconeEnv = getCredentialParam('pineconeEnv', credentialData, nodeData)
|
||||
|
||||
const client = new Pinecone({
|
||||
apiKey: pineconeApiKey,
|
||||
environment: pineconeEnv
|
||||
apiKey: pineconeApiKey
|
||||
})
|
||||
|
||||
const pineconeIndex = client.Index(index)
|
||||
|
||||
@@ -34,7 +34,7 @@ class PineconeLlamaIndex_VectorStores implements INode {
|
||||
this.name = 'pineconeLlamaIndex'
|
||||
this.version = 1.0
|
||||
this.type = 'Pinecone'
|
||||
this.icon = 'pinecone.png'
|
||||
this.icon = 'pinecone.svg'
|
||||
this.category = 'Vector Stores'
|
||||
this.description = `Upsert embedded data and perform similarity search upon query using Pinecone, a leading fully managed hosted vector database`
|
||||
this.baseClasses = [this.type, 'VectorIndexRetriever']
|
||||
@@ -106,12 +106,10 @@ class PineconeLlamaIndex_VectorStores implements INode {
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData)
|
||||
const pineconeEnv = getCredentialParam('pineconeEnv', credentialData, nodeData)
|
||||
|
||||
const pcvs = new PineconeVectorStore({
|
||||
indexName,
|
||||
apiKey: pineconeApiKey,
|
||||
environment: pineconeEnv,
|
||||
namespace: pineconeNamespace
|
||||
})
|
||||
|
||||
@@ -150,12 +148,10 @@ class PineconeLlamaIndex_VectorStores implements INode {
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData)
|
||||
const pineconeEnv = getCredentialParam('pineconeEnv', credentialData, nodeData)
|
||||
|
||||
const obj: PineconeParams = {
|
||||
indexName,
|
||||
apiKey: pineconeApiKey,
|
||||
environment: pineconeEnv
|
||||
apiKey: pineconeApiKey
|
||||
}
|
||||
|
||||
if (pineconeNamespace) obj.namespace = pineconeNamespace
|
||||
@@ -186,7 +182,6 @@ class PineconeLlamaIndex_VectorStores implements INode {
|
||||
type PineconeParams = {
|
||||
indexName: string
|
||||
apiKey: string
|
||||
environment: string
|
||||
namespace?: string
|
||||
chunkSize?: number
|
||||
queryFilter?: object
|
||||
@@ -197,7 +192,6 @@ class PineconeVectorStore implements VectorStore {
|
||||
db?: Pinecone
|
||||
indexName: string
|
||||
apiKey: string
|
||||
environment: string
|
||||
chunkSize: number
|
||||
namespace?: string
|
||||
queryFilter?: object
|
||||
@@ -205,7 +199,6 @@ class PineconeVectorStore implements VectorStore {
|
||||
constructor(params: PineconeParams) {
|
||||
this.indexName = params?.indexName
|
||||
this.apiKey = params?.apiKey
|
||||
this.environment = params?.environment
|
||||
this.namespace = params?.namespace ?? ''
|
||||
this.chunkSize = params?.chunkSize ?? Number.parseInt(process.env.PINECONE_CHUNK_SIZE ?? '100')
|
||||
this.queryFilter = params?.queryFilter ?? {}
|
||||
@@ -214,8 +207,7 @@ class PineconeVectorStore implements VectorStore {
|
||||
private async getDb(): Promise<Pinecone> {
|
||||
if (!this.db) {
|
||||
this.db = new Pinecone({
|
||||
apiKey: this.apiKey,
|
||||
environment: this.environment
|
||||
apiKey: this.apiKey
|
||||
})
|
||||
}
|
||||
return Promise.resolve(this.db)
|
||||
|
||||
@@ -25,7 +25,7 @@ class PineconeUpsert_VectorStores implements INode {
|
||||
this.name = 'pineconeUpsert'
|
||||
this.version = 1.0
|
||||
this.type = 'Pinecone'
|
||||
this.icon = 'pinecone.png'
|
||||
this.icon = 'pinecone.svg'
|
||||
this.category = 'Vector Stores'
|
||||
this.description = 'Upsert documents to Pinecone'
|
||||
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
|
||||
@@ -96,11 +96,9 @@ class PineconeUpsert_VectorStores implements INode {
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData)
|
||||
const pineconeEnv = getCredentialParam('pineconeEnv', credentialData, nodeData)
|
||||
|
||||
const client = new Pinecone({
|
||||
apiKey: pineconeApiKey,
|
||||
environment: pineconeEnv
|
||||
apiKey: pineconeApiKey
|
||||
})
|
||||
|
||||
const pineconeIndex = client.Index(index)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,12 @@
|
||||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="14" cy="28" r="1.5" fill="black"/>
|
||||
<path d="M16 16L17 11M17 11L14 12.5M17 11L19 13.5" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M19.5 24L21.95 27.6568M21.95 27.6568L23.0106 24.4749M21.95 27.6568L18.768 27.3033" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M22 12.5L25.6516 10.1213M25.6516 10.1213L22.4696 9.06066M25.6516 10.1213L25.298 13.3033" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M12 10.4095L9.22528 7.54574M9.22528 7.54574L8.72713 10.8626M9.22528 7.54574L12.4207 7.3473" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M9.24639 22.7722L6.1657 25.2398M6.1657 25.2398L6.38213 21.8927M6.1657 25.2398L9.24639 26.1113" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M23 19L27 20M27 20L25.5 17M27 20L24.5 22" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M9 16.5L5 16M5 16L6.5 19M5 16L7.5 14" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M17.5 8L18.5 3M18.5 3L15.5 4.5M18.5 3L20.5 5.5" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M14.5 24L15.5 19M15.5 19L12.5 20.5M15.5 19L17.5 21.5" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
Reference in New Issue
Block a user