> For the complete documentation index, see [llms.txt](https://docs.wisej.com/ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/ai/components/api/services/iwebsearchservice/wisej.ai.services.bingwebsearchservice.md).

# BingWebSearchService

Namespace: **Wisej.AI.Services**

Assembly: **Wisej.AI** (3.5.0.0)

* [WebSearchServiceBase](https://github.com/iceteagroup/wisej-docs-ai/blob/master/components/api/websearchservicebase/README.md)
  * [BingWebSearchService](/ai/components/api/services/iwebsearchservice/wisej.ai.services.bingwebsearchservice.md)

Represents a web search service using Bing's API.

{% tabs %}
{% tab title="C#" %}

```csharp
public class BingWebSearchService : WebSearchServiceBase
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class BingWebSearchService
    Inherits WebSearchServiceBase
```

{% endtab %}
{% endtabs %}

This class extends [WebSearchServiceBase](https://github.com/iceteagroup/wisej-docs-ai/blob/master/components/api/websearchservicebase/README.md) to provide specific implementation details for interacting with the Bing Web Search API.

## Constructors

### ![](/files/ptrKjmmRoQB76pvrIqh0) BingWebSearchService(url)

Initializes a new instance of the [BingWebSearchService](/ai/components/api/services/iwebsearchservice/wisej.ai.services.bingwebsearchservice.md) class with the specified URL.

| Name    | Type                                                          | Description                                                                                          |
| ------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| **url** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The base URL for the Bing Web Search API. Default is "<https://api.bing.microsoft.com/v7.0/search>". |

## Properties

### ![](/files/ptrKjmmRoQB76pvrIqh0) Authentication

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets the authentication header name specific to Bing's API. (Default: `"api-key"`)

The authentication header for Bing's API is "Ocp-Apim-Subscription-Key".

## Methods

### ![](/files/ptrKjmmRoQB76pvrIqh0) SearchAsync(query)

Performs an asynchronous search using Bing's Web Search API with the specified query.

| Parameter | Type                                                          | Description              |
| --------- | ------------------------------------------------------------- | ------------------------ |
| **query** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The search query string. |

**Returns:** [Task\<String>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task representing the asynchronous operation, with a result of the search response as a formatted string.

This method formats the query string, sends a GET request to the Bing API, and processes the response to extract and format the search results.

## Implements

| Name                                                                  | Description                                       |
| --------------------------------------------------------------------- | ------------------------------------------------- |
| [IWebSearchService](/ai/components/api/services/iwebsearchservice.md) | Represents a service for performing web searches. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wisej.com/ai/components/api/services/iwebsearchservice/wisej.ai.services.bingwebsearchservice.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
