persist() → None[source]#
Persist the collection.
similarity_search(query: str, k: int = 4, **kwargs: Any) → List[langchain.schema.Document][source]#
Return docs most similar to query.
Parameters
query – text to embed and run the query on.
k – Number of Documents to return.
Defaults to 4.
query – Text to look up documents similar to.
embedding – Embedding function to use.
Defaults to None.
k – Number of Documents to return.
Defaults to 4.
distance_metric – L2 for Euclidean, L1 for Nuclear, max
L-infinity distance, cos for cosine similarity, ‘dot’ for dot product
Defaults to L2.
filter – Attribute filter by metadata example {‘key’: ‘value’}.
Defaults to None.
maximal_marginal_relevance – Whether to use maximal marginal relevance.
Defaults to False.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
Defaults to 20.
return_score – Whether to return the score. Defaults to False.
Returns
List of Documents most similar to the query vector.
similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) → List[langchain.schema.Document][source]#
Return docs most similar to embedding vector.
Parameters
embedding – Embedding to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query vector.
similarity_search_with_score(query: str, distance_metric: str = 'L2', k: int = 4, filter: Optional[Dict[str, str]] = None) → List[Tuple[langchain.schema.Document, float]][source]#
Run similarity search with Deep Lake with distance returned.
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/vectorstores.html