Skip to content

Commit

Permalink
degrade gracefully if no text2bednn
Browse files Browse the repository at this point in the history
  • Loading branch information
nsheff committed Nov 9, 2023
1 parent 39de45b commit abd9077
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions bbconf/bbconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def search_bed_by_text(
"""
if self._t2bsi is None:
raise BedBaseConfError(
"Can't perform search, qdrant_db credentials are not provided in config file"
"Can't perform search, ensure qdrant_db credentials in config file"
)
return self._t2bsi.nl_vec_search(query)

Expand Down Expand Up @@ -506,11 +506,15 @@ def _create_t2bsi_object(self) -> text2bednn.Text2BEDSearchInterface:
:return: Text2BEDSearchInterface object
"""

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_backend,
)
try:
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_backend,
)
except Exception as e:
_LOGGER.error("Error in creating Text2BEDSearchInterface object: " + str(e))
return None

def add_bed_to_qdrant(
self,
Expand Down

0 comments on commit abd9077

Please sign in to comment.