Skip to content

Commit

Permalink
fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
DosticJelena committed Nov 22, 2023
1 parent 5381f5c commit b821625
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions llama_index/vector_stores/pinecone.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def build_sparse_dict(input_batch: List[List[int]]) -> List[Dict[str, Any]]:

def encode_batch(
sparse_encoder: VectorStoreSparseEncoder, context_batch: List[str], query_mode: bool
) -> List[float]:
) -> List[Dict[str, Any]]:
try:
import pinecone_text.sparse

Expand Down Expand Up @@ -294,7 +294,7 @@ def add(

if self.add_sparse_vector and self._tokenizer is not None:
sparse_vector = generate_sparse_vectors(
self.sparse_vector_encoder,
self.sparse_vector_encoder, # type: ignore
[node.get_content(metadata_mode=MetadataMode.EMBED)],
self._tokenizer,
)[0]
Expand Down Expand Up @@ -333,10 +333,13 @@ def client(self) -> Any:

def query(self, query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult:
# Check vector store and query mode compatibility
if not self.add_sparse_vector and query.mode in (VectorStoreQueryMode.HYBRID, VectorStoreQueryMode.SPARSE):
if not self.add_sparse_vector and query.mode in (
VectorStoreQueryMode.HYBRID,
VectorStoreQueryMode.SPARSE,
):
raise ValueError(
"""Cannot query PineconeVectorStore in HYBRID or SPARSE mode because
the vector store doesn't include sparse values. To have them please
"""Cannot query PineconeVectorStore in HYBRID or SPARSE mode because
the vector store doesn't include sparse values. To have them please
set add_sparse_vectors to True during the PineconeVectorStore initialization."""
)

Expand All @@ -357,7 +360,7 @@ def query(self, query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResul
)

sparse_vector = generate_sparse_vectors(
self.sparse_vector_encoder,
self.sparse_vector_encoder, # type: ignore
[query.query_str],
self._tokenizer,
query_mode=True,
Expand Down

0 comments on commit b821625

Please sign in to comment.