Skip to content

Commit

Permalink
fix: bug where the pinecone component was inserting embeddings three …
Browse files Browse the repository at this point in the history
…times instead of once. (langflow-ai#2826)

fixed the bug where pinecone component inserts embeddings 3 times

When we send the chunks with the embedding component to the Pinecone component, the generated embeddings are being saved three times instead of once.
  • Loading branch information
pavan555 authored Jul 22, 2024
1 parent ff592d7 commit 9731ebb
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class PineconeVectorStoreComponent(LCVectorStoreComponent):
documentation = "https://python.langchain.com/v0.2/docs/integrations/vectorstores/pinecone/"
name = "Pinecone"
icon = "Pinecone"
pinecone_instance = None

inputs = [
StrInput(name="index_name", display_name="Index Name", required=True),
Expand Down Expand Up @@ -61,6 +62,8 @@ def build_vector_store(self) -> Pinecone:
return self._build_pinecone()

def _build_pinecone(self) -> Pinecone:
if self.pinecone_instance is not None:
return self.pinecone_instance
from langchain_pinecone._utilities import DistanceStrategy
from langchain_pinecone.vectorstores import Pinecone

Expand All @@ -85,7 +88,7 @@ def _build_pinecone(self) -> Pinecone:

if documents:
pinecone.add_documents(documents)

self.pinecone_instance = pinecone
return pinecone

def search_documents(self) -> List[Data]:
Expand Down

0 comments on commit 9731ebb

Please sign in to comment.