* ✨ (mistral.py): Add new input parameters to MistralAIModelComponent for better customization and control over the Mistral model configuration
♻️ (mistral.py): Refactor build_model method to improve readability and maintainability by using try-except block for error handling and updating parameter names for better clarity
* [autofix.ci] apply automated fixes
* ♻️ (mistral.py): refactor MistralAIModelComponent class to improve code readability by formatting the IntInput and BoolInput sections for better organization and clarity.
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
fix: Case-insensitive file extension validation in BaseFileComponent
Modify file extension validation to use lowercase comparison, ensuring consistent handling of file extensions across different input cases
⚡️ Speed up function `find_all_cycle_edges` by 17%
Here is the optimized version of the given program. The major optimization here is to avoid unnecessary list concatenations in the DFS recursion by using a more efficient approach for aggregating cycle edges.
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
* ⚡️ Speed up function `update_target_handle` by 27%
Sure, here are the optimized versions of the given functions. The key optimizations include avoiding redundant dictionary lookups, removing unnecessary condition checks, and simplifying the logic where possible.
* lint fix
* Apply suggestions from code review
Co-authored-by: Christophe Bornet <cbornet@hotmail.com>
---------
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
Co-authored-by: Christophe Bornet <cbornet@hotmail.com>
* fix: Improve variable decryption error handling in DatabaseVariableService
Add robust error handling for variable decryption, logging decryption failures and falling back to the original value for generic type variables
* chore: Bump version to 1.1.4.post1 for langflow and 0.1.4.post1 for langflow-base
* ✨ (processing): Rename MergeDataComponent to CombineDataComponent for better clarity and consistency in naming conventions. Add CombineDataComponent to handle different data combination operations like concatenation, appending, merging, and joining.
* [autofix.ci] apply automated fixes
* ♻️ (combine_data.py): refactor class name from CombineDataComponent to MergeDataComponent for better clarity and consistency with the operation performed
* ✨ (processing): Rename CombineDataComponent to MergeDataComponent for better clarity and consistency
📝 (processing): Add new MergeDataComponent to combine data using different operations like Concatenate, Append, Merge, and Join
* ♻️ (processing/__init__.py): refactor CombineDataComponent to MergeDataComponent for better naming consistency and clarity
* ✨ (processing/__init__.py): rename merge_data module to combine_text for better clarity and 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>
* 📝 (firecrawl_crawl_api.py): update StrInput to MultilineInput for better handling of URL input
📝 (firecrawl_scrape_api.py): update StrInput to MultilineInput for better handling of URL input
* [autofix.ci] apply automated fixes
* ✨ (firecrawl_crawl_api.py): introduce StrInput class to langflow.io module for handling string inputs in the API
* [autofix.ci] apply automated fixes
* ✨ (changes-filter.yaml): add new directories to components list for langflow schema and utils to be included in changes filtering
* ✨ (changes-filter.yaml): add new directory "src/backend/base/langflow/graph/" to components list for changes filtering in the workspace.
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* 📝 (vertex_types.py): improve default value assignment logic based on edge type for ComponentVertex class
* [autofix.ci] apply automated fixes
* 📝 (schema.py): remove TextInput from INPUT_COMPONENTS list as it is no longer used
♻️ (vertex_types.py): refactor default_value assignment logic for ComponentVertex class to improve readability and maintainability
* ✨ (schema.py): introduce new TextInput component to the list of INPUT_COMPONENTS for the graph schema
* 📝 (vertex_types.py): improve default value assignment logic based on edge type for ComponentVertex class
* [autofix.ci] apply automated fixes
* 🐛 (utils.py): fix layered topological sort to prevent TextInput from being incorrectly placed at the start
* ♻️ (vertex_types.py): Remove unnecessary comment about getting default value based on edge type to improve code readability and maintainability.
* 🐛 (vertex_types.py): simplify default value assignment logic for cycle edges
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* feat: FIrst pass at file management API
* [autofix.ci] apply automated fixes
* Add delete and edit endpoints
* [autofix.ci] apply automated fixes
* Add file size and duplicate name handling
* Ensure the File model has a unique name
* Ensure count is before extension
* [autofix.ci] apply automated fixes
* Add the correct path to the return
* Added function to handle list of paths in File component
* [autofix.ci] apply automated fixes
* Update input_mixin.py
* Refactor to a v2 endpoint
* Add unit tests
* Update test_files.py
* Update frontend.ts
* [autofix.ci] apply automated fixes
* Remove extension from name
* Cast the string type for like
* Update files.py
* Update base.py
* Update base.py
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Lucas Oliveira <lucas.edu.oli@hotmail.com>
* fix note node size
* ♻️ (NoteNode/index.tsx): remove commented out code for debounced resize handler to improve code readability and maintainability
* feat: update NoteNode to resize and persist dimensions in state
* 🐛 (generalBugs-shard-10.spec.ts): fix clicking on the last element with the text "openai" instead of the first one to match the intended behavior
✨ (generalBugs-shard-10.spec.ts): refactor test to use forEach loop for better readability and accuracy in comparing text contents
* 🐛 (general-bugs-save-changes-on-node.spec.ts): add 500ms delay to fix flakiness in tests related to clicking elements and waiting for selectors to appear
* ✨ (appHeaderComponent/index.tsx): add data-testid attribute to app header for testing purposes
📝 (general-bugs-save-changes-on-node.spec.ts): update verifyTextareaValue function to accept an additional parameter flowName for better test coverage and clarity
📝 (general-bugs-save-changes-on-node.spec.ts): add functionality to input and fill a random flow name in the test scenario for improved test coverage and reliability
---------
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* chore: update Google AI models list
* [autofix.ci] apply automated fixes
* chore: update Gemini model name from exp to standard version
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* feat: implement get_or_create_default_folder function to ensure default folder exists for users
* refactor: replace create_default_folder_if_it_doesnt_exist with get_or_create_default_folder for user folder creation
* test: add unit tests for get_or_create_default_folder function
* ✨ (generalBugs-shard-10.spec.ts): refactor test script to improve readability and maintainability by chaining actions on page elements instead of using separate lines for each action
---------
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
* feat: Implement serialization functions for various data types and add a unified serialize method
* feat: Enhance serialization by adding support for primitive types, enums, and generic types
* fix: Update Pinecone integration to use VectorStore and handle import errors gracefully
* test: Add hypothesis-based tests for serialization functions across various data types
* refactor: Replace custom serialization logic with unified serialize function for consistency and maintainability
* refactor: Replace recursive serialization function with unified serialize method for improved clarity and maintainability
* refactor: Replace custom serialization logic with unified serialize function for improved consistency and clarity
* refactor: Enhance serialization logic by adding instance handling and streamlining type checks
* refactor: Remove custom dictionary serialization from ResultDataResponse for streamlined handling
* refactor: Enhance serialization in ResultDataResponse by adding max_items_length for improved handling of outputs, logs, messages, and artifacts
* refactor: Move MAX_ITEMS_LENGTH and MAX_TEXT_LENGTH constants to serialization module for better organization
* refactor: Simplify message serialization in Log model by utilizing unified serialize function
* refactor: Remove unnecessary pytest marker from TestSerializationHypothesis class
* optimize _serialize_bytes
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
* feat: Add support for numpy integer type serialization
* feat: Enhance serialization with support for pandas and numpy types
* test: Add comprehensive serialization tests for numpy and pandas types
* fix: Update _serialize_dispatcher to return string representation for unsupported types
* fix: Update _serialize_dispatcher to return the object directly instead of its string representation
* optmize conditional
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
* optimize length check
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
* fix: Update string and list truncation to include ellipsis for clarity
* ⚡️ Speed up function `_serialize_dataframe` by 123% in PR #6044 (`refactor-serialization`)
Certainly! Here's a more efficient version of the given program. The primary optimization performed here is removing the redundant `.apply()` call and directly truncating values in a more performant way.
### Changes Made.
1. **Removed redundant `apply` calls**: In the original code, there were nested `apply` calls which can be very slow on larger DataFrames. The new implementation converts the DataFrame to a list of dictionaries first and then truncates the values if needed.
2. **Optimized truncation logic**: Applied truncation directly while iterating over the dictionary after conversion from a DataFrame. This reduces overhead and improves readability.
These changes should enhance the runtime performance of the serialization process, especially for larger DataFrames.
---------
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
* feat: Implement serialization functions for various data types and add a unified serialize method
* optmize conditional
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
* fix: Update string and list truncation to include ellipsis for clarity
* ⚡️ Speed up function `_serialize_series` by 234% in PR #6044 (`refactor-serialization`)
Certainly! Here is a more optimized version of the program.
Changes made.
1. Replaced the `apply` method with dictionary comprehension. This avoids creating an intermediate Series, which can be an expensive operation.
2. Moved `_truncate_value` outside of the main function to keep the main function concise and focused.
* refactor: Remove unused `_truncate_value` function from serialization module
---------
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
* feat: Implement serialization functions for various data types and add a unified serialize method
* feat: Enhance serialization by adding support for primitive types, enums, and generic types
* fix: Update Pinecone integration to use VectorStore and handle import errors gracefully
* test: Add hypothesis-based tests for serialization functions across various data types
* refactor: Replace custom serialization logic with unified serialize function for consistency and maintainability
* refactor: Replace recursive serialization function with unified serialize method for improved clarity and maintainability
* refactor: Replace custom serialization logic with unified serialize function for improved consistency and clarity
* refactor: Enhance serialization logic by adding instance handling and streamlining type checks
* refactor: Remove custom dictionary serialization from ResultDataResponse for streamlined handling
* refactor: Enhance serialization in ResultDataResponse by adding max_items_length for improved handling of outputs, logs, messages, and artifacts
* refactor: Move MAX_ITEMS_LENGTH and MAX_TEXT_LENGTH constants to serialization module for better organization
* refactor: Simplify message serialization in Log model by utilizing unified serialize function
* refactor: Remove unnecessary pytest marker from TestSerializationHypothesis class
* optimize _serialize_bytes
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
* feat: Add support for numpy integer type serialization
* feat: Enhance serialization with support for pandas and numpy types
* test: Add comprehensive serialization tests for numpy and pandas types
* fix: Update _serialize_dispatcher to return string representation for unsupported types
* fix: Update _serialize_dispatcher to return the object directly instead of its string representation
* optmize conditional
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
* optimize length check
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
* fix: Update string and list truncation to include ellipsis for clarity
* fix: Update _serialize_primitive to exclude string type from primitive handling
* feat: Enhance serialization to handle numpy types and introduce unserializable sentinel
* fix: Update test cases for serialization of numpy boolean values for consistency
---------
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
* 🐛 (component.py): fix logic in _process_raw_result method to correctly extract data from result object based on conditions and return it
* [autofix.ci] apply automated fixes
* ♻️ (component.py): refactor extract_data method to improve readability and maintainability by using more descriptive variable names and simplifying the logic.
* [autofix.ci] apply automated fixes
* 🐛 (component.py): update isinstance check to use union type for better type handling
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* Add tests for run_flow_from_json with fake environment variables
- Implemented test_run_flow_with_fake_env to validate flow execution with a fake .env file.
- Added test_run_flow_with_fake_env_TWEAKS to check flow execution using environment variables loaded from the fake .env file.
* Replace keys in tweaks with their corresponding environment variable values
- Implemented a function to recursively replace keys in the tweaks dictionary with values from the provided environment variables.
* updated to use better way to load test json file
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes
* refactor: improve test readability and consistency in load tests
- Renamed variable `TWEAKS` to `tweaks_dict` for clarity and consistency across tests.
- Updated test function names to follow a consistent naming convention.
- Enhanced comments for better understanding of test intentions.
- Minor formatting adjustments to improve code readability.
* feat: add aload_flow_from_json and arun_flow_from_json to module exports
* fix: correct file path handling in aload_flow_from_json function
* fix: improve environment variable handling in aload_flow_from_json function
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* feat: Add get_base_args method to Component class
Introduces a new method to retrieve base initialization arguments for components, including user ID, session ID, and tracing service. This method provides a convenient way to access essential context information during component initialization.
* refactor: Update AgentComponent to use get_base_args method
Modify AgentComponent to pass base initialization arguments when creating CurrentDateComponent and MemoryComponent, ensuring consistent context initialization across components.
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* feat: Add tool_mode field to Output model for tool usage specification
* fix: Specify type for component_toolkit in to_toolkit method
* feat: Add method to determine if output should be skipped in ComponentToolkit
* [autofix.ci] apply automated fixes
* test: Add tool_mode field to Output model in test schema
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* fix: Problem checking clickhouse connection when port is different from default
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
🐛 (component.py): fix the logic to determine the artifact type based on raw data and status
🐛 (artifact.py): fix the default message assignment in post_process_raw function to ensure consistent behavior
* fix: Handle network errors when fetching version notice
Catch and handle potential network connection errors when attempting to build the version notice, preventing potential startup failures due to version check issues
* refactor: Improve version check error handling and add docstring
Enhance version notice function by:
- Adding comprehensive docstring with description, args, returns, and example
- Using contextlib.suppress to handle network errors
- Removing redundant try-except block in print_banner
- Simplifying version check logic
* refactor: Improve telemetry error logging
Change telemetry service error logging from `logger.exception()` to `logger.error()` to reduce verbosity and prevent unnecessary stack trace printing
* refactor: Remove unnecessary logger import in version utility
Remove unused logger import and exception logging in version check function to simplify error handling and reduce unnecessary logging
* feat: Add database connection settings configuration
Introduce a new `db_connection_settings` dictionary to centralize database connection parameters. Mark `pool_size` and `max_overflow` as deprecated, recommending the use of the new configuration dictionary instead.
* refactor: Improve database connection settings handling
Add a method to build connection kwargs that merges deprecated settings with the new db_connection_settings, providing a more flexible and backwards-compatible approach to database connection configuration.
* fix: Resolve SQLAlchemy async engine pool configuration for SQLite
Explicitly set AsyncAdaptedQueuePool for SQLite connections to address potential async engine configuration issues. This ensures proper pool handling when creating database connections, particularly for SQLite databases.
* test: Add mock testing for bundle loading from GitHub URLs
Enhance test coverage for `load_bundles_from_urls()` by introducing a mock fixture to simulate zip file content and mocking HTTP requests. This allows testing the bundle loading mechanism without making actual network calls.
* [autofix.ci] apply automated fixes
* test: Enhance GitHub URL detection test with mocking and improved coverage
Refactor `test_detect_github_url` to use AsyncMock and patch for more robust testing of GitHub URL detection, including verification of API calls and handling of different URL scenarios.
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>