Add WolframAlphaAPIWrapper with appid configuration
This commit is contained in:
parent
d4d3bcd7ef
commit
1c7eb2cf0f
1 changed files with 6 additions and 10 deletions
|
|
@ -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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue