langflow
langflow copied to clipboard
feat: Table Input for tools metadata (tool name and description) in component as tools
Merge to main only after https://github.com/langflow-ai/langflow/pull/4946
This pull request includes several changes to the backend components and workflows. The most important changes focus on enhancing the component tools with metadata handling, and updating various component definitions.
Component Tools Enhancements:
- Updated
ComponentToolkit
class insrc/backend/base/langflow/base/tools/component_tool.py
to include metadata handling for tools. Added a new methodupdate_tools_metadata
to update tool names and descriptions based on provided metadata. [1] [2] - Introduced a new constant
TOOLS_METADATA_INPUT_NAME
insrc/backend/base/langflow/base/tools/constants.py
.
Component Definitions Updates:
- Added an
icon
attribute to theSQLDatabaseComponent
class insrc/backend/base/langflow/components/langchain_utilities/sql_database.py
. - Replaced
FloatInput
withSliderInput
for thetemperature
field inOpenAIModelComponent
class insrc/backend/base/langflow/components/models/openai.py
.
Custom Component Enhancements:
- Updated
run_and_validate_update_outputs
method insrc/backend/base/langflow/custom/custom_component/component.py
to handle tool metadata input. - Modified
to_toolkit
method to update tools metadata if available. Added a new method_build_tools_metadata_input
to build tool metadata input. [1] [2]