Skip to content

Find Similar

Shows how to find pages similar to a given URL using Exa.

This example assumes using Exa; is in scope and apiKey contains your Exa API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
using var client = new ExaClient(apiKey);

// Find pages similar to a given URL. This is useful for discovering
// related content, competitor analysis, or expanding a research corpus.
var response = await client.FindSimilarAsync(new AllOf<FindSimilarRequest2, CommonRequest>
{
    Value1 = new FindSimilarRequest2
    {
        Url = "https://arxiv.org/abs/2307.06435",
    },
    Value2 = new CommonRequest
    {
        NumResults = 3,
    },
});

Console.WriteLine($"Found {response.Results!.Count} similar pages");

foreach (var result in response.Results)
{
    Console.WriteLine($"  - {result.Value1?.Title} (score: {result.Value1?.Score:F4})");
}