You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
logging.info(f"Search result found for query: {query}")
nearest_idx=similarities.index(max_similarity)
nearest_doc=self.documents[nearest_idx]
returnnearest_doc
Right now there are some list comprehensions & reliance on list order preservation that make this hard to interpret.
The code could be made more explicit:
# Search for the most similar docmost_similar_document=Nonetop_similarity_score=0fordocindocuments:
similarity_score=self._measure_similarity(embedded_query, doc.embedding)
ifsimilarity_score>top_similarity_score:
most_similar_document=doc# Make sure it's similar enoughiftop_similarity_score<threshold:
logging.warning(
f"Max search similarity {max_similarity} below threshold {threshold}; ""no document returned."
)
returnNonereturnmost_similar_document
Shoutout to @mkozakov and Jacob-GK for flagging this!
The text was updated successfully, but these errors were encountered:
sandbox-conversant-lib/conversant/search/local_searcher.py
Lines 46 to 63 in 50dab74
Right now there are some list comprehensions & reliance on list order preservation that make this hard to interpret.
The code could be made more explicit:
Shoutout to @mkozakov and Jacob-GK for flagging this!
The text was updated successfully, but these errors were encountered: