From 5cc8afc55761a20c957025ddc21dbe6f50daaf2f Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 9 Jan 2024 18:42:45 -0300 Subject: [PATCH] Refactor SerpAPIWrapperComponent class in SerpAPIWrapper.py --- .../langflow/components/utilities/SerpAPIWrapper.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/backend/langflow/components/utilities/SerpAPIWrapper.py b/src/backend/langflow/components/utilities/SerpAPIWrapper.py index 9fd37bb48..0d93dbc91 100644 --- a/src/backend/langflow/components/utilities/SerpAPIWrapper.py +++ b/src/backend/langflow/components/utilities/SerpAPIWrapper.py @@ -1,9 +1,6 @@ - from langflow import CustomComponent from typing import Callable, Union - -# Assuming SerpAPIWrapper is a predefined class within the langflow context. -# If it's not, it must be defined or imported from the appropriate module. +from langchain_community.utilities import SerpAPIWrapper class SerpAPIWrapperComponent(CustomComponent): display_name = "SerpAPIWrapper" @@ -17,7 +14,7 @@ class SerpAPIWrapperComponent(CustomComponent): def build( self, serpapi_api_key: str, - ) -> Union['SerpAPIWrapper', Callable]: + ) -> Union[SerpAPIWrapper, Callable]: # Removed quotes around SerpAPIWrapper # Default parameters as defined in the JSON template. default_params = { "engine": "google", @@ -29,4 +26,4 @@ class SerpAPIWrapperComponent(CustomComponent): return SerpAPIWrapper( serpapi_api_key=serpapi_api_key, params=default_params - ) + ) \ No newline at end of file