Skip to content

Commit

Permalink
* fix(embedding.py): handle single string input in embed_documents
Browse files Browse the repository at this point in the history
…method
  • Loading branch information
NirantK committed Sep 27, 2023
1 parent ac6b8c9 commit 589105c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fastembed/embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ def embed(self, documents: List[str], batch_size: int = 256) -> Iterable[np.ndar
Returns:
List of embeddings, one per document
"""
if type(documents) == str:
documents = [documents]
# TODO: Replace loop with parallelized batching
if len(documents) >= batch_size:
for i in range(0, len(documents), batch_size):
Expand Down

0 comments on commit 589105c

Please sign in to comment.