Commit graph

179 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
fb407cf9d1 🔥 refactor(test_custom_component.py): remove unused imports and test_list_flows_no_flows test case
🔥 refactor(test_custom_component.py): remove test_list_flows_no_flows test case as it is no longer needed
2023-07-27 14:35:49 -03:00
gustavoschaedler
d5ee293590 🔧 fix(test_custom_component.py): fix import statements and formatting issues in test_custom_component.py
 feat(test_custom_component.py): add tests for list_flows, build_config methods in CustomComponent class
🔧 fix(test_custom_component.py): fix formatting issues in test_list_flows_multiple_queries test
 feat(test_custom_component.py): add tests for list_flows, build_config methods in CustomComponent class
 feat(test_custom_component.py): add test for return type of list_flows method in CustomComponent class
 feat(test_custom_component.py): add test for return type of build_config method in CustomComponent class
 feat(test_custom_component.py): add test for presence of 'fields' key in build_config method in CustomComponent class
 feat(test_custom_component.py): add test for type of 'fields' value in build_config method in CustomComponent class
 feat(test_custom_component.py): add test for type of keys in 'fields' value in build_config method in CustomComponent class
 feat(test_custom_component.py): add test for type of values in 'fields' value in build_config method in CustomComponent class
2023-07-26 17:40:53 +01:00
gustavoschaedler
a89a9a3267 🔥 refactor(custom.py): remove unused code and class 'CustomComponent_old' to improve code cleanliness and maintainability
🔧 fix(test_custom_component.py): fix formatting issues in test_custom_component.py for better readability
 feat(test_custom_component.py): add import statements for 'patch' and 'MagicMock' to enable mocking in tests
🔬 test(test_custom_component.py): add test for the 'get_function' method of the Component class with valid code and function_entrypoint_name
🔬 test(test_custom_component.py): add test for the 'parse_assign' method of the CodeParser class
🔬 test(test_custom_component.py): add test for the 'get_code_tree' method of the Component class when given incorrect syntax
🔬 test(test_custom_component.py): add test for the '_class_template_validation' method of the CustomComponent class when the code is None
🔬 test(test_custom_component.py): add test for the 'get_function_entrypoint_args' method of the CustomComponent class
🔬 test(test_custom_component.py): add test for the 'get_function_entrypoint_return_type' method of the CustomComponent class
🔬 test(test_custom_component.py): add test for the 'get_main_class_name' method of the CustomComponent class when there is no main class

🔥 refactor(test_custom_component.py): remove commented out code and unused fixtures to improve code readability and maintainability

🔧 refactor(tests): remove commented out test cases and unused imports
 feat(tests): add new test case for list_flows method when there are no flows in the database
 feat(tests): add new test case for build_config method when code is not provided
 feat(tests): add new test case for list_flows method when there are multiple queries to the database
2023-07-26 16:56:21 +01:00
Gabriel Luiz Freitas Almeida
c93febc7a3 🚀 feat(test_agents_template.py): add "fileTypes" field to the "path" agent configuration to specify supported file types 2023-07-26 07:43:16 -03:00
gustavoschaedler
548383b09e 🐛 fix(endpoints.py): add missing import statement for 'settings' module
 feat(endpoints.py): add support for loading custom components from a specified path
🐛 fix(endpoints.py): fix typo in variable name 'custom_components_from_file'
🐛 fix(endpoints.py): fix typo in variable name 'filtered'
🐛 fix(base.py): fix indentation of raise statement to improve code readability
🐛 fix(component.py): fix indentation of if statements to improve code readability
🐛 fix(load_custom_component_from_path.py): fix indentation of base_path comment to improve code readability
🐛 fix(load_custom_component_from_path.py): fix indentation of base_path assignment to improve code readability
🐛 fix(load_custom_component_from_path.py): fix indentation of validate_code method to improve code readability
🐛 fix(load_custom_component_from_path.py): fix indentation of build_component_menu_list method to improve code readability
🐛 fix(types.py): fix indentation of extract_type_from_optional function to improve code readability
 feat(types.py): add support for building custom component templates
 feat(types.py): add support for building custom component templates with extra fields
 feat(types.py): add support for building custom component templates with function arguments
 feat(types.py): add support for building custom component templates with base classes
 feat(types.py): add support for building custom component templates with return type
 feat(types.py): add support for building custom component templates with exception handling
 feat(types.py): add support for building custom component templates from a specified path
🐛 fix(settings.py): fix indentation of set_env_variables method to improve code readability
 feat(settings.py): add support for specifying component path in settings

🐛 fix(test_custom_component.py): change variable names and attributes in YourComponent class for better readability and consistency
🐛 fix(test_custom_component.py): reformat code to adhere to PEP8 style guide
🐛 fix(test_custom_component.py): fix syntax error in test_component_get_code_tree_syntax_error()
🐛 fix(test_custom_component.py): fix syntax error in test_custom_component_class_template_validation_no_code()
🐛 fix(test_custom_component.py): fix syntax error in test_custom_component_get_main_class_name_no_main_class()
 feat(test_custom_component.py): add test_component_get_function_valid() to test the get_function method of the Component class with valid code and function_entrypoint_name
 feat(test_custom_component.py): add test_code_parser_parse_assign() to test the parse_assign method of the CodeParser class
 feat(test_custom_component.py): add test_custom_component_class_template_validation_no_code() to test the _class_template_validation method of the CustomComponent class when the code is None
 feat(test_custom_component.py): add test_custom_component_get_main_class_name_no_main_class() to test the get_main_class_name method of the CustomComponent class when there is no main class
 feat(test_custom_component.py): add test_custom_component_get_function_entrypoint_args_no_args() to test the get_function_entrypoint_args method of the CustomComponent class when there are no arguments
 feat(test_custom_component.py): add test_custom_component_get_function_entrypoint_return_type_none() to test the get_function_entrypoint_return_type method of the CustomComponent class when the return type is None
2023-07-21 19:13:52 +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
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
d7a3c10d3a 🔧 refactor(test_custom_component.py): improve readability by breaking long lines of code
🔨 refactor(test_custom_component.py): update import statement to reflect new file structure
2023-07-15 01:02:52 +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
gustavoschaedler
a6fe4091ac Merge branch 'dev' into python_custom_node_component 2023-07-12 16:34:21 +01:00
Gabriel Luiz Freitas Almeida
c159f71b83 🐛 fix(test_chains_template.py): set "show" property of "verbose" to False in conversation_chain, llm_chain, and llm_math_chain tests to fix failing tests due to incorrect value 2023-07-11 18:03: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
68bca25266 🐛 fix(test_agents_template.py): update assertions for template variables in test_zero_shot_agent
The assertions for the template variables in the `test_zero_shot_agent` function have been updated to reflect the changes in the template structure. This ensures that the tests accurately check the expected values of the template variables.
2023-07-07 18:45:01 -03:00
Gabriel Luiz Freitas Almeida
caaabf5023 🔥 refactor(test_graph.py): remove unused imports and test cases related to specific vertex types
🔬 test(test_graph.py): remove test cases for building specific vertex types
The commit removes unused imports and test cases related to specific vertex types that are no longer used in the codebase. This improves code cleanliness and reduces clutter. The removed test cases were for building specific vertex types, which are no longer necessary as the build method is now tested in a more general way.
2023-07-07 18:26:00 -03:00
Gabriel Luiz Freitas Almeida
94d598b59c 🔧 fix(test_endpoints.py): fix import statement for TimeTravelGuideChainNode
🔧 fix(test_endpoints.py): update test_get_all to assert "PromptTemplate" instead of "ZeroShotPrompt"
🔧 fix(test_endpoints.py): update test_valid_prompt and test_invalid_prompt to use PROMPT_REQUEST variable
🔧 fix(test_endpoints.py): update test_various_prompts to use PROMPT_REQUEST variable
🔧 fix(test_prompts_template.py): remove test_zero_shot_prompt as it is no longer needed
The import statement for TimeTravelGuideChainNode is fixed to ensure the correct module is imported. The test_get_all function is updated to assert the presence of "PromptTemplate" instead of "ZeroShotPrompt" in the response. The test_valid_prompt, test_invalid_prompt, and test_various_prompts functions are updated to use the PROMPT_REQUEST variable for the request payload. The test_zero_shot_prompt function is removed as it is no longer needed.
2023-07-07 18:25:57 -03:00
Gabriel Luiz Freitas Almeida
156807b8e1 fix: replace old complex_example to fix tests 2023-07-01 09:52:45 -03:00
Gabriel Luiz Freitas Almeida
534927e5fa 🔒 chore(test_graph.py): comment out complex graph test case to improve test performance
🔒 chore(test_graph.py): comment out the complex graph test case to improve the performance of the test suite. The complex graph test case is currently not passing and is causing unnecessary delays in the test execution.
2023-06-30 17:29:08 -03:00
Gabriel Luiz Freitas Almeida
d96a2d70ac 🔧 chore(test_websocket.py): remove unnecessary commented out code and update websocket test input
The commented out code was not needed and was cluttering the test file. The test input for the websocket was updated to use a more descriptive key name "input" instead of "type" to improve clarity and readability.
2023-06-30 17:16:41 -03:00
Gabriel Luiz Freitas Almeida
8088565768 🔥 refactor(test_chains_template.py): remove unused import of Serializable
The import of the Serializable class is no longer needed in the test_chains_template.py file, so it has been removed to improve code cleanliness and remove unnecessary dependencies.
2023-06-30 17:05:51 -03:00
Gabriel Luiz Freitas Almeida
9fe13ca52d 🔀 chore(test_llms_template.py): rename base class from "Serializable" to "BaseLLM" for clarity and consistency
The base class "Serializable" has been renamed to "BaseLLM" to provide a more descriptive and consistent name for the class. This change improves clarity and maintainability of the code.
2023-06-29 19:46:08 -03:00
Gabriel Luiz Freitas Almeida
ce34ac4825 🐛 fix(test_websocket.py): fix the endpoint URL in the test_init_build test
The endpoint URL in the test_init_build test has been fixed to "api/v1/build/init/test" to match the correct URL pattern. This ensures that the test is accurately testing the intended functionality.
2023-06-28 22:50:55 -03:00
Gabriel Luiz Freitas Almeida
1880484a6c fix: add info field to tests 2023-06-27 13:25:59 -03:00
Gabriel Luiz Freitas Almeida
d0893d2eb7 🔥 chore(test_prompts_template.py): remove unused test_few_shot_prompt_template function
The test_few_shot_prompt_template function is not being used and is not necessary for the tests. Removing it will make the code cleaner and easier to maintain.
2023-06-24 16:53:13 -03:00
Gabriel Luiz Freitas Almeida
d4559c1356 test(test_template.py): add assertion to check if result is not None
The test now includes an assertion to check if the result of the function call is not None. This ensures that the function is returning a value and that the test is checking the correct output.
2023-06-23 10:53:53 -03:00
Gabriel Luiz Freitas Almeida
c191d893ca test(test_template.py): add assertions to test_build_template_from_function
Added assertions to test_build_template_from_function to ensure that the returned result is not None and that the expected keys are present in the result. This improves the reliability of the test and ensures that the function is working as expected.
2023-06-23 10:52:55 -03:00
Gabriel Luiz Freitas Almeida
a0f48b1d12 🐛 fix(test_graph.py): add assertion to check if root node is not None
The test_build_params function was failing when the root node was None. This commit adds an assertion to check if the root node is not None before proceeding with the other assertions.
2023-06-23 10:44:23 -03:00
Gabriel Luiz Freitas Almeida
cc8e5e3106 🚀 feat(tests): update default values for OpenAI models in chat and text fields
The default value for the OpenAI model in the chat field has been updated to "gpt-3.5-turbo-0613" to reflect the latest version of the model. The default value for the OpenAI model in the text field has been updated to "text-davinci-003" to reflect the latest version of the model. This ensures that the tests are using the latest and most accurate models for OpenAI.
2023-06-23 09:19:25 -03:00
Gabriel Luiz Freitas Almeida
d069ab5d6d 🚨 test(agents_template.py): add openai-multi-functions to the list of agents
🐛 fix(graph.py): change message variable to a dictionary to match the expected input of get_result_and_thought function and update the assertion to check if the result is a dictionary instead of a string
The test for agents_template.py was updated to include the openai-multi-functions agent in the list of agents. This was done to ensure that the test coverage for the agent is complete.

The test for graph.py was updated to change the message variable to a dictionary to match the expected input of the get_result_and_thought function. The assertion was also updated to check if the result is a dictionary instead of a string. This was done to ensure that the test coverage for the function is complete.
2023-06-22 22:31:13 -03:00
Gabriel Luiz Freitas Almeida
a42b6587c5 🔧 chore(config.yml): update Swagger API overview and paths
The Swagger API overview and paths have been updated to reflect the latest changes in the API. The changes include adding support for a new environment variable, `process.env.PORT`, to allow the application to run on a configurable port. Additionally, the Swagger API documentation has been updated to reflect the latest API version and routes.

🔍 chore(links): update links to use HTTPS instead of HTTP
The links were updated to use HTTPS instead of HTTP to improve security and prevent potential man-in-the-middle attacks.

🚨 fix(Openapi.json): fix invalid JSON syntax by removing trailing comma
The Openapi.json file had an invalid JSON syntax due to a trailing comma in the "file_path" field. This commit removes the trailing comma to fix the syntax error.

🔥 chore(test_graph.py): remove unnecessary comments and assertions
🚀 feat(test_graph.py): add file creation and deletion to test_file_tool_node_build and test_toolkit_node_build
The comments and assertions that were removed were unnecessary and did not add any value to the code. The test_file_tool_node_build and test_toolkit_node_build tests now create a file and delete it after the test is run. This ensures that the tests are self-contained and do not leave any artifacts behind.
2023-06-21 11:17:48 -03:00
Gabriel Luiz Freitas Almeida
0dd16ee794 Merge remote-tracking branch 'origin/dev' into multipart_endpoint 2023-06-21 10:07:14 -03:00
Gabriel Luiz Freitas Almeida
6886828ddd 🔀 refactor(process.py): change load_flow_from_json function signature to accept either a JSON file path or a JSON object
🔀 refactor(base.py): import Chain from langchain.chains.base instead of importing it from langflow.graph.vertex.types
🔀 refactor(process.py): remove print statement from process_tweaks function
🔀 refactor(process.py): change load_flow_from_json function signature to accept optional tweaks parameter
🔀 refactor(process.py): change return type of build method in Graph class from List[Vertex] to Chain
🧪 test(loading.py): add test case for loading a flow from a JSON file and applying tweaks
🧪 test(loading.py): remove unused import statement
The import statement for Chain in base.py is now more explicit and imports it from langchain.chains.base instead of importing it from langflow.graph.vertex.types. The load_flow_from_json function in process.py now accepts either a JSON file path or a JSON object. The print statement in process_tweaks function has been removed. The load_flow_from_json function in process.py now accepts an optional tweaks parameter. The return type of the build method in the Graph class has been changed from List[Vertex] to Chain. A new test case has been added to loading.py to test loading a flow from a JSON file and applying tweaks. An unused import statement has been removed from loading.py.
2023-06-19 11:36:43 -03:00
gustavoschaedler
a87ddf9187 Stream Build test case temporarily disabled 2023-06-17 20:10:05 +01:00
Gabriel Luiz Freitas Almeida
b93d5020b3 🐛 fix(process.py): caching objects does not depend on is_first_message anymore 2023-06-17 13:34:35 -03:00
Gabriel Luiz Freitas Almeida
3a324ed45a Merge remote-tracking branch 'origin/main' into dev 2023-06-16 19:28:47 -03:00
Gabriel Luiz Freitas Almeida
f658d62c51 🔥 chore(test_database.py): remove unused test_stress_create_flow function
The test_stress_create_flow function is not used in the codebase and is therefore removed to improve code readability and maintainability.
2023-06-16 19:12:45 -03:00
Gabriel Luiz Freitas Almeida
ad552d7add 🔨 refactor(test_database.py): remove unnecessary line breaks and whitespace
This commit removes unnecessary line breaks and whitespace in the test_database.py file to improve code readability and consistency.
2023-06-16 19:11:13 -03:00
gustavoschaedler
96b3331573 Tests fix 2023-06-16 23:07:23 +01:00
Gabriel Luiz Freitas Almeida
08f04d11d0 🔨 refactor(tests): fix formatting and remove unnecessary lines
The changes in this commit are purely cosmetic. The code has been reformatted to improve readability and consistency. Unnecessary lines have been removed to make the code more concise.
2023-06-16 18:53:42 -03:00
gustavoschaedler
78588ba260 Tests fix 2023-06-16 21:19:29 +01:00
gustavoschaedler
13d52e4987 Tests fix 2023-06-16 20:22:45 +01:00
gustavoschaedler
ceb6fda4c6 Tests fix 2023-06-16 19:47:35 +01:00
Gabriel Luiz Freitas Almeida
95597887b2 🔨 refactor(test_database.py): replace unused variable with underscore
The variable 'i' is not used in the for loop, so it has been replaced with an underscore to improve code readability.
2023-06-16 13:59:59 -03:00
gustavoschaedler
92a285bb2e Adjusted the name of the agent AgentInitializer to initialize_agent temporarily to fix a bug in the frontendnode 2023-06-16 15:38:20 +01:00