Refactor SerpAPIWrapperComponent class in SerpAPIWrapper.py
This commit is contained in:
parent
95b02ceeae
commit
5cc8afc557
1 changed files with 3 additions and 6 deletions
|
|
@ -1,9 +1,6 @@
|
||||||
|
|
||||||
from langflow import CustomComponent
|
from langflow import CustomComponent
|
||||||
from typing import Callable, Union
|
from typing import Callable, Union
|
||||||
|
from langchain_community.utilities import SerpAPIWrapper
|
||||||
# Assuming SerpAPIWrapper is a predefined class within the langflow context.
|
|
||||||
# If it's not, it must be defined or imported from the appropriate module.
|
|
||||||
|
|
||||||
class SerpAPIWrapperComponent(CustomComponent):
|
class SerpAPIWrapperComponent(CustomComponent):
|
||||||
display_name = "SerpAPIWrapper"
|
display_name = "SerpAPIWrapper"
|
||||||
|
|
@ -17,7 +14,7 @@ class SerpAPIWrapperComponent(CustomComponent):
|
||||||
def build(
|
def build(
|
||||||
self,
|
self,
|
||||||
serpapi_api_key: str,
|
serpapi_api_key: str,
|
||||||
) -> Union['SerpAPIWrapper', Callable]:
|
) -> Union[SerpAPIWrapper, Callable]: # Removed quotes around SerpAPIWrapper
|
||||||
# Default parameters as defined in the JSON template.
|
# Default parameters as defined in the JSON template.
|
||||||
default_params = {
|
default_params = {
|
||||||
"engine": "google",
|
"engine": "google",
|
||||||
|
|
@ -29,4 +26,4 @@ class SerpAPIWrapperComponent(CustomComponent):
|
||||||
return SerpAPIWrapper(
|
return SerpAPIWrapper(
|
||||||
serpapi_api_key=serpapi_api_key,
|
serpapi_api_key=serpapi_api_key,
|
||||||
params=default_params
|
params=default_params
|
||||||
)
|
)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue