* Add `required_inputs` field to `Output` model in `base.py`
* Refactor ComponentTool to ComponentToolkit and enhance tool creation logic
- Replaced `ComponentTool` with `ComponentToolkit` to better encapsulate component-related tools.
- Introduced `build_description` and `_build_output_function` helper functions for dynamic tool creation.
- Updated tool initialization to handle multiple outputs and required inputs using `StructuredTool`.
- Improved schema creation for tool arguments based on component inputs.
* Refactor `to_tool` method to `to_toolkit` to use `ComponentToolkit` instead of `ComponentTool`
* Refactor `ComponentTool` to `ComponentToolkit` in unit tests
- Updated import statements to reflect the new `ComponentToolkit` class.
- Modified test logic to use `ComponentToolkit` for retrieving tools.
- Adjusted assertions to match the new structure and output format.
- Ensured compatibility with `Message` schema for output validation.
* Refactor `test_component_to_tool` to validate `ComponentToolkit` and tool properties
* Refactor `build_description` to include input types in the output format
* Add method to set required inputs for outputs based on method analysis
- Introduced `_set_output_required_inputs` method to determine and set required inputs for each output by analyzing the method's source code.
- Added necessary imports (`ast` and `dedent`) to support the new functionality.
* Update test to assert full tool description in test_component_to_tool.py
* Add unit tests for verifying required inputs of various components
- Added tests to ensure that required inputs for outputs are present in the inputs of `ChatInput`, `ChatOutput`, `SequentialTaskComponent`, `ToolCallingAgentComponent`, and `OpenAIModelComponent`.
- Included helper functions to check if required inputs are in inputs and to assert that all outputs have different required inputs.
* Add RequiredInputsVisitor to identify required inputs in AST nodes
- Introduced RequiredInputsVisitor class to traverse AST nodes and collect required inputs.
- The visitor checks for 'self' attributes matching the provided inputs and adds them to the required_inputs set.
* Refactor required inputs extraction using `RequiredInputsVisitor`
* Add feature flags configuration for toolkit output in settings
* Add toolkit output handling based on feature flag in custom component utils
* Add method to append 'component_as_tool' output in custom component
* Add unit test for toolkit output feature flag in custom component
* Add utility functions for lazy loading and instantiating input types in langflow
- Introduced `get_InputTypesMap` for lazy loading of `InputTypesMap`.
- Added `instantiate_input` function to create instances of input types dynamically.
- Included type checking and error handling for invalid input types.
* Refactor input instantiation logic and update imports
- Removed `instantiate_input` function from `inputs.py` and moved it to `utils.py`.
- Updated imports in `base.py` to reflect the new location of `instantiate_input`.
- Added missing import for `Callable` in `base.py`.
* Refactor import statement to use `instantiate_input` from `langflow.inputs.utils` in test_inputs.py
* Add TOOL_OUTPUT_NAME constant to tools module
* Add type checking and TOOL_OUTPUT_NAME filter in ComponentToolkit
- Introduced `TYPE_CHECKING` for type hints to avoid circular imports.
- Added `TOOL_OUTPUT_NAME` constant to filter specific outputs in `ComponentToolkit`.
- Updated type annotations to use forward references.
* Refactor component toolkit import to avoid circular dependency and use constant for tool output name
* Refactor `ComponentToolkit` class to remove inheritance from `BaseToolkit` and add an initializer for `component`
* Add unit test for ComponentToolkit in test_component_to_tool
- Added `test_component_to_tool_has_no_component_as_tool` to verify that `ComponentToolkit` correctly initializes with a `ChatInput` component and returns the expected tools.
* Refactor toolkit output handling to `custom_component` module
* fix: mypy errors union-attr and arg-type
* Add 'OTHER' field type to schema in langflow/io/schema.py
* Add tool name formatting to ComponentToolkit to ensure valid characters
* Refactor toolkit output handling and add type hint for `to_toolkit` method
* Add `is_interface_component` attribute to vertex types and update import order
* Add tests for ToolCallingAgentComponent and ChatOutput with API key handling
- Updated `test_component_tool` to reflect new description format.
- Added `test_component_tool_with_api_key` to test `ToolCallingAgentComponent` with `ChatOutput` and OpenAI API key.
- Enabled `add_toolkit_output` feature flag for testing.
* Refactor `_find_matching_output_method` to accept `input_name` parameter for more precise input-output matching
* Replace ValueError with warning in build_description function
* use chat_output component directly in set
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 3/3)
* Refactor: Reorder method calls in `__init__` for logical consistency
Moved `set_class_code` method call to ensure output types and required inputs are set before class code initialization.
* Update _format_tool_name to allow '.' in tool names
* Refactor `_format_tool_name` to remove non-alphanumeric characters
* Update test assertions for component tool name and output mapping
* Handle case where 'required_inputs' is empty in 'component_tool.py'
* Refactor import statements for better readability in `base.py`
* [autofix.ci] apply automated fixes
* Add noqa comment to suppress import warning and re-add Any import in base.py
---------
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* Add endpoint to update session ID for messages in monitor API
* Add tests for updating session ID in messages endpoint
- Added test to successfully update session ID for all messages with the old session ID.
- Added test to handle case where no messages are found with the given session ID.
---------
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
* 🐛 (model.py): fix issue where message.files was not being updated correctly when image_paths is empty in MessageBase class
* 🐛 (model.py): simplify condition for checking if image_paths is not empty to improve readability and maintainability
* [autofix.ci] apply automated fixes
* 🔧 (OutputParser.py): refactor error message handling for unsupported or missing parser to improve readability and maintainability
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* add-note
* notes
* vector-store-rag-notes
* vector-store-rag-notes
* comma
* comma
* revert
* add-notes
* another-way
* revert
* revert
* fix
* descriptions
* lightbulb
* deployed-size
* size
* size
* resizing-is-true
* targethandle
* double
* set-components
* pin
* notes
* fix
* dont-change-code
* cleanup
* update example
* fix postion on example
* fix-descriptions
* swap-link
* newline-and-lightbulb
* another-docs-link
* play-button
* remove-double
* update NODE_FORMAT_ATTRIBUTES to prevent description updates on examples
* Update AstraDB documentation link
* update documentation on code
* ✨ (chatInputOutputUser-shard-0.spec.ts): update the test to click on the last element with the text "Playground" to ensure correct element is clicked
* 🐛 (Basic Prompting.spec.ts): fix clicking on "Playground" element by selecting the last occurrence to ensure correct element is clicked
* ✨ (Blog Writer.spec.ts): update test to click on the last element with text "Playground" to ensure correct element is clicked on the page
* ✨ (Dynamic Agent.spec.ts): update test to click on the last element with text "Playground" to ensure correct element is clicked on the page
* 🐛 (decisionFlow.spec.ts): fix clicking on "Playground" button by selecting the last element with the text "Playground" to ensure correct element is clicked
* 🐛 (generalBugs-shard-3.spec.ts): fix clicking on "Playground" button by selecting the last occurrence to prevent ambiguity
* 🐛 (generalBugs-shard-0.spec.ts): fix clicking on "Playground" button by selecting the last element with the text "Playground" to ensure correct element is clicked
* 🐛 (general-bugs-shard-3836.spec.ts): fix clicking on "Playground" button by selecting the last element with the text "Playground" to ensure correct element is clicked
* ✨ (chatInputOutputUser-shard-2.spec.ts): update test to click on the last element with text "Playground" to ensure correct interaction with chat input/output feature
* ✨ (stop-button-playground.spec.ts): update test to click on the last occurrence of the text "Playground" to ensure correct element is clicked
* 🐛 (limit-file-size-upload.spec.ts): fix selector to click on the last element with text "Playground" instead of the first one
* ✨ (fileUploadComponent.spec.ts): update test to click on the last element with text "Playground" to ensure correct element is clicked on the page
* ✨ (chatInputOutput.spec.ts): update test to click on the last occurrence of the "Playground" text to ensure correct element is clicked
* 🐛 (generalBugs-shard-9.spec.ts): fix clicking on "Playground" element by selecting the last occurrence to prevent flakiness in tests
* 🐛 (Document QA.spec.ts): fix clicking on "Playground" element by selecting the last occurrence to ensure correct element is clicked
* ✨ (similarity.spec.ts): update click method to target the last occurrence of "Playground" text to ensure correct element is clicked
* 🐛 (Simple Agent.spec.ts): fix clicking on "Playground" button by selecting the last element with the text to avoid ambiguity
* ✨ (textInputOutput.spec.ts): update test script to target the last occurrence of the "Playground" text element to ensure correct interaction with the UI.
* ✨ (Travel Planning Agent.spec.ts): Update the selector for the "Playground" text to ensure the correct element is clicked on the page.
* 🐛 (Vector Store.spec.ts): fix clicking on "Playground" element by selecting the last one to avoid ambiguity
* ✨ (generalBugs-shard-9.spec.ts): add click action on the last element with test id "title-Prompt" to improve test coverage and interaction with the page
---------
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
* Add fixture for creating flow component in tests
* Add test for reading flows with components only in test_database.py
* Add `components_only` parameter to filter flows by components in API endpoint
* 📝 (StoreMessage.py): Change StrInput to MessageInput for sender, sender_name, and session_id inputs to improve clarity and consistency in the code.
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* Fix flaky tests in `test_schema.py` by using sets for type comparisons
- Updated `post_process_type` function assertions to use sets for more reliable type comparisons.
- Adjusted imports for better code organization.
* Fix import order in test_database.py
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* 📝 (constants.ts): increase maxSizeFilesInBytes constant value from 10MB to 100MB to allow larger file uploads
* 🐛 (inputFileComponent): fix bug in setting the maximum file size alert message to display the correct file size limit of 100 bytes instead of 10 bytes
* 📝 (schemas.py): Add a new field_serializer method to serialize data in VertexBuildResponse class
📝 (schemas.py): Add a new truncate_text helper function to safely truncate text in nested dictionaries
📝 (model.py): Add a new field_serializer method to serialize outputs in TransactionBase class
📝 (model.py): Add a new truncate_text helper function to safely truncate text in nested dictionaries
📝 (model.py): Add a new field_serializer method to serialize data and artifacts in VertexBuildBase class
📝 (model.py): Add a new truncate_text helper function to safely truncate text in nested dictionaries
* 🐛 (schemas.py): fix truncation length of text fields to 10 characters instead of 99999
🐛 (model.py): fix truncation length of text fields to 10 characters instead of 99999
🐛 (model.py): fix truncation length of text fields to 10 characters instead of 99999
🐛 (index.tsx): truncate resultMessage to 99999 characters and add message if text is too long
* 🔧 (switchOutputView/index.tsx): Use useMemo to memoize resultMessage transformations for performance optimization
* 🐛 (model.py): Fix typo in the path for 'base_retriever' data field
🐛 (model.py): Fix typo in the path for 'base_retriever' data field
🐛 (model.py): Fix typo in the path for 'base_retriever' data field
🐛 (model.py): Fix typo in the path for 'base_retriever' data field
🐛 (index.tsx): Fix logic to correctly handle resultMessageMemoized when it is an object
* 📝 (model.py): refactor truncate_text function to truncate_long_strings for better clarity and consistency
📝 (model.py): update serialize_outputs and serialize_artifacts functions to use truncate_long_strings for string truncation
📝 (model.py): introduce MAX_TEXT_LENGTH constant for defining the maximum length of text to truncate in the models
* 📝 (schemas.py): refactor serialize_data method in VertexBuildResponse class to use a new helper function truncate_long_strings for better code readability and maintainability
* 🔧 (schemas.py): Move the `truncate_long_strings` function to a separate module to improve code organization and reusability
🔧 (model.py): Import the `truncate_long_strings` function from the correct module to fix the reference error
🔧 (model.py): Import the `truncate_long_strings` function from the correct module to fix the reference error
* 📝 (util.py): add function truncate_long_strings to recursively truncate long strings in dictionaries and lists to prevent exceeding the maximum text length.
* 📝 (constants.py): add constant MAX_TEXT_LENGTH with value 99999 for defining maximum text length allowed in the application
* 📝 (model.py): update import path for truncate_long_strings function to match new location in util module
* ✨ (test_truncate_long_strings_on_objects.py): Add unit tests for the function truncate_long_strings to ensure correct behavior when truncating long strings in various data structures
🐛 (switchOutputView/index.tsx): Fix truncation logic to correctly truncate long strings by adding ellipsis at the end instead of displaying additional text about truncation.
* [autofix.ci] apply automated fixes
* ✨ (test_truncate_long_strings_on_objects.py): Update import path for truncate_long_strings function
📝 (test_truncate_long_strings_on_objects.py): Add additional tests for handling negative, zero, and small max_length values in truncate_long_strings function
* ♻️ (schemas.py): refactor import statement to use the updated module name util_strings instead of util for better clarity and consistency.
* 📝 (model.py): Update import path for util_strings module to fix module import error
📝 (util.py): Remove redundant code for truncating long strings and move it to a separate util_strings module for better organization and separation of concerns.
* 📝 (schemas.py): refactor serialize_data method to handle both BaseModel and non-BaseModel data inputs in VertexBuildResponse class
* 📝 (util_strings.py): Update util_strings.py to improve string truncation function for dictionaries and lists
🔧 (test_truncate_long_strings_on_objects.py): Update test cases for string truncation function to cover additional scenarios and edge cases
* Update src/backend/base/langflow/utils/util_strings.py
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* 📝 (vite.config.mts): update environment variable MAX_FILE_SIZE to be defined in vite config for frontend to use in the application.
* 📝 (constants.ts): update maxSizeFilesInBytes constant to use process.env.MAX_FILE_SIZE environment variable for configurable file size limit
📝 (constants.ts): add MAX_TEXT_LENGTH constant with a value of 99999 for maximum text length limit
* 📝 (switchOutputView/index.tsx): import MAX_TEXT_LENGTH constant from shared constants file to improve code organization and reusability
* ✨ (langflow/__main__.py): add support for defining maximum file size for upload in MB to improve user experience and prevent large file uploads
* 🐛 (files.py): add validation to check if uploaded file size exceeds the maximum allowed size before processing it
* ✨ (schemas.py): add max_file_size_upload field to ConfigResponse schema to handle maximum file size allowed for upload
* 🔧 (vite.config.mts): remove MAX_FILE_SIZE environment variable configuration as it is no longer needed
* ✨ (base.py): introduce max_file_size_upload setting to limit the file size for uploads in MB
* 🐛 (util.py): add support for setting max_file_size_upload in update_settings function to allow configuring maximum file size for uploads
* 📝 (inputFileComponent/index.tsx): add support for retrieving max file size upload from utility store to improve code modularity and reusability
🐛 (inputFileComponent/index.tsx): fix error handling logic to display error message when uploading a file fails
* 📝 (constants.ts): remove maxSizeFilesInBytes constant as it is no longer used and update MAX_TEXT_LENGTH constant to a higher value
* ✨ (use-get-config.ts): add functionality to set max file size upload value from config response
* ✨ (utilityStore.ts): introduce maxFileSizeUpload property and setMaxFileSizeUpload function to handle maximum file size upload in bytes
* ✨ (frontend): introduce maxFileSizeUpload property and setMaxFileSizeUpload method to handle maximum file size upload functionality in the UtilityStoreType
* ♻️ (util_strings.py): refactor truncate_long_strings function to improve code readability and consistency by removing unnecessary whitespace and aligning assignment operators.
* 🐛 (files.py): fix formatting issue in the raise statement to improve code readability and maintain consistency
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* Fix: Handle group nodes in graph sorting
- Added `get_root_of_group_node` function to identify the root of a group node.
- Updated `sort_up_to_vertex` to use `get_root_of_group_node` for handling group nodes.
- Modified `__filter_vertices` to pass `parent_node_map` to `sort_up_to_vertex`.
* Refactor: Update NodeStatus component to handle group nodes and improve build status handling
* [autofix.ci] apply automated fixes
* Update type hint for parent_node_map in sort_up_to_vertex function
---------
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* ✨ (frontend_node/base.py): add metadata attribute to store additional information for the component node
* ✨ (constants.py): add 'metadata' attribute to NODE_FORMAT_ATTRIBUTES list to include additional metadata information for nodes in the application.
* 📝 (attributes.py): add new function getattr_return_dict to return a dictionary if the value is of type dict, otherwise return an empty dictionary. Update ATTR_FUNC_MAPPING to include the new function for the "metadata" attribute.
* update basic examples
* 📝 (extraSidebarComponent/index.tsx): refactor handleSearchInput function to improve code readability and maintainability
🐛 (extraSidebarComponent/index.tsx): fix searchInMetadata function to correctly handle nested objects in metadata for search functionality
* 📝 (component.py): add _metadata attribute to CONFIG_ATTRIBUTES list to include it in the configuration attributes
* chore: drop duckdb usage and migrations
* [autofix.ci] apply automated fixes
* Add DefaultModel and MessageResponse classes with custom JSON serialization and validation
- Introduced `DefaultModel` class with custom JSON encoders and serialization methods.
- Added `MessageResponse` class inheriting from `DefaultModel` with fields for message details and custom validators/serializers.
- Enhanced file handling and timestamp formatting in `MessageResponse`.
* Refactor: Replace `MessageModelResponse` with `MessageResponse` in monitor API
- Updated import statements to use `MessageResponse` from `langflow.schema.message`.
- Modified `/messages` endpoint to return `list[MessageResponse]` instead of `list[MessageModelResponse]`.
- Adjusted response model validation to use `MessageResponse`.
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Right now the Azure OpenAI Embeddings component doesn't allow you to pick the embedding model to use. The same models are available that OpenAI make available, so I used the constant that lists them to pull from.
* uv sync works
* fist stab at Makefile
* uv treatment for langflow-base
* sqlmodel to 0.0.18
* add reinstall_backend to Makefile
* makefile - reinstall_backend fix and unit_test dependency
* fix dev dependencies
* fix dev dependencies
* fix dev dependencies
* lock
* Makefile
* [autofix.ci] apply automated fixes
* Update Makefile
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* delete update_dependencies
* fix lint
* Remove Poetry lock check from GitHub Actions workflow
* Switch to 'uv' for dependency management and caching in style-check workflow
* Update style-check workflow to use '--only-dev' flag for Ruff check
* Integrate 'uv' package setup and caching in GitHub Actions workflows
* Update version check in GitHub Actions to use 'uv tree' for langflow-base
* Remove redundant poetry environment setup in GitHub Actions workflow
* Add step to minimize uv cache in GitHub Actions workflow
* Update GitHub Actions workflow to use 'uv' for dependency management and caching
* Remove redundant script execution from build_langflow target in Makefile
* [autofix.ci] apply automated fixes
* Switch build system from Poetry to Hatchling and update dependencies
- Replace `poetry-core` with `hatchling` in build-system requirements
- Update `langflow-base` dependency to version `0.0.96`
- Add `tool.hatch.build.targets.wheel` configuration
- Adjust `tool.uv.sources` paths for `langflow-frontend` and `langflow-base`
* update lock
* Switch build system from Poetry to Hatchling in pyproject.toml
* Add langchain-unstructured dependency to pyproject.toml
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* refactor: Refactor file path rewriting logic
This commit refactors the logic for rewriting file paths in the `rewrite_file_path` function. The function now splits the file path by "/" and checks if it has at least two parts. If it does, it creates a consistent file path by concatenating the last two parts. If not, it returns the original file path. This change improves the consistency of file paths in the codebase.
Refactor the file path rewriting logic in the `rewrite_file_path` function.
* refactor: Refactor file path rewriting logic and treat file paths in InterfaceVertex
* Refactor file path rewriting logic and treat file paths in InterfaceVertex
* Refactor file path rewriting logic and treat file paths in InterfaceVertex
* Refactor file path rewriting logic and treat file paths in InterfaceVertex
* ✨ (general-bugs-shard-3836.spec.ts): update test description to be more specific about the tool used for sending images on chat
📝 (general-bugs-shard-3836.spec.ts): remove unused import of readFileSync from fs module
* ✅ (test_rewrite_file_path.py): add unit tests for the rewrite_file_path function to ensure correct behavior with various file path scenarios
* ♻️ (utils.py): refactor file_path function to handle both forward and backward slashes and extract file path after drive letter if present
* style: fix single quotes, commas, and spaces
---------
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
## Changes Overview
This PR introduces several enhancements to our data handling components and removes some legacy code:
1. **CreateData and UpdateData Components**:
- Added text key name validation
- Enhanced UpdateData to support updating and appending multiple data points
- Implemented optional text key validator for dynamically loaded data
- Updated component names, descriptions, and default values
2. **New SelectData Component**:
- Implemented SelectDataComponent for data selection from a list
- Added inputs for data list and index selection
- Implemented error handling for out-of-range index selection
3. **Code Cleanup**:
- Removed legacy post_code_processing methods from CreateDataComponent and UpdateDataComponent
- Removed corresponding test cases
4. **Testing**:
- Added unit tests for CreateData and UpdateData components
- Updated test file names for consistency
* Update HuggingFaceInferenceAPIEmbeddings.py
update to use inference api from hugging face
* Enhance HuggingFaceEndpointsComponent with additional parameters
- Add FloatInput for top_p, typical_p, temperature, and repetition_penalty
- Update create_huggingface_endpoint and build_model methods to include new parameters
- Set default values and info for new inputs
ToDo Need to update the Package
from langchain_community.llms.huggingface_endpoint import HuggingFaceEndpoint
since its depreciated.
* Updated HuggingFaceModel Solving Lint Error
Updated HuggingFaceModel Solving Lint Error
* Update HuggingFaceModel.py
Added Inference Endpoint as an input from user to support custom inference endpoints
* Update HuggingFaceModel.py
paper references removed