Skip to content

Commit

Permalink
fixed pinecone type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AmoghTantradi committed Jan 16, 2025
1 parent 1782281 commit 0621b9b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lotus/vector_store/pinecone_vs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from lotus.vector_store.vs import VS

try:
from pinecone import Pinecone
from pinecone import Index, Pinecone
except ImportError as err:
raise ImportError(
"The pinecone library is required to use PineconeVS. Install it with `pip install pinecone`",
Expand All @@ -21,7 +21,7 @@ def __init__(self, api_key: str, embedding_model: Callable[[pd.Series | list], N
"""Initialize Pinecone client with API key and environment"""
super().__init__(embedding_model)
self.pinecone = Pinecone(api_key=api_key)
self.pc_index = None
self.pc_index:Index | None = None
self.max_batch_size = max_batch_size


Expand Down Expand Up @@ -140,6 +140,11 @@ def get_vectors_from_index(self, collection_name: str, ids: list[int]) -> NDArra
if self.pc_index is None or self.collection_name != collection_name:
self.load_index(collection_name)

if self.pc_index is None: # Add this check after load_index
raise ValueError("Failed to initialize Pinecone index")



# Fetch vectors from Pinecone
vectors = []
for doc_id in ids:
Expand Down

0 comments on commit 0621b9b

Please sign in to comment.