Skip to main content
`Ctrl`+`K`

# SerpAPI

For backwards compatiblity.

pydantic model langchain.serpapi.SerpAPIWrapper

  Wrapper around SerpAPI.

  To use, you should have the `google-search-results` python package installed, and the environment variable `SERPAPI_API_KEY` set with your API key, or pass serpapi_api_key as a named parameter to the constructor.

  Example

      from langchain import SerpAPIWrapper
      serpapi = SerpAPIWrapper()

  field aiosession: Optional[aiohttp.client.ClientSession] = None
  field params: dict = {'engine': 'google', 'gl': 'us', 'google_domain': 'google.com', 'hl': 'en'}
  field serpapi_api_key: Optional[str] = None
  async arun(query: str) → str

    Use aiohttp to run query through SerpAPI and parse result.

  get_params(query: str) → Dict[str, str]

    Get parameters for SerpAPI.

  results(query: str) → dict

    Run query through SerpAPI and return the raw result.

  run(query: str) → str

    Run query through SerpAPI and parse result.