Skip to content

Commit 7541787

Browse files
committed
fix: remove empty contents from embedding request
1 parent 1e25ce5 commit 7541787

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/embedders/classification/contextual.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ def _encode(
142142
self, documents: List[Union[str, Doc]], fit_model: bool
143143
) -> Generator[List[List[float]], None, None]:
144144
for documents_batch in util.batch(documents, self.batch_size):
145-
documents_batch = [doc.replace("\n", " ") for doc in documents_batch]
145+
documents_batch = [
146+
doc.replace("\n", " ") for doc in filter(None, documents_batch)
147+
]
146148
try:
147149
if self.use_azure:
148150
embeddings = []

0 commit comments

Comments
 (0)