Commit graph

1,011 commits

Author SHA1 Message Date
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
Gabriel Luiz Freitas Almeida
5ece7e2fbc 🔥 refactor(loading.py): remove unused imports and reorganize import statements for better readability 2023-07-09 11:10:35 -03:00
Gabriel Luiz Freitas Almeida
d2750dd3dc 🔥 refactor(base.py): remove unused method process_base_classes from FrontendNode class
The `process_base_classes` method in the `FrontendNode` class is no longer used and can be safely removed to improve code readability and maintainability.
2023-07-09 11:10:07 -03:00
Gabriel Luiz Freitas Almeida
2f24fca1f2 🐛 fix(base.py): fix issue where CustomComponentCreator.to_list() method always returns None 2023-07-09 11:09:44 -03:00
Gabriel Luiz Freitas Almeida
dc80513691 🐛 fix(types.py): change variable name from 'name' to 'display_name' in add_new_custom_field function to improve clarity
🔧 chore(types.py): add warning when 'name' key is used in field_config to inform that it can't be changed
2023-07-09 11:09:19 -03:00
Gabriel Luiz Freitas Almeida
19b84247cf 🐛 fix(custom.py): improve error message formatting for invalid entrypoint function name and return type 2023-07-09 11:08:50 -03:00
Gabriel Luiz Freitas Almeida
c0df1f7c3b 🐛 fix(callback.py): fix issue with splitting output into multiple ChatResponse instances
 feat(callback.py): split the output into multiple ChatResponse instances to emulate a stream of tokens
2023-07-09 11:00:25 -03:00
Gabriel Luiz Freitas Almeida
c959d7bdd5 📝 docs(constants.py): add missing documentation for INPUT_KEY_INFO and OUTPUT_KEY_INFO variables
🐛 fix(memories.py): set info field for input_key and output_key fields to provide additional information to users
2023-07-09 10:51:18 -03:00
Gabriel Luiz Freitas Almeida
99be9830ad 🐛 fix(manager.py): catch and log RuntimeError when closing websocket connection to prevent unexpected ASGI message error
🔒 chore(manager.py): improve error handling when closing websocket connection to prevent unexpected ASGI message error
2023-07-09 10:31:46 -03:00
Gabriel Luiz Freitas Almeida
2d4642fc36 🔧 fix(callback.py): add error handling when sending response to websocket to prevent potential errors
🔧 fix(callback.py): change intermediate_steps assignment to use formatted string for better readability and maintainability
 feat(callback.py): add observation_prefix parameter to on_tool_end method to allow customization of the observation prefix in the response message
 feat(callback.py): add logger to handle potential errors when sending response to websocket
2023-07-08 16:49:30 -03:00
Gabriel Luiz Freitas Almeida
800f4b0a94 🐛 fix(loading.py): handle case when loading file into dict fails and raise ValueError with "Invalid file" message
 feat(loading.py): improve code readability by using walrus operator to assign loaded file dict to params["dict_"] variable
2023-07-08 16:45:59 -03:00
Gabriel Luiz Freitas Almeida
3441bb4e5b 🐛 fix(utils.py): improve error handling and file type detection in load_file_into_dict function 2023-07-08 16:45:33 -03:00
Gabriel Luiz Freitas Almeida
bd9bd13f57 🐛 fix(loading.py): handle conversion of max_tokens from string to int if necessary 2023-07-08 15:40:05 -03:00
Gabriel Luiz Freitas Almeida
6aac7e8e80 🐛 fix(types.py): add a check for None before checking if the built object has a "format" attribute to prevent potential AttributeError 2023-07-08 14:57:22 -03:00
Gabriel Luiz Freitas Almeida
fbdde257e0 🔧 fix(types.py): fix indentation issue in the repr method of DocumentLoaderVertex and TextSplitterVertex classes
🔧 fix(types.py): calculate average document length in the repr method of DocumentLoaderVertex and TextSplitterVertex classes
2023-07-08 14:52:59 -03:00
Gabriel Luiz Freitas Almeida
7e712b1be8 🐛 fix(loading.py): convert "max_tokens" parameter from string to int if it is a string and can be converted to int
🐛 fix(loading.py): remove "max_tokens" parameter if it is not an integer
2023-07-08 13:59:46 -03:00
Gabriel Luiz Freitas Almeida
6c17949d21 🔧 fix(base.py): add exception handling when formatting intermediate steps to prevent crashes and log the exception 2023-07-08 11:43:01 -03:00