Return docs and relevance scores in the range [0, 1].
0 is dissimilar, 1 is most similar.
Parameters
query – input text
k – Number of Documents to return. Defaults to 4.
**kwargs – kwargs to be passed to similarity search. Should include:
score_threshold: Optional, a floating point value between 0 to 1 to
filter the resulting set of retrieved docs
Returns
List of Tuples of (doc, similarity_score)
similarity_search_with_score(query: str, k: int = 4, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Search for similar documents to the query string.
Parameters
query (str) – The query string to search for.
k (int, optional) – The number of results to return. Defaults to 4.
kwargs (Any) – Vector Store specific search parameters. The following are
forwarded to the Momento Vector Index:
top_k (-) – The number of results to return.
Returns
A list of tuples of the form(Document, score).
Return type
List[Tuple[Document, float]]
similarity_search_with_score_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Search for similar documents to the query vector.
Parameters
embedding (List[float]) – The query vector to search for.
k (int, optional) – The number of results to return. Defaults to 4.
kwargs (Any) – Vector Store specific search parameters. The following are
forwarded to the Momento Vector Index:
top_k (-) – The number of results to return.
Returns
A list of tuples of the form(Document, score).
Return type
List[Tuple[Document, float]]