BingSearchAPIWrapper#

class langchain_community.utilities.bing_search.BingSearchAPIWrapper[source]#

Bases: BaseModel

Wrapper for Bing Web Search API.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

param bing_search_url: str [Required]#
param bing_subscription_key: str [Required]#
param k: int = 10#
param search_kwargs: dict [Optional]#

Additional keyword arguments to pass to the search request.

results(query: str, num_results: int) List[Dict][source]#

Run query through BingSearch and return metadata.

Parameters:
  • query (str) – The query to search for.

  • num_results (int) – The number of results to return.

Returns:

snippet - The description of the result. title - The title of the result. link - The link to the result.

Return type:

A list of dictionaries with the following keys

run(query: str) str[source]#

Run query through BingSearch and parse result.

Parameters:

query (str)

Return type:

str

Examples using BingSearchAPIWrapper