to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
search(query: str, search_type: str, **kwargs: Any) → List[Document]¶
Return docs most similar to query using specified search type.
similarity_search(query: str, k: int = 4, search_filter: Optional[Dict[str, Any]] = None, **kwargs: Any) → List[Document][source]¶
Perform similarity retrieval based on text.
:param query: Vectorize text for retrieval.，should not be empty.
:param k: top n.
:param search_filter: Additional filtering conditions.
Returns
List of documents.
Return type
document_list
similarity_search_by_vector(embedding: List[float], k: int = 4, search_filter: Optional[dict] = None, **kwargs: Any) → List[Document][source]¶
Perform retrieval directly using vectors.
:param embedding: vectors.
:param k: top n.
:param search_filter: Additional filtering conditions.
Returns
List of documents.
Return type
document_list
similarity_search_with_relevance_scores(query: str, k: int = 4, search_filter: Optional[dict] = None, **kwargs: Any) → List[Tuple[Document, float]][source]¶
Perform similarity retrieval based on text with scores.
:param query: Vectorize text for retrieval.，should not be empty.
:param k: top n.
:param search_filter: Additional filtering conditions.
Returns
List of documents.
Return type
document_list
similarity_search_with_score(*args: Any, **kwargs: Any) → List[Tuple[Document, float]]¶
Run similarity search with distance.
Examples using AlibabaCloudOpenSearch¶
Alibaba Cloud OpenSearch