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) → List[Tuple[Document, float]][source]¶
Run similarity search with distance.
similarity_search_with_score_by_vector(embedding: List[float], k: int = 4) → List[Tuple[Document, float]][source]¶
Return docs most similar to embedding vector.
No support for filter query (on metadata) along with vector search.
Parameters
embedding (str) – Embedding to look up documents similar to.
k (int) – Number of Documents to return. Defaults to 4.
Returns
List of (Document, score), the most similar to the query vector.
similarity_search_with_score_id(query: str, k: int = 4) → List[Tuple[Document, float, str]][source]¶
similarity_search_with_score_id_by_vector(embedding: List[float], k: int = 4) → List[Tuple[Document, float, str]][source]¶
Return docs most similar to embedding vector.
No support for filter query (on metadata) along with vector search.
Parameters
embedding (str) – Embedding to look up documents similar to.
k (int) – Number of Documents to return. Defaults to 4.
Returns
List of (Document, score, id), the most similar to the query vector.
Examples using Cassandra¶
Cassandra