Refactor build method in JsonToolkitComponent

This commit is contained in:
anovazzi1 2024-01-16 16:49:50 -03:00
commit 0a21f2b453

View file

@ -1,5 +1,4 @@
from langflow import CustomComponent
from langflow.field_typing import Tool
from langchain_community.tools.json.tool import JsonSpec
from langchain_community.agent_toolkits.json.toolkit import JsonToolkit
@ -13,7 +12,5 @@ class JsonToolkitComponent(CustomComponent):
"spec": {"display_name": "Spec", "type": JsonSpec},
}
def build(self, spec: JsonSpec) -> Tool:
# Assuming JsonToolkit is the class that should be instantiated with the spec
# The actual class name should be used in place of JsonToolkit if it is different
return JsonToolkit(spec=spec) # Replace JsonToolkit with the actual class name if necessary
def build(self, spec: JsonSpec) -> JsonToolkit:
return JsonToolkit(spec=spec)