[Feature] Add support for python 3.13 and other migration related fixes (#1279)

This commit is contained in:
Deshraj Yadav
2024-02-21 13:04:03 -08:00
committed by GitHub
parent 2b2263acaa
commit f8f69eab03
8 changed files with 101 additions and 185 deletions

View File

@@ -2,7 +2,7 @@
[alembic]
# path to migration scripts
script_location = embedchain/migrations
script_location = embedchain:migrations
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
# Uncomment the line below if you want the files to be prepended with date and time

View File

@@ -6,7 +6,7 @@ try:
import pinecone
except ImportError:
raise ImportError(
"Pinecone requires extra dependencies. Install with `pip install --upgrade 'embedchain[pinecone]'`"
"Pinecone requires extra dependencies. Install with `pip install pinecone-text pinecone-client`"
) from None
from pinecone_text.sparse import BM25Encoder
@@ -102,9 +102,10 @@ class PineconeDB(BaseVectorDB):
existing_ids = list()
metadatas = []
batch_size = 100
if ids is not None:
for i in range(0, len(ids), 1000):
result = self.pinecone_index.fetch(ids=ids[i : i + 1000])
for i in range(0, len(ids), batch_size):
result = self.pinecone_index.fetch(ids=ids[i : i + batch_size])
vectors = result.get("vectors")
batch_existing_ids = list(vectors.keys())
existing_ids.extend(batch_existing_ids)