# IWebSearchService

URL: https://docs.wisej.ai/components/built-in-services/iwebsearchservice

## Overview

TheIWebSearchService offers web search capabilities. Currently, the only implemented consumer of this service is the [`WebSearchTools`](/components/api/wisej.ai.tools.websearchtools) . However, you can also incorporate this service into your own tools as needed.

Implementing this service is straightforward, as it requires only a single property and one method. The property, `MaxSites` , is used to limit the number of search results returned. The [SearchAsync(query)](/components/api/iwebsearchservice/#searchasync-query) method is responsible for returning the search results.

The result is a single string that is included in the RAG (Retrieve-and-Generate) context. You can format this string as you wish, but it's essential that the AI can discern both the URL and a snippet or abstract text from it. The built-in services typically format the result as follows:

```text
URL: url
Abstract: text
===
```

## Default Implementation

The IWebSearchService interface offers several built-in implementations: [BingWebSearchService](/components/api/wisej.ai.services.bingwebsearchservice) , [BraveWebSearchService](/components/api/wisej.ai.services.bravewebsearchservice) , and [GoogleWebSearchService](/components/api/wisej.ai.services.googlewebsearchservice) .

You can download the [`BingWebSearchService`](/components/api/wisej.ai.services.bingwebsearchservice) implementation below, which serves as a basic guideline for setting up your own web search service.

> 📄 **[BingWebSearchService.cs](/assets/files/BingWebSearchService-11bd881296a882a3309bdfda30cef425.cs)** (download)

> 📄 **[WebSearchServiceBase.cs](/assets/files/WebSearchServiceBase-4d834f4e07df1c32c49849c64d2304bb.cs)** (download)

- C# - VB.NET

```csharp
internal static class Program
{
  static Program()
  {
    Application.Services
      .AddOrReplaceService<IWebSearchService, MySerpAPIService>();
  }
}
```

```vbnet
Module Program
    Shared Sub New()
        Application.Services.AddOrReplaceService( _
            Of IWebSearchService, MySerpAPIService)()
    End Sub
End Class
```
