BraveSearchWrapper#

class langchain_community.utilities.brave_search.BraveSearchWrapper[source]#

Bases: BaseModel

Wrapper around the Brave search engine.

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 api_key: str [Required]#

The API key to use for the Brave search engine.

param base_url: str = 'https://api.search.brave.com/res/v1/web/search'#

The base URL for the Brave search engine.

param search_kwargs: dict [Optional]#

Additional keyword arguments to pass to the search request.

download_documents(query: str) List[Document][source]#

Query the Brave search engine and return the results as a list of Documents.

Parameters:

query (str) – The query to search for.

Return type:

List[Document]

Returns: The results as a list of Documents.

run(query: str) str[source]#

Query the Brave search engine and return the results as a JSON string.

Parameters:

query (str) – The query to search for.

Return type:

str

Returns: The results as a JSON string.