mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-24 15:43:54 +00:00
added i_end in batch extraction (#907)
Fix for issue #906 Switches `[i : i + batch_size]` to `[i : i_end]` in Pinecone `from_texts` method
This commit is contained in:
parent
82c080c6e6
commit
3aa53b44dd
@ -198,17 +198,17 @@ class Pinecone(VectorStore):
|
||||
# set end position of batch
|
||||
i_end = min(i + batch_size, len(texts))
|
||||
# get batch of texts and ids
|
||||
lines_batch = texts[i : i + batch_size]
|
||||
lines_batch = texts[i:i_end]
|
||||
# create ids if not provided
|
||||
if ids:
|
||||
ids_batch = ids[i : i + batch_size]
|
||||
ids_batch = ids[i:i_end]
|
||||
else:
|
||||
ids_batch = [str(uuid.uuid4()) for n in range(i, i_end)]
|
||||
# create embeddings
|
||||
embeds = embedding.embed_documents(lines_batch)
|
||||
# prep metadata and upsert batch
|
||||
if metadatas:
|
||||
metadata = metadatas[i : i + batch_size]
|
||||
metadata = metadatas[i:i_end]
|
||||
else:
|
||||
metadata = [{} for _ in range(i, i_end)]
|
||||
for j, line in enumerate(lines_batch):
|
||||
|
Loading…
Reference in New Issue
Block a user