Source code for langchain_community.utilities.google_scholar
"""Util that calls Google Scholar Search."""
from typing import Dict, Optional
from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator
from langchain_core.utils import get_from_dict_or_env
[docs]class GoogleScholarAPIWrapper(BaseModel):
    """Wrapper for Google Scholar API
    You can create serpapi key by signing up at: https://serpapi.com/users/sign_up.
    The wrapper uses the serpapi python package:
    https://serpapi.com/integrations/python#search-google-scholar
    To use, you should have the environment variable ``SERP_API_KEY``
    set with your API key, or pass `serp_api_key` as a named parameter
    to the constructor.
    Attributes:
        top_k_results: number of results to return from google-scholar query search.
            By default it returns top 10 results.
        hl: attribute defines the language to use for the Google Scholar search.
            It's a two-letter language code.
            (e.g., en for English, es for Spanish, or fr for French). Head to the
            Google languages page for a full list of supported Google languages:
            https://serpapi.com/google-languages
        lr: attribute defines one or multiple languages to limit the search to.
            It uses lang_{two-letter language code} to specify languages
            and | as a delimiter. (e.g., lang_fr|lang_de will only search French
            and German pages). Head to the Google lr languages for a full
            list of supported languages: https://serpapi.com/google-lr-languages
     Example:
        .. code-block:: python
        from langchain_community.utilities import GoogleScholarAPIWrapper