Skip to content

As Tool Search Returns Results

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
using var client = new TavilyClient(apiKey);

var tool = client.AsSearchTool(maxResults: 3);
var result = await tool.InvokeAsync(
    new AIFunctionArguments(new Dictionary<string, object?>
    {
        ["query"] = "latest .NET release",
    }));

var text = result?.ToString();