Returns
List of Documents and similarity scores selected by maximal marginalrelevance and score for each.
process_index_results(ids: List[int], scores: List[float], *, k: int = 4, filter: Optional[Dict[str, Any]] = None, score_threshold: float = 1.7976931348623157e+308) → List[Tuple[Document, float]][source]¶
Turns TileDB results into a list of documents and scores.
Parameters
ids – List of indices of the documents in the index.
scores – List of distances of the documents in the index.
k – Number of Documents to return. Defaults to 4.
filter (Optional[Dict[str, Any]]) – Filter by metadata. Defaults to None.
score_threshold – Optional, a floating point value to filter the
resulting set of retrieved docs
Returns
List of Documents and scores.
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, filter: Optional[Dict[str, Any]] = None, fetch_k: int = 20, **kwargs: Any) → List[Document][source]¶
Return docs most similar to query.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
filter – (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.
fetch_k – (Optional[int]) Number of Documents to fetch before filtering.
Defaults to 20.
Returns
List of Documents most similar to the query.