> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Find Most Similar • Rust AI Agent SDK

> find_most_similar: Find the most similar texts to a query. # Arguments * `query` - Query text * `candidates` - List of candidate texts to compare * `top_k` - Number of...

# find\_most\_similar

<div className="flex items-center gap-2">
  <Badge color="blue">Async</Badge>
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**EmbeddingAgent**](../classes/EmbeddingAgent) class in the [**embedding**](../modules/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

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async def find_most_similar(
        &self,
        query: &str,
        candidates: &[&str],
        top_k: usize,
    ) -> Result<Vec<SimilarityResult>>
```

## Parameters

<ParamField query="query" type="&str" required={true}>
  No description available.
</ParamField>

<ParamField query="candidates" type="&" required={true}>
  No description available.
</ParamField>

<ParamField query="top_k" type="usize" required={true}>
  No description available.
</ParamField>

### Returns

<ResponseField name="Returns" type="Result<Vec<SimilarityResult>>">
  The result of the operation.
</ResponseField>
