Skip to content

Search

Shows how to search the web using Exa's AI-powered search.

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
using var client = new ExaClient(apiKey);

// Search the web for relevant results using a natural language query.
var response = await client.SearchAsync(new AllOf<SearchRequest2, CommonRequest>
{
    Value1 = new SearchRequest2
    {
        Query = "Latest developments in LLM capabilities",
    },
    Value2 = new CommonRequest
    {
        NumResults = 5,
    },
});

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

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