Skip to content

Commit 2824f36

Browse files
authored
Add namespace to Pinecone.from_index (#716)
Resolves #718
1 parent d4f719c commit 2824f36

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

langchain/vectorstores/pinecone.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,11 @@ def from_texts(
224224

225225
@classmethod
226226
def from_existing_index(
227-
cls, index_name: str, embedding: Embeddings, text_key: str = "text"
227+
cls,
228+
index_name: str,
229+
embedding: Embeddings,
230+
text_key: str = "text",
231+
namespace: Optional[str] = None,
228232
) -> Pinecone:
229233
"""Load pinecone vectorstore from index name."""
230234
try:
@@ -235,4 +239,6 @@ def from_existing_index(
235239
"Please install it with `pip install pinecone-client`."
236240
)
237241

238-
return cls(pinecone.Index(index_name), embedding.embed_query, text_key)
242+
return cls(
243+
pinecone.Index(index_name, namespace), embedding.embed_query, text_key
244+
)

0 commit comments

Comments
 (0)