Return docs most similar to query.
similarity_search_with_score(
self,
query: str,
k: int = 4,
filter: Optional[Union[Callable, Dict[str, Any]]] = None,
fetch_k: int = 20,
**kwargs: Any = {}
) -> List[Tuple[Document, float]]| Name | Type | Description |
|---|---|---|
query* | str | Text to look up documents similar to. |
k | int | Default: 4Number of Documents to return. Defaults to 4. |
filter | Optional[Dict[str, str]] | Default: NoneFilter by metadata. Defaults to None. If a callable, it must take as input the metadata dict of Document and return a bool. |
fetch_k | int | Default: 20(Optional[int]) Number of Documents to fetch before filtering. Defaults to 20. |