GoogleScholarAPIWrapper#

class langchain_community.utilities.google_scholar.GoogleScholarAPIWrapper[source]#

Bases: 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.

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:

from langchain_community.utilities import GoogleScholarAPIWrapper google_scholar = GoogleScholarAPIWrapper() google_scholar.run(β€˜langchain’)

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 hl: str = 'en'#
param lr: str = 'lang_en'#
param serp_api_key: str | None = None#
param top_k_results: int = 10#
run(query: str) β†’ str[source]#

Run query through GoogleSearchScholar and parse result

Parameters:

query (str) –

Return type:

str

Examples using GoogleScholarAPIWrapper