Skip to content

The agent engineering platform.

Add a batch_size param to the add_texts API of pinecone wrapper (#1658)

Abhinav Upadhyay84cd825a0e77
diff --git a/langchain/vectorstores/pinecone.py b/langchain/vectorstores/pinecone.py
index 1f0d09a3cf..6dfef7b704 100644
--- a/langchain/vectorstores/pinecone.py
+++ b/langchain/vectorstores/pinecone.py
@@ -56,6 +56,7 @@ class Pinecone(VectorStore):
metadatas: Optional[List[dict]] = None,
ids: Optional[List[str]] = None,
namespace: Optional[str] = None,
+ batch_size: int = 32,
**kwargs: Any,
) -> List[str]:
"""Run more texts through the embeddings and add to the vectorstore.
@@ -79,7 +80,7 @@ class Pinecone(VectorStore):
metadata[self._text_key] = text
docs.append((ids[i], embedding, metadata))
# upsert to Pinecone
- self._index.upsert(vectors=docs, namespace=namespace)
+ self._index.upsert(vectors=docs, namespace=namespace, batch_size=batch_size)
return ids
def similarity_search_with_score(