From 1c7eb2cf0f3b6a0570da851b259259c6bda55f0e Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 16 Jan 2024 00:28:22 -0300 Subject: [PATCH] Add WolframAlphaAPIWrapper with appid configuration --- .../utilities/WolframAlphaAPIWrapper.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/backend/langflow/components/utilities/WolframAlphaAPIWrapper.py b/src/backend/langflow/components/utilities/WolframAlphaAPIWrapper.py index 5456c6f50..025998b05 100644 --- a/src/backend/langflow/components/utilities/WolframAlphaAPIWrapper.py +++ b/src/backend/langflow/components/utilities/WolframAlphaAPIWrapper.py @@ -1,7 +1,7 @@ from langflow import CustomComponent from typing import Callable, Union - +from langchain_community.utilities.wolfram_alpha import WolframAlphaAPIWrapper # Since all the fields in the JSON have show=False, we will only create a basic component # without any configurable fields. @@ -10,13 +10,9 @@ class WolframAlphaAPIWrapperComponent(CustomComponent): description = "Wrapper for Wolfram Alpha." def build_config(self): - # No fields with show=True are available according to the JSON configuration, - # so we return an empty config. - return {} + return { + "appid": {"display_name": "App ID", "type": "str", "password": True} + } - def build(self) -> Union[Callable, object]: - # Since we are not given any specific implementation details or associated classes, - # we will simply return an object that represents the WolframAlphaAPIWrapper without - # initializing any specific fields. In a real scenario, this would be replaced with - # the actual instantiation of the WolframAlphaAPIWrapper class. - return object() # Placeholder for actual WolframAlphaAPIWrapper class instantiation. + def build(self,appid:str) -> Union[Callable, WolframAlphaAPIWrapper]: + return WolframAlphaAPIWrapper(wolfram_alpha_appid=appid) \ No newline at end of file