Skip to main content

find_most_similar

AsyncMethod
This is a method of the EmbeddingAgent class in the embedding module.
Find the most similar texts to a query. # Arguments * query - Query text * candidates - List of candidate texts to compare * top_k - Number of top results to return # Returns List of SimilarityResult sorted by score (descending)

Signature

async def find_most_similar(
        &self,
        query: &str,
        candidates: &[&str],
        top_k: usize,
    ) -> Result<Vec<SimilarityResult>>

Parameters

query
&str
required
No description available.
candidates
&
required
No description available.
top_k
usize
required
No description available.

Returns

Returns
Result<Vec<SimilarityResult>>
The result of the operation.