Skip to content

Search Tool

Shows how to use Serper as an AIFunction tool with any IChatClient.

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

1
2
3
4
using var client = new SerperClient(apiKey);

// Create a Google search tool from the Serper client for use with any IChatClient.
var tool = client.AsSearchTool(numResults: 3);