langchain_community.utilities.google_serper
.GoogleSerperAPIWrapper¶
- class langchain_community.utilities.google_serper.GoogleSerperAPIWrapper[source]¶
Bases:
BaseModel
Wrapper around the Serper.dev Google Search API.
You can create a free API key at https://serper.dev.
To use, you should have the environment variable
SERPER_API_KEY
set with your API key, or pass serper_api_key as a named parameter to the constructor.Example
from langchain_community.utilities import GoogleSerperAPIWrapper google_serper = GoogleSerperAPIWrapper()
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- param aiosession: Optional[ClientSession] = None¶
- param gl: str = 'us'¶
- param hl: str = 'en'¶
- param k: int = 10¶
- param serper_api_key: Optional[str] = None¶
- param tbs: Optional[str] = None¶
- param type: Literal['news', 'search', 'places', 'images'] = 'search'¶
- async aresults(query: str, **kwargs: Any) Dict [source]¶
Run query through GoogleSearch.
- Parameters
query (str) –
kwargs (Any) –
- Return type
Dict
- async arun(query: str, **kwargs: Any) str [source]¶
Run query through GoogleSearch and parse result async.
- Parameters
query (str) –
kwargs (Any) –
- Return type
str