mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-19 14:01:50 +00:00
community: fix Google Scholar tool errors (#29371)
Resolve https://github.com/langchain-ai/langchain/issues/27557
This commit is contained in:
parent
a1e62070d0
commit
ec0ebb76f2
@ -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",
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user