Skip to content

Commit

Permalink
linting fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adolkhan committed May 15, 2023
1 parent b3947e6 commit bfdcd17
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
8 changes: 5 additions & 3 deletions deeplake/client/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import deeplake
import requests
from typing import Optional, List
from typing import Any, Optional, List, Tuple
from deeplake.util.exceptions import (
AgreementNotAcceptedError,
AuthorizationException,
Expand Down Expand Up @@ -490,7 +490,9 @@ def connect_dataset_entry(

return response["generated_id"]

def remote_query(self, org_id: str, ds_name: str, query_string: str) -> List[int]:
def remote_query(
self, org_id: str, ds_name: str, query_string: str
) -> Tuple[Any, Any]:
"""Queries a remote dataset.
Args:
Expand All @@ -510,7 +512,7 @@ def remote_query(self, org_id: str, ds_name: str, query_string: str) -> List[int

indicies = response["indices"]
if len(indicies) == 0:
return []
return [], []

scores = response.get("score")

Expand Down
6 changes: 3 additions & 3 deletions deeplake/core/vectorstore/deeplake_vectorstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
from deeplake.core.vectorstore.vector_search.ingestion import ingest_data

try:
from indra import api
from indra import api # type: ignore

_INDRA_INSTALLED = True
except Exception: # pragma: no cover
_INDRA_INSTALLED = False # pragma: no cover

import logging
from typing import Optional, Any, Iterable, List, Dict, Union
from typing import Optional, Any, Iterable, List, Dict, Union, Callable

import numpy as np

Expand All @@ -29,7 +29,7 @@ def __init__(
self,
dataset_path: str = DEFAULT_DEEPLAKE_PATH,
token: Optional[str] = None,
embedding_function: Optional[callable] = None,
embedding_function: Optional[Callable] = None,
read_only: Optional[bool] = False,
ingestion_batch_size: int = 1024,
num_workers: int = 0,
Expand Down
4 changes: 2 additions & 2 deletions deeplake/core/vectorstore/test_deeplake_vectorstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

@requires_libdeeplake
@pytest.mark.parametrize("distance_metric", ["L1", "L2", "COS", "MAX", "DOT"])
def test_search(distance_metric, hub_cloud_dev_token):
def test_search(distance_metric):
k = 4
query_embedding = np.random.randint(0, 255, (1, embedding_dim))

Expand Down Expand Up @@ -48,7 +48,7 @@ def test_search(distance_metric, hub_cloud_dev_token):
vector_store = DeepLakeVectorStore(
dataset_path="hub://activeloop-test/deeplake_vectorstore-test1",
read_only=True,
token=hub_cloud_dev_token,
# token=hub_cloud_dev_token,
)
db_engine_view, db_engine_indices, db_engine_scores = vector_store.search(
embedding=query_embedding, exec_option="db_engine"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def vector_search(
query_embedding: Union[List[float], np.ndarray[Any, Any]],
query_embedding: np.ndarray[Any, Any],
distance_metric: str,
deeplake_dataset: DeepLakeDataset,
k: int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(
self,
elements: List[Dict[str, Any]],
dataset: DeepLakeDataset,
embedding_function: Callable,
embedding_function: Optional[Callable],
ingestion_batch_size: int,
num_workers: int,
retry_attempt: int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def run_data_ingestion(
elements (List[Dict[str, Any]]): List of dictionaries. Each dictionary contains mapping of
names of 4 tensors (i.e. "embedding", "metadata", "ids", "text") to their corresponding values.
dataset (DeepLakeDataset): deeplake dataset object.
embedding_function (Callable): function used to convert query into an embedding.
embedding_function (Optional[Callable]): function used to convert query into an embedding.
ingestion_batch_size (int): The batch size to use during ingestion.
num_workers (int): The number of workers to use for ingesting data in parallel.
"""
Expand Down

0 comments on commit bfdcd17

Please sign in to comment.