Skip to content

Commit

Permalink
feat(add_texts): ensure index readiness
Browse files Browse the repository at this point in the history
  • Loading branch information
orkhank committed Nov 11, 2024
1 parent f9e0f24 commit 6cd571f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libs/partners/pinecone/langchain_pinecone/vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ def add_texts(
for metadata, text in zip(metadatas, texts):
metadata[self._text_key] = text

initial_vector_count = self._get_vector_count()

# For loops to avoid memory issues and optimize when using HTTP based embeddings
# The first loop runs the embeddings, it benefits when using OpenAI embeddings
# The second loops runs the pinecone upsert asynchronously.
Expand Down Expand Up @@ -323,6 +325,8 @@ def add_texts(
**kwargs,
)

asyncio.run(self._wait_on_index(len(texts) + initial_vector_count))

return ids

def similarity_search_with_score(
Expand Down

0 comments on commit 6cd571f

Please sign in to comment.