Skip to content

Commit

Permalink
Fix on embeddings list
Browse files Browse the repository at this point in the history
  • Loading branch information
Vits-99 committed Sep 20, 2024
1 parent 79f50b4 commit 2764adf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion semantic_router/encoders/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ def __call__(self, docs: List[str]) -> List[List[float]]:
outputs = self.query({"inputs": batch, "parameters": {}})
if not outputs or len(outputs) == 0:
raise ValueError("No embeddings returned from the query.")
embeddings = embeddings + outputs
if isinstance(outputs[0], list):
embeddings.extend(outputs)

Check warning on line 224 in semantic_router/encoders/huggingface.py

View check run for this annotation

Codecov / codecov/patch

semantic_router/encoders/huggingface.py#L224

Added line #L224 was not covered by tests
else:
embeddings.append(outputs)
except Exception as e:
raise ValueError(f"No embeddings returned for batch. Error: {e}") from e

Check warning on line 228 in semantic_router/encoders/huggingface.py

View check run for this annotation

Codecov / codecov/patch

semantic_router/encoders/huggingface.py#L228

Added line #L228 was not covered by tests

Expand Down

0 comments on commit 2764adf

Please sign in to comment.