Commit graph

28 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
8036f74d8b 🔀 chore(conftest.py): update import statement for DatabaseManager to reflect file name change 2023-08-07 11:59:57 -03:00
Gabriel Luiz Freitas Almeida
7776977378 🚧 chore(conftest.py): add runner fixture to enable CLI testing
🔧 chore(conftest.py): import CliRunner from typer.testing to enable CLI testing
🔧 chore(conftest.py): remove unused imports and blank lines for code cleanliness
2023-08-07 09:43:37 -03:00
Gabriel Luiz Freitas Almeida
a9db2da6bf 🐛 fix(base.py): use db_manager.engine instead of DatabaseManager.engine to access the database engine
🐛 fix(conftest.py): add TYPE_CHECKING import to fix type hinting error
🐛 fix(conftest.py): pass db_manager to blank_session_getter fixture to fix session creation error
2023-08-06 12:15:29 -03:00
Gabriel Luiz Freitas Almeida
7b2827f198 🐛 fix(conftest.py): fix client_fixture to properly yield the TestClient instance and clear dependency overrides after usage 2023-08-05 22:18:45 -03:00
Gabriel Luiz Freitas Almeida
ddafdf31b5 🔧 fix(conftest.py): remove unused imports and commented out code
 feat(conftest.py): add session_getter fixture to create a blank session for testing
🔧 fix(test_custom_component.py): pass session_getter fixture to list_flows function for testing
2023-07-31 17:31:40 -03:00
gustavoschaedler
11f7846e0a 🔥 refactor(conftest.py): remove unused fixtures and custom chain classes
The following changes were made:
- Removed the `custom_chain` fixture and the `MyCustomChain` and `CustomChain` classes as they were not being used.
- Removed the `data_processing`, `filter_docs`, `get_request`, and `post_request` fixtures as they were not being used.

🔧 fix(test_agents_template.py): set "dynamic" property to False for all template variables to ensure consistency and improve clarity

🐛 fix(test_chains_template.py): add missing "dynamic" field to template dictionaries to ensure consistency and avoid potential bugs

🔧 fix(test_custom_component.py): fix import statements and remove unused imports to improve code readability and maintainability
 feat(test_custom_component.py): add tests for the initialization of the CodeParser, Component, and CustomComponent classes
🔧 fix(test_custom_component.py): fix test names and add missing test cases for the Component and CustomComponent classes

🔨 refactor: refactor server.ts to use uppercase PORT variable for improved semantics
 feat: add support for process.env.PORT environment variable to run app on configurable port

🔨 refactor: refactor CustomComponent tests for improved readability and maintainability

🔨 refactor: refactor CodeParser tests for improved readability and maintainability

🔨 refactor: refactor Component tests for improved readability and maintainability

🐛 fix: fix CustomComponent class template validation to raise HTTPException when code is None

🔧 fix(tests): fix syntax error in custom_component._class_template_validation
 feat(tests): add test_custom_component_get_code_tree_syntax_error to test CustomComponent.get_code_tree method for raising CodeSyntaxError when given incorrect syntax
 feat(tests): add test_custom_component_get_function_entrypoint_args_no_args to test CustomComponent.get_function_entrypoint_args property with a build method with no arguments
 feat(tests): add test_custom_component_get_function_entrypoint_return_type_no_return_type to test CustomComponent.get_function_entrypoint_return_type property with a build method with no return type
 feat(tests): add test_custom_component_get_main_class_name_no_main_class to test CustomComponent.get_main_class_name property when there is no main class
 feat(tests): add test_custom_component_build_not_implemented to test CustomComponent.build method for raising NotImplementedError
 feat(tests): add fixtures for custom_chain, data_processing, filter_docs, and get_request

🔧 fix(tests): remove commented out code and unused imports to improve code readability and maintainability

🐛 fix(test_llms_template.py): set "dynamic" property to False for all template properties to ensure static values are used

🐛 fix(test_prompts_template.py): set "dynamic" property to False for all template properties to ensure consistency and improve readability
2023-07-18 01:59:19 +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
7c37c6d74f 🔧 refactor(conftest.py): remove unnecessary comments for cleaner code
🔧 refactor(conftest.py): reformat code for better readability
🔧 refactor(conftest.py): move import statements to new lines for better readability
2023-07-14 19:19:42 +01:00
Gabriel Luiz Freitas Almeida
405191de22 feat(conftest.py): add fixtures for GET and POST request components to be used in tests 2023-07-14 15:05:31 -03: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
1863d463d0 🔨 refactor(conftest.py): change return type of build method in CSVLoaderComponent from List[Document] to Document to match the actual return type
🔧 chore(conftest.py): add new fixture `filter_docs` for testing `DocumentFilterByLengthComponent`
2023-07-14 14:20:09 -03:00
Gabriel Luiz Freitas Almeida
99ef7c728d 🔨 refactor(conftest.py): reformat code for better readability and maintainability
 feat(conftest.py): add MyCustomChain class as an example of a custom chain
 feat(conftest.py): add CustomChain class as a custom component for building a document
 feat(conftest.py): add CSVLoaderComponent class as a custom component for loading CSV files and converting rows to documents
2023-07-14 14:05:57 -03:00
Gabriel Luiz Freitas Almeida
10c0b3871c feat(conftest.py): add custom_chain fixture to provide a custom chain for testing purposes 2023-07-14 13:10:06 -03:00
Gabriel Luiz Freitas Almeida
3920eb50d6 Merge remote-tracking branch 'origin/validation_fix' into db 2023-06-15 07:37:26 -03:00
Gabriel Luiz Freitas Almeida
a7c9b04611 🚨 test(conftest.py): add basic_graph_data fixture to load basic example data
🚨 test(test_websocket.py): add tests for build init, stream, and websocket endpoint
The `basic_graph_data` fixture is added to load the basic example data. The `test_init_build`, `test_stream_build`, and `test_websocket_endpoint` tests are added to test the build init, stream, and websocket endpoint. The `test_websocket_endpoint_after_build` test is added to test the websocket endpoint after the build.
2023-06-12 13:06:39 -03:00
Gabriel Luiz Freitas Almeida
183f80b1fc 🔥 chore(database.py): remove unused code and endpoints related to flows
 feat(router.py): add new routers for flows and flow styles
🔧 refactor(__init__.py): add new routers to __all__ list
🔧 refactor(conftest.py): update import statement for get_session function
The unused code and endpoints related to flows have been removed from the database.py file. New routers for flows and flow styles have been added to the router.py file. The __all__ list in the __init__.py file has been updated to include the new routers. The import statement for the get_session function in the conftest.py file has been updated to reflect the new location of the function.
2023-06-06 16:23:37 -03:00
Gabriel Luiz Freitas Almeida
ec585b8acc 🐛 fix(flow.py): change flow field type from str to Dict to allow for JSON data
 feat(flow.py): add validator to ensure flow field is a valid JSON object with required fields
The flow field in the FlowBase model has been changed from a string to a dictionary to allow for JSON data. A validator has been added to ensure that the flow field is a valid JSON object with the required fields. The tests have been updated to reflect these changes.
2023-06-05 13:40:14 -03:00
Gabriel Luiz Freitas Almeida
af0d9456b5 Merge branch 'dev' into db 2023-06-04 22:14:25 -03:00
Gabriel Luiz Freitas Almeida
5b5eea9895 🚀 feat(langflow): reorganize graph package to improve modularity and maintainability
The changes include:
- Moved the `Edge` class to a new `edge` package
- Moved the `Graph` class to a new `graph` package
- Moved the `Node` class to a new `node` package
- Moved the `VectorStoreNode` class to the `node/types.py` module
- Moved the `Edge`, `Graph`, and `Node` classes to their respective `base.py` modules
- Added an `__init__.py` file to each package to allow for importing of classes
- Added a `constants.py` module to the `graph` package to store constants used in the `Graph` class
- Refactored the `Graph` class to use the new `Node` and `Edge` classes
- Refactored the `Graph` class to use a dictionary to map node types to their respective classes
- Refactored the `Graph` class to remove invalid nodes from the graph
- Refactored the `Graph` class to handle the LLM node within the graph
- Refactored the `Graph` class to build the nodes before building the edges
- Refactored the `Graph` class to use the `get_node` method to find nodes by id
- Refactored the `Graph` class to use the `get_node_neighbors` method to find the neighbors of a node
- Refactored the `Graph` class to use the `get_children_by_node_type` method to find the children of a node based on the node type

These changes improve the modularity and maintainability of the `langflow` package by separating the classes into their respective packages and modules. The changes also make it easier to add new node types to the `Graph` class by using a dictionary to map node types to their respective classes.

🚀 feat(node): add Node class to represent a node in the graph
🚀 feat(constants.py): add DIRECT_TYPES constant to represent direct types in a node's template
The Node class represents a node in the graph and is responsible for parsing the data and building the module. The DIRECT_TYPES constant is a list of direct types in a node's template.

🚧 chore(types.py): add import statements for typing and Node classes
This commit adds import statements for the typing module and the Node class to the types.py file. This is necessary for the code to run properly as it uses these classes and modules.

🚧 chore(loading.py): remove unnecessary import statement
This commit removes an unnecessary import statement from the loading.py file. The import statement was causing a circular import error and was not needed for the code to run properly.

🚧 chore(run.py): update import statement for Graph class
This commit updates the import statement for the Graph class in the run.py file. The import statement was outdated and was causing an import error.

🚧 chore(conftest.py): update import statement for Graph class
This commit updates the import statement for the Graph class in the conftest.py file. The import statement was outdated and was causing an import error.

🚧 chore(test_graph.py): update import statements for Node and Edge classes
This commit updates the import statements for the Node and Edge classes in the test_graph.py file. The import statements were outdated and were causing import errors.
2023-06-01 15:07:56 -03:00
Gabriel Almeida
6cacfced09 🚧 chore(conftest.py): add fixtures for database testing
 test(database.py): add tests for CRUD operations on Flow model
The new fixtures added to conftest.py are session and client fixtures. These fixtures are used to create a test database and a test client for testing the database. The tests added to test_database.py test the CRUD operations on the Flow model. The tests include creating a flow, reading all flows, reading a single flow, updating a flow, and deleting a flow. These tests ensure that the database is working as expected and that the API endpoints for the Flow model are functioning correctly.
2023-05-30 21:24:23 -03:00
Gabriel Almeida
9d3098f3e2 refactor(langflow): reorder imports in multiple files
This commit reorders imports in multiple files to follow PEP8 guidelines
and improve code readability. No functional changes were made.
2023-05-02 23:23:36 +00:00
Gabriel Almeida
18b3583850 test(websocket.py): add tests for websocket connection, chat history and sending message 2023-04-19 13:13:58 -03:00
Gabriel Almeida
0fc454f9b7 feat: added more tests for nodes 2023-04-01 00:01:29 -03:00
Gabriel Almeida
92c3bb19b0 fix: formatting and utils 2023-03-31 14:07:58 -03:00
Gabriel Almeida
b8a41037ec feat: code validation, endpoint and tests 2023-03-28 19:17:26 -03:00
Gabriel Almeida
287ef0d4e4 feat: new tests for endpoints 2023-03-26 21:02:45 -03:00
Gabriel Almeida
269c06e9c1 feat: added tests for graph 2023-03-24 11:21:29 -03:00