📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

XiansAi.Agent.GoogleSearch

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

XiansAi.Agent.GoogleSearch

A Google Search implementation for AI agents that provides structured search results from Google Custom Search API.

1.0.2
NuGet
Version published
Maintainers
1
Created
Source

Google Search Engine

A lightweight C# library for integrating Google's Custom Search JSON API into your applications. This library provides a simple interface to perform web searches programmatically using Google's search capabilities.

Features

  • Easy-to-use interface for Google Custom Search
  • Async/await support
  • Configurable search results limit
  • Strong error handling
  • Fully documented API

Prerequisites

Before using this library, you'll need:

  • An API key from supported service
  • .NET 8.0 or later

Installation

Install the package via NuGet:

dotnet add package XiansAi.Agent.GoogleSearch

Usage

Here's a basic example of how to use the library:

using XiansAi.Agent.GoogleSearch;

// Initialize the search engine
var apiKey = "your_api_key";
var searchEngine = new SearchEngine(apiKey);

try
{
    // Perform a search with a limit of 5 results
    var results = await searchEngine.SearchAsync("NoIsolation AS Norway", 5);
    
    // Process the results
    foreach (var item in results.Items)
    {
        Console.WriteLine($"Title: {item.Title}");
        Console.WriteLine($"URL: {item.Link}");
        Console.WriteLine($"Snippet: {item.Snippet}");
        Console.WriteLine();
    }
}
catch (SearchException ex)
{
    Console.WriteLine($"Search failed: {ex.Message}");
    throw;
}

Error Handling

The library throws SearchException for any API-related errors. Always wrap your search calls in a try-catch block to handle potential errors gracefully.

License

This project is licensed under 99x commercial license. Contact 99x for more information.

Support

For support, please open an issue in the GitHub repository.

Keywords

ai

FAQs

Package last updated on 12 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts