Commit graph

1,027 commits

Author SHA1 Message Date
gustavoschaedler
5f8439ae7e 🔧 chore(.gitignore): add /tmp/* to the gitignore file to exclude temporary files from version control
 feat(endpoints.py): add new endpoint to load custom components from a specified path
📦 feat(load_custom_component_from_path.py): add new module to load custom components from a directory path
🔧 chore(types.py): add function to build and validate custom components from a directory path
2023-07-20 21:39:07 +01:00
Gabriel Luiz Freitas Almeida
30968e089f 🐛 fix(callback.py): improve error logging by including the specific error message
🐛 fix(chat.py): improve error logging by including the specific error message
🐛 fix(manager.py): improve error logging by including the specific error message
🐛 fix(base.py): improve error logging by including the specific error message
🐛 fix(processing/base.py): improve error logging by including the specific error message
2023-07-20 16:34:25 -03:00
Gabriel Luiz Freitas Almeida
7193bb4488 🐛 fix(custom_component.py): fix session context and add error handling for flow not found 2023-07-20 15:38:22 -03:00
Gabriel Luiz Freitas Almeida
c5bf15a2c4 🔧 fix(custom_component.py): fix import statements and refactor load_flow method to use UUID and improve code readability
🔀 merge(custom_component.py): merge changes from langflow.processing.process module to load_flow method to improve performance and data retrieval
2023-07-20 15:09:51 -03:00
gustavoschaedler
eb7158ad26 🔨 refactor(custom_component.py): remove unused imports and unused load_flow method parameters for better code cleanliness
🔨 refactor(custom_component.py): update load_flow method to use the process_flow function from the api endpoints module for improved modularity and separation of concerns
2023-07-20 18:56:46 +01:00
gustavoschaedler
2513cbcdd9 🔧 chore(custom_component.py): reformat code for better readability and maintainability
🚀 feat(custom_component.py): add `load_flow` method to load a flow from the database using session and flow_id
2023-07-20 18:35:53 +01:00
Gabriel Luiz Freitas Almeida
583eca137a feat(logger.py): configure default logger with optional log level and log file parameters for better customization
🔧 chore(logger.py): remove unnecessary blank lines and comments for cleaner code
2023-07-20 09:09:17 -03:00
Gabriel Luiz Freitas Almeida
0b283f8703 🐛 fix(types.py): convert avg_length to an integer to improve readability in DocumentLoaderVertex and TextSplitterVertex 2023-07-19 17:59:04 -03:00
gustavoschaedler
9adff855fb 🔧 chore(constants.py): update class attribute names to follow Langflow naming convention for better consistency and clarity
 feat(load_custom_component_from_file.py): add functionality to compress and decompress code, validate code syntax, validate build function presence, read file content, get list of .py files in a directory, find menu by name in response, process file by validating content and returning result and content/error message, and build component menu list from .py files in a directory
2023-07-19 21:16:36 +01:00
Gabriel Luiz Freitas Almeida
58d7491d83 🔨 refactor(endpoints.py): rename langchain_types_dict import to build_langchain_types_dict for clarity and consistency
🔨 refactor(types.py): remove unused langchain_types_dict variable to improve code cleanliness
2023-07-19 10:00:47 -03:00
Gabriel Luiz Freitas Almeida
4827c99368 🐛 fix(code_parser.py): handle case when code parameter is a class by getting its source code using inspect module
 feat(code_parser.py): add support for parsing class source code in addition to string source code to improve flexibility and usability
2023-07-19 07:03:54 -03:00
gustavoschaedler
598a833b75 🐛 fix(util.py): fix import order to follow PEP8 guidelines for better readability and maintainability
 feat(util.py): add sync_to_async decorator to convert sync functions to async functions for better performance and compatibility
🐛 fix(util.py): fix formatting of dictionary by removing certain keys and modifying the values of other keys to improve consistency and clarity
🐛 fix(util.py): fix update_verbose function to recursively update the value of the 'verbose' key in a dictionary
🐛 fix(util.py): fix update_verbose function to correctly handle nested dictionaries
🐛 fix(util.py): fix update_verbose function to correctly handle non-dictionary values
🐛 fix(util.py): fix format_dict function to correctly handle the 'type' value when it is a type object
🐛 fix(util.py): fix format_dict function to correctly handle the 'type' value when it is a list type
🐛 fix(util.py): fix format_dict function to correctly handle the 'type' value when it is a Mapping type
🐛 fix(util.py): fix format_dict function to correctly handle the 'type' value when it is a dict type
🐛 fix(util.py): fix format_dict function to correctly handle the 'type' value when it is a Tool type
🐛 fix(util.py): fix format_dict function to correctly handle the 'type' value when it is an int type
🐛 fix(util.py): fix format_dict function to correctly handle the 'show' value based on field requirements and naming conventions
🐛 fix(util.py): fix format_dict function to correctly handle the 'password' value based on field naming conventions
🐛 fix(util.py): fix format_dict function to correctly handle the 'multiline' value based on field naming conventions
🐛 fix(util.py): fix format_dict function to correctly handle the 'type' value when it is a dict type for the 'dict_' key
🐛 fix(util.py): fix format_dict function to correctly handle the 'value' field when it is a default value
🐛 fix(util.py): fix format_dict function to correctly handle the 'value' field for the 'headers' key
🐛 fix(util.py): fix format_dict function to correctly handle the 'options' field for specific class and key combinations
2023-07-18 18:47:04 +01:00
gustavoschaedler
cee4740b0f 🔧 fix(custom_component.py): add line break to improve readability of TODO comment
🔧 fix(index.tsx): remove unused imports to clean up code

🔧 fix(utils.ts): add space before opening parenthesis to improve code style

🔧 fix(test_custom_component.py): add line breaks to improve readability of test cases
2023-07-18 02:05:37 +01:00
gustavoschaedler
0aab360629 🔨 refactor(langflow): improve code parsing and custom component handling
- Refactor code parsing in `code_parser.py` to handle imports, function definitions, and class attributes more robustly and cleanly.
- Add new methods in `component.py` to parse Assign and AnnAssign statements, and FunctionDef statements.
- Refactor `custom_component.py` to improve the handling of custom components, including better extraction of main class name and template configuration.
- Update `types.py` to better handle the building of custom component templates, including handling of field configurations and error handling.
- Minor formatting fix in `conftest.py` test fixture.

These changes improve the robustness and readability of the code, and provide better handling and validation of custom components.
2023-07-15 00:41:31 +01:00
gustavoschaedler
f2687fa926 Merge branch 'python_custom_node_component' of github.com:logspace-ai/langflow into python_custom_node_component 2023-07-14 18:36:23 +01:00
gustavoschaedler
cc2dbe1490 🔧 refactor(constants.py, conftest.py): improve code structure and readability
🔨 refactor(constants.py): make YourComponent inherit from CustomComponent for better code reuse and structure

🔨 refactor(conftest.py): restructure custom_chain fixture for better readability and maintainability
2023-07-14 18:29:54 +01:00
Gabriel Luiz Freitas Almeida
49029d6cda 🔧 chore(base.py): refactor TemplateFieldCreator class to improve code readability and maintainability 2023-07-14 14:13:27 -03:00
gustavoschaedler
e90fd26984 🔥 remove(component.py): unnecessary blank line at the start of the file for cleaner code structure 2023-07-14 05:12:05 +01:00
gustavoschaedler
75452fb758 🔧 refactor(custom_component.py): make 'code' attribute optional in CustomComponent class to allow instances without explicit code value 2023-07-14 05:08:12 +01:00
gustavoschaedler
b523533d98 Merge branch 'python_custom_node_component' of github.com:logspace-ai/langflow into python_custom_node_component 2023-07-14 04:51:11 +01:00
gustavoschaedler
79d2d551ff 🔀 refactor(langflow): rename custom.py to custom_component.py for clarity
🔥 remove(langflow): delete custom.py as it's replaced by custom_component.py
📦 feat(langflow): add code_parser.py to parse Python source code
🐛 fix(langflow): update import paths due to file renaming
🎨 style(langflow): improve code formatting for readability
🐛 fix(langflow): correct handling of function arguments and return types in custom components
🔧 chore(langflow): update function calls due to changes in custom components
2023-07-14 04:49:42 +01:00
Gabriel Luiz Freitas Almeida
23a7478b5a Merge branch 'dev' into python_custom_node_component 2023-07-13 18:45:58 -03:00
Gabriel Luiz Freitas Almeida
38da096245 🐛 fix(base.py): rename _remove_invalid_nodes() to _validate_nodes() for clarity and accuracy
🔥 chore(base.py): remove unnecessary check for single node and no edges in _validate_nodes()
🔥 chore(base.py): remove unused import statement
🔥 chore(base.py): remove unused _validate_node() method
🔥 chore(base.py): remove unused import statement
2023-07-13 15:01:08 -03:00
gustavoschaedler
e8c844a75f 🐛 fix(types.py): handle case when field_type is None by assigning an empty string to improve code robustness
🐛 fix(types.py): reformat detail dictionary in raise HTTPException to improve readability
2023-07-12 21:54:15 +01:00
gustavoschaedler
a6fe4091ac Merge branch 'dev' into python_custom_node_component 2023-07-12 16:34:21 +01:00
gustavoschaedler
2f4e98477c 🐛 fix(components.py): change variable name from component to component_model in create_component and update_component functions for better readability
 feat(components.py): add support for `create_at` and `update_at` fields in Component model to track creation and update timestamps
🔥 refactor(components.py): remove unused imports and variables in components.py
🔥 refactor(component.py): remove unused imports and variables in component.py
🔥 refactor(component.py): remove commented out code in component.py
2023-07-12 15:10:37 +01:00
gustavoschaedler
587b203b66 🐛 fix(components.py): handle IntegrityError when creating a component to avoid duplicate entries
 feat(components.py): add error handling for creating a component with the same id to return a 400 status code and a detailed error message
2023-07-12 13:12:52 +01:00
gustavoschaedler
6c1a6f3bd9 🔧 fix(components.py): remove unused imports and commented out code
 feat(components.py): refactor create_component endpoint to use the Component model directly instead of ComponentCreate model
 feat(components.py): refactor read_component endpoint to return a Component model instead of ComponentRead model
 feat(components.py): refactor read_components endpoint to return a list of Component models instead of a list of ComponentRead models
 feat(components.py): refactor update_component endpoint to use the Component model directly instead of ComponentUpdate model
 feat(components.py): refactor delete_component endpoint to use the Component model directly instead of ComponentUpdate model
🔧 fix(component.py): remove unused imports and commented out code
 feat(component.py): add missing import for orjson
 feat(component.py): add missing import for FastAPI, HTTPException, and Depends
 feat(component.py): add missing import for List and Optional
 feat(component.py): add missing import for datetime
 feat(component.py): add missing import for uuid
 feat(component.py): add missing import for StaticPool
 feat(component.py): add missing import for create_engine
 feat(component.py): add missing import for select
 feat(component.py): add missing import for orjson
 feat(component.py): add missing import for SQLModel
 feat(component.py): add missing import for Session
 feat(component.py): add missing import for orjson
 feat(component.py): add missing import for orjson_dumps function
 feat(component.py): add missing import for Component model
 feat(component.py): add missing import for Field
 feat(component.py): add missing import for SQLModel
 feat(component.py): add missing import for Session
 feat(component.py): add missing import for create_engine
 feat(component.py): add missing import for select
 feat(component.py): add missing import for Optional
 feat(component.py): add missing import for List
 feat(component.py): add missing import for datetime
 feat(component.py): add missing import for uuid
 feat(component.py): add missing import for StaticPool
 feat(component.py): add missing import for orjson
 feat(component.py): add missing import for orjson_dumps function
 feat(component.py): add missing import for Component model
 feat(component
2023-07-12 13:02:38 +01:00
gustavoschaedler
fb91b17c51 📦 chore(router.py): add component_router to APIRouter to include component routes
📦 chore(__init__.py): add component_router to __all__ list to expose component routes
📦 feat(components.py): add routes for creating, reading, updating, and deleting components
📦 chore(endpoints.py): import Component model from database.models.component
📦 chore(schemas.py): add ComponentListCreate and ComponentListRead schemas
📦 feat(models/component.py): add Component model with fields for name, description, and data
📦 feat(models/component.py): add ComponentCreate, ComponentRead, and ComponentUpdate models for CRUD operations on components
2023-07-12 00:08:52 +01:00
Gabriel Luiz Freitas Almeida
77ba780d0e 🐛 fix(custom.py): add handle_parsing_errors=True to VectorStoreAgent, SQLAgent, and VectorStoreRouterAgent classes to handle parsing errors during execution
🐛 fix(loading.py): add handle_parsing_errors=True to instantiate_agent and load_agent_executor functions to handle parsing errors during agent instantiation and loading
2023-07-11 17:17:40 -03:00
Gabriel Luiz Freitas Almeida
ec478a8a5e 🐛 fix(process.py): add comments to clarify the purpose of adding artifacts to inputs
 feat(process.py): refactor processing logic for VectorStore objects to use the search method instead of generating a result message
🐛 fix(parameterComponent/index.tsx): remove duplicate import of MAX_LENGTH_TO_SCROLL_TOOLTIP
🔧 chore(utils.ts): import HuggingFaceIcon from the correct file path
2023-07-11 09:03:29 -03:00
Gabriel Luiz Freitas Almeida
4a0324bc7f 🔥 chore(config.yaml): comment out DocArrayInMemorySearch vectorstore integration
ℹ️ The DocArrayInMemorySearch vectorstore integration is currently not supported due to compatibility issues with the required version of docarray. Commenting it out to prevent potential errors.
2023-07-11 09:03:28 -03:00
Gabriel Luiz Freitas Almeida
a90c9fbd34 🐛 fix(loading.py): replace spaces with underscores in tool names to improve consistency and avoid issues
🐛 fix(base.py): catch and log exceptions when fixing memory inputs to prevent crashes
🐛 fix(process.py): check if memory_key attribute exists before accessing it to prevent AttributeError
🐛 fix(memories.py): hide memory_key field for ConversationEntityMemory to improve user experience
2023-07-10 22:42:44 -03:00
Gabriel Luiz Freitas Almeida
c77674b171 🐛 fix(chains.py): hide the "verbose" field in the frontend node template to improve user experience 2023-07-10 21:32:43 -03:00
gustavoschaedler
719015b5bb 🐛 fix(custom.py): import re module to fix NameError when using re.split
🐛 fix(custom.py): fix indentation of class_template dictionary to improve readability
🐛 fix(custom.py): fix indentation of class dictionary to improve readability
🐛 fix(custom.py): fix indentation of _handle_function method to improve readability
🐛 fix(custom.py): fix indentation of transform_list method to improve readability
🐛 fix(custom.py): fix indentation of extract_class_info method to improve readability
🐛 fix(custom.py): fix indentation of _class_template_validation method to improve readability
🐛 fix(custom.py): fix indentation of build_langchain_template_custom_component method to improve readability
🐛 fix(custom.py): fix indentation of add_new_custom_field method to improve readability
🐛 fix(custom.py): fix indentation of add_code_field method to improve readability
🐛 fix(custom.py): fix indentation of extract_type_from_optional method to improve readability
🐛 fix(custom.py): fix indentation of build_langchain_template_custom_component method to improve readability
🔥 chore(custom.py): remove unused imports and variables
 feat(custom.py): add support for splitting a string by ':' or '=' and padding with None until length is 3 in _split_string method
 feat(custom.py): add support for transforming a list of strings by splitting each string and padding with None in transform_list method
 feat(custom.py): add support for extracting the type from a string formatted as "Optional[<type>]" in extract_type_from_optional method
 feat(custom.py): add support for passing field_value and field_required parameters to add_new_custom_field method
 feat(custom.py): add support for passing field_value and field_required parameters to build_langchain_template_custom_component method
 feat(custom.py): add support for passing field_value and field_required parameters to add_new_custom_field method
 feat(custom.py): add support for passing field_value and field_required parameters to build_langchain_template_custom_component method
 feat(custom.py): add support for passing field_value and field_required parameters to add_new_custom_field method
 feat(custom.py): add support for passing field_value and field_required parameters to build_langchain_template_custom_component method
 feat(custom.py): add support for passing field_value and field_required parameters to add_new_custom_field method
 feat(custom.py): add support for
2023-07-10 23:38:01 +01:00
Gabriel Luiz Freitas Almeida
7b2db83033 🐛 fix(tools.py): add "BaseTool" as a base class for PythonFunctionToolNode to fix inheritance issue 2023-07-10 18:43:08 -03:00
Gabriel Luiz Freitas Almeida
cd9fc3a2e4 🐛 fix(loading.py): fix conditional statement for instantiating prompt objects based on node_type
 feat(loading.py): improve formatting of input variables for prompt objects
2023-07-10 17:50:33 -03:00
Gabriel Luiz Freitas Almeida
00c1734fb8 🐛 fix(chat.py): fix the issue where the params variable is not converted to a string before slicing it in the log message to avoid TypeError 2023-07-10 17:50:32 -03:00
Gabriel Luiz Freitas Almeida
2cb8452968 🐛 fix(types.py): refactor _built_object_repr method in PromptVertex to improve readability and handle edge cases 2023-07-10 17:50:31 -03:00
Gabriel Luiz Freitas Almeida
43e69f1f45 🐛 fix(types.py): fix variable name in format method to correctly reference the 'artifacts' variable 2023-07-10 16:29:39 -03:00
gustavoschaedler
6122521783 🐛 fix(custom.py): remove unused imports and unused code block to improve code cleanliness and performance
 feat(custom.py): add NotImplementedError to the build method to indicate that it needs to be implemented in subclasses
🚧 chore(test_custom_component.py): add test cases for various methods in the CustomComponent class to improve test coverage and ensure code correctness
2023-07-10 19:34:36 +01:00
Gabriel Luiz Freitas Almeida
2c2ae5451c 🔒 chore(base.py): add validation for invalid input variable names in validate_prompt function
🐛 fix(base.py): raise ValueError if any of the input variables in template are named as invalid names to prevent potential issues
2023-07-10 15:13:40 -03:00
Gabriel Luiz Freitas Almeida
02fc2004e1 🐛 fix(textsplitters.py): change default value of Separator field from "." to "\\n" to correctly split text by newline characters 2023-07-10 13:54:46 -03:00
Gabriel Luiz Freitas Almeida
8f9bfd2a7c 🐛 fix(loading.py): fix issue with separators being escaped strings by decoding them using unicode-escape encoding 2023-07-10 13:50:45 -03:00
Gabriel Luiz Freitas Almeida
f56e31163a 🐛 fix(types.py): handle KeyError when formatting prompt with artifacts to prevent application crash
🔀 refactor(types.py): remove "handle_keys" from artifacts before formatting prompt to avoid format errors
2023-07-10 13:22:44 -03:00
Gabriel Luiz Freitas Almeida
df348b019d 🔧 chore(memories.py): hide "entity_store" field in MemoryFrontendNode class to improve code readability and remove unnecessary code 2023-07-10 12:55:11 -03:00
Gabriel Luiz Freitas Almeida
650275db8a 🔧 chore(base.py): add __repr__ method to Graph class for better debugging and representation 2023-07-10 08:05:18 -03:00
Gabriel Luiz Freitas Almeida
d8dee14ed5 🔨 refactor(base.py): refactor the _build method in the Vertex class for better readability and maintainability
🐛 fix(base.py): fix a bug where the built object is not updated correctly in the Vertex class
 feat(base.py): add validation to check if the built object is None in the Vertex class
2023-07-09 18:09:53 -03:00
Gabriel Luiz Freitas Almeida
008a1c4079 🐛 fix(types.py): replace eval() with ast.literal_eval() to safely evaluate headers parameter as dictionary-like string
🐛 fix(process.py): rename input parameter to flow for clarity and to avoid shadowing built-in function
2023-07-09 18:02:12 -03:00
Gabriel Luiz Freitas Almeida
612c7a988c 🔥 refactor(callback.py): remove unused imports to improve code readability and maintainability 2023-07-09 11:14:06 -03:00