Skip to content

Commit

Permalink
Bugfix: Don't pass empty list of embeddings to elasticsearch store wh…
Browse files Browse the repository at this point in the history
…en using sparse strategy (#14918)

* Bugfix: Don't pass empty list of embeddings to elasticsearch store when using sparse strategy.

* bump version and add comment

---------

Co-authored-by: Jimmy Longley <jimmy@booknooklearning.com>
  • Loading branch information
JLongley and Jimmy Longley authored Jul 24, 2024
1 parent 3eea9f9 commit 34dec27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ async def async_add(
if not self._store.num_dimensions:
self._store.num_dimensions = len(embeddings[0])

# Omit the vectors argument entirely if embeddings aren't generated.
if not any(embeddings):
embeddings = None

return await self._store.add_texts(
texts=texts,
metadatas=metadatas,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exclude = ["**/BUILD"]
license = "MIT"
name = "llama-index-vector-stores-elasticsearch"
readme = "README.md"
version = "0.2.2"
version = "0.2.3"

[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
Expand Down

0 comments on commit 34dec27

Please sign in to comment.