mostRelevantDocuments
Retrieves the most relevant documents matching the provided query, ranked by their similarity scores in descending order. Only documents with a similarity score greater than or equal to the specified similarity threshold are included, and the result set is limited to the specified count.
Example:
mostRelevantDocuments("tigers in the wild nature", 10)
- returns top-10 most relevant documents about tigers in the wild naturemostRelevantDocuments("tigers in the wild nature", similarityThreshold = 0.7)
- returns all documents about tigers in the wild nature that have at least 70% similarity (relevance) scoremostRelevantDocuments("tigers in the wild nature", similarityThreshold = 0.7, count = 10)
- returns no more than 10 most relevant documents about tigers in the wild nature that have at least 70% similarity (relevance) score
Return
An iterable collection of the most relevant documents that satisfy the specified filters and rankings.
Parameters
The search query used to find relevant documents.
The maximum number of documents to return. Defaults to Int.MAX_VALUE if not specified.
The minimum similarity score a document must have to be considered relevant. Defaults to 0.0 if not specified.