Update GoogleSearchAPIWrapperComponent parameters

This commit is contained in:
anovazzi1 2024-01-15 22:24:47 -03:00
commit ab35550240

View file

@ -1,10 +1,6 @@
from langflow import CustomComponent
from typing import Optional, Union, Callable
# Assuming GoogleSearchAPIWrapper is a valid import based on JSON
# and it exists in some module that should be imported here.
# The import path should be replaced with the correct one once available.
from typing import Union, Callable
from langchain_community.utilities.google_search import GoogleSearchAPIWrapper
@ -16,12 +12,11 @@ class GoogleSearchAPIWrapperComponent(CustomComponent):
return {
"google_api_key": {"display_name": "Google API Key", "password": True},
"google_cse_id": {"display_name": "Google CSE ID","password":True},
# Fields with "show": False are omitted based on the rules
}
def build(
self,
google_api_key: Optional[str] = None,
google_cse_id: Optional[str] = None,
google_api_key: str,
google_cse_id: str,
) -> Union[GoogleSearchAPIWrapper, Callable]:
return GoogleSearchAPIWrapper(google_api_key=google_api_key, google_cse_id=google_cse_id)