Skip to content

Commit

Permalink
community: fix Google Scholar tool errors (#29371)
Browse files Browse the repository at this point in the history
Resolve #27557
  • Loading branch information
tanys123 authored Jan 23, 2025
1 parent a1e6207 commit ec0ebb7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class GoogleScholarAPIWrapper(BaseModel):
hl: str = "en"
lr: str = "lang_en"
serp_api_key: Optional[str] = None
google_scholar_engine: Any = None

model_config = ConfigDict(
extra="forbid",
Expand All @@ -55,7 +56,7 @@ class GoogleScholarAPIWrapper(BaseModel):
def validate_environment(cls, values: Dict) -> Any:
"""Validate that api key and python package exists in environment."""
serp_api_key = get_from_dict_or_env(values, "serp_api_key", "SERP_API_KEY")
values["SERP_API_KEY"] = serp_api_key
values["serp_api_key"] = serp_api_key

try:
from serpapi import GoogleScholarSearch
Expand Down

0 comments on commit ec0ebb7

Please sign in to comment.