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, filter: Optional[List[Namespace]] = None, **kwargs: Any) → List[Document][source]¶
Return docs most similar to query.
Parameters
query – The string that will be used to search for similar documents.
k – The amount of neighbors that will be retrieved.
filter – Optional. A list of Namespaces for filtering the matching results.
For example:
[Namespace(“color”, [“red”], []), Namespace(“shape”, [], [“squared”])]
will match datapoints that satisfy “red color” but not include
datapoints with “squared shape”. Please refer to
https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#json
for more detail.
Returns
A list of k matching documents.
similarity_search_by_vector(embedding: List[float], k: int = 4, filter: Optional[List[Namespace]] = None, **kwargs: Any) → List[Document][source]¶
Return docs most similar to the embedding.
Parameters
embedding – Embedding to look up documents similar to.
k – The amount of neighbors that will be retrieved.
filter – Optional. A list of Namespaces for filtering the matching results.
For example:
[Namespace(“color”, [“red”], []), Namespace(“shape”, [], [“squared”])]
will match datapoints that satisfy “red color” but not include
datapoints with “squared shape”. Please refer to