A lightweight C# wrapper for Google Vertex AI Search. The retired Google Custom Search Engine API is not supported.
The client accepts exactly these credentials:
PROJECT_ID: Google Cloud project IDAPP_ID: Vertex AI Search app/engine IDAPI_KEY: Google Cloud API key with Discovery Engine API access
$env:PROJECT_ID="your-project-id"
$env:APP_ID="your-app-id"
$env:API_KEY="your-api-key"using GoogleCSE;
var searcher = new GoogleSearch(
projectId: "your-project-id",
appId: "your-app-id",
apiKey: "YOUR_API_KEY");
var results = searcher.Search("dotnet tutorials");
foreach (var item in results)
{
Console.WriteLine($"{item.Title}: {item.Url}");
}To limit a website search to a URL pattern, pass siteSearch as the second argument:
var results = searcher.Search(
"dotnet tutorials",
siteSearch: "https://example.com/docs/*");This sends the Vertex AI Search filter expression siteSearch:"https://example.com/docs/*".
Optional constructor arguments configure the Vertex request: location, pageSize, maxPages, and start.
The included console application reads only PROJECT_ID, APP_ID, and API_KEY.
dotnet run --project GoogleCSE/GoogleCSE.TestApp/GoogleCSE.TestApp.csprojSee:
https://docs.cloud.google.com/generative-ai-app-builder/docs/migrate-from-cse#api-key-deploy