Skip to content

Commit

Permalink
Fix error querying PineconeVectorStore using sparse query mode (run-l…
Browse files Browse the repository at this point in the history
…lama#12967)

* fix sparse query pinecone

* none checking
  • Loading branch information
Javtor authored and mattf committed Apr 25, 2024
1 parent 77459a7 commit 3028f7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,13 @@ def query(self, query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResul
"values": [v * (1 - query.alpha) for v in sparse_vector["values"]],
}

query_embedding = None
# pinecone requires a query embedding, so default to 0s if not provided
if query.query_embedding is not None:
dimension = len(query.query_embedding)
else:
dimension = self._pinecone_index.describe_index_stats()["dimension"]
query_embedding = [0.0] * dimension

if query.mode in (VectorStoreQueryMode.DEFAULT, VectorStoreQueryMode.HYBRID):
query_embedding = cast(List[float], query.query_embedding)
if query.alpha is not None:
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-pinecone"
readme = "README.md"
version = "0.1.4"
version = "0.1.5"

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

0 comments on commit 3028f7d

Please sign in to comment.