feat: add ComponentTool to support converting Component to Tool (#3412)

* feat: Add ComponentTool to convert a Component to a Tool

* test(component): add unit test for ComponentTool with ChatInput input.

* feat: Add method to convert Component to ComponentTool.

* feat: Add unit test for ChatInput to Tool conversion.

* chore: add comment

* test: fix assertion

---------

Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-08-19 14:05:59 -03:00 • committed by GitHub
commit 75dbb68dfc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 125 additions and 0 deletions

View file

@ -0,0 +1,16 @@
import pytest
from langflow.components.inputs.ChatInput import ChatInput
@pytest.fixture
def client():
pass
def test_component_to_tool():
chat_input = ChatInput()
tool = chat_input.to_tool()
assert tool.name == "ChatInput"
assert tool.description == "Get chat inputs from the Playground."
assert tool.component._id == chat_input._id