Share via


BingConnector Class

A search engine connector that uses the Bing Search API to perform a web search.

Initializes a new instance of the BingConnector class.

Constructor

BingConnector(api_key: str | None = None, custom_config: str | None = None, env_file_path: str | None = None, env_file_encoding: str | None = None)

Parameters

Name Description
api_key
<xref:<xref:semantic_kernel.connectors.search_engine.str | None>>

The Bing Search API key. If provided, will override the value in the env vars or .env file.

Default value: None
custom_config
<xref:<xref:semantic_kernel.connectors.search_engine.str | None>>

The Bing Custom Search instance's unique identifier. If provided, will override the value in the env vars or .env file.

Default value: None
env_file_path
<xref:<xref:semantic_kernel.connectors.search_engine.str | None>>

The optional path to the .env file. If provided, the settings are read from this file path location.

Default value: None
env_file_encoding
<xref:<xref:semantic_kernel.connectors.search_engine.str | None>>

The optional encoding of the .env file.

Default value: None

Methods

search

Returns the search results of the query provided by pinging the Bing web search API.

Returns the search results of the query provided by pinging the Bing web search API.

async search(query: str, num_results: int = 1, offset: int = 0) -> list[str]

Parameters

Name Description
query
Required
num_results
Default value: 1
offset
Default value: 0