Skip to content

Commit

Permalink
un-overload the term qdrant_client
Browse files Browse the repository at this point in the history
  • Loading branch information
nsheff committed Sep 13, 2023
1 parent 37eb839 commit bb0654c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions bbconf/bbconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self, config_path: str = None, database_only: bool = False):

try:
_LOGGER.debug("Setting up qdrant database connection...")
self._qdrant_client = self._init_qdrant_client()
self._qdrant_backend = self._init_qdrant_backend()
if self.config[CFG_PATH_KEY].get(CFG_PATH_REGION2VEC_KEY) and self.config[
CFG_PATH_KEY
].get(CFG_PATH_VEC2VEC_KEY):
Expand Down Expand Up @@ -416,10 +416,10 @@ def t2bsi(self) -> text2bednn.Text2BEDSearchInterface:
return self._t2bsi

@property
def qdrant_client(self) -> QdrantBackend:
return self._qdrant_client
def qdrant_backend(self) -> QdrantBackend:
return self._qdrant_backend

def _init_qdrant_client(self) -> QdrantBackend:
def _init_qdrant_backend(self) -> QdrantBackend:
"""
Create qdrant client object using credentials provided in config file
:return: QdrantClient
Expand All @@ -439,7 +439,7 @@ def _create_t2bsi_object(self):
return text2bednn.Text2BEDSearchInterface(
nl2vec_model=SentenceTransformer(os.getenv("HF_MODEL", DEFAULT_HF_MODEL)),
vec2vec_model=self._config[CFG_PATH_KEY][CFG_PATH_VEC2VEC_KEY],
search_backend=self.qdrant_client,
search_backend=self.qdrant_backend,
)

def add_bed_to_qdrant(
Expand Down Expand Up @@ -469,7 +469,8 @@ def add_bed_to_qdrant(

# Upload bed file vector to the database
vec_dim = bed_embedding.shape[0]
self.qdrant_client.load(
self.qdrant_backend.load(
id=sample_id,
embeddings=bed_embedding.reshape(1, vec_dim),
labels=[{"id": sample_id, **labels}],
)
Expand Down

0 comments on commit bb0654c

Please sign in to comment.