- Added a dynamic flag to CustomComponentNode class in tools.py for enabling dynamic behavior.
- This flag allows for flexibility in executing the Python class.
- The flag defaults to True.
Previously, the `build` method in the `MyPythonClass` class had an argument named `name`, which could be confusing. This commit changes the argument name to `my_custom_input` to improve readability and clarity.
This commit removes the file `extract_info_from_class.py` which contained unnecessary code.
[v1/endpoints.py] Fix error handling in custom_component endpoint
This commit fixes the error handling in the `custom_component` endpoint in `endpoints.py`. If the class template extracted from the code is not valid, an error message is printed.
[importing/utils.py] Comment out unused code
This commit comments out unused code in `get_function_custom` function in `utils.py` file.
[initialize/loading.py] Comment out unused code
This commit comments out unused code in the `instantiate_tool` function in `loading.py` file.
[interface/tools/custom.py] Refactor code and add properties
This commit refactors the code in `CustomComponent` class in `custom.py` file. It adds properties for `data`, `is_valid`, and `args_and_return_type`.
[interface/types.py] Add base classes to custom component template
This commit adds base classes to the custom component template in the `build_langchain_template_custom_component` function in `types.py` file.
[utils/constants.py] Remove unnecessary import
This commit removes an unnecessary import in `DEFAULT_CUSTOM_COMPONENT_CODE` constant in `constants.py` file.
- Refactored the import statements for custom components in `endpoints.py` to use the newly created `CustomComponent` class instead of the previous implementation.
- Removed unnecessary import statements for custom components in `endpoints.py`.
- Added support for a new `CustomComponentVertex` type in the `VERTEX_TYPE_MAP` dictionary in `constants.py`.
- Modified the `PromptVertex` class in `types.py` to handle input variables from prompt text more efficiently.
- Added a new `CustomComponentVertex` class in `types.py` for custom component vertices.
- Renamed the `CustomComponent` class in `custom.py` to `CustomComponent_old`.
- Created a new `CustomComponent` class in `custom.py` to replace the previous implementation.
The DESCRIPTIONS array has been updated with additional phrases to provide a wider range of options for generating text. The ADJECTIVES array has been expanded with more descriptive words to add more color and personality to the generated text. The NOUNS array has been enriched with new names to increase the diversity of possible flow names. These updates aim to enhance the quality and creativity of the generated text by providing a greater variety of options.
The condition to check for the presence of "handle_keys" has been fixed to correctly check for its existence in the format_kwargs dictionary instead of the params dictionary. This ensures that the "handle_keys" list is properly populated when necessary.
The code was missing a condition to check if the variable is an instance of BaseOutputParser and has the "get_format_instructions" attribute. This condition is necessary to properly handle the variable and avoid potential errors.
The display_name field is added to the TemplateField object in the post_validate_prompt function. This field allows for a more user-friendly display of the variable name in the UI.
✨ feat(formModal/index.tsx): add support for dropdown menu component and button component
🔧 chore(formModal/index.tsx): fix indentation and spacing issues for better code formatting
🐛 fix(formModal/index.tsx): fix type error and handle input value changes correctly
🔧 chore(formModal/index.tsx): fix indentation and spacing issues for better code formatting
✨ feat(formModal/index.tsx): add support for textarea component and handle input value changes correctly
🔧 chore(formModal/index.tsx): fix indentation and spacing issues for better code formatting
✨ feat(formModal/index.tsx): add support for toggle component and handle input value changes correctly
🔧 chore(formModal/index.tsx): fix indentation and spacing issues for better code formatting
✨ feat(formModal/index.tsx): add support for dropdown menu component and button component
🔧 chore(formModal/index.tsx): fix indentation and spacing issues for better code formatting
✨ feat(formModal/index.tsx): add support for textarea component and handle input value changes correctly
🔧 chore(formModal/index.tsx): fix indentation and spacing issues for better code formatting
✨ feat(formModal/index.tsx): add support for toggle component and handle input value changes correctly
🔧 chore(formModal/index.tsx): fix indentation and spacing issues for better code formatting
✨ feat(formModal/index.tsx): add support for dropdown menu component and button component
🔧 chore(formModal/index.tsx): fix indentation and spacing issues for better code formatting
✨ feat(formModal/index.tsx): add support for textarea component and handle input value changes correctly
🔧 chore(formModal/index.tsx): fix indentation and spacing issues for better code formatting
✨ feat(formModal/index.tsx): add support for toggle component and handle input value changes correctly
🔧 chore(formModal/index.tsx): fix indentation and spacing issues for better code formatting
✨ feat(formModal/index.tsx): add support for dropdown menu component and button component
🔧 chore(formModal/index.tsx): fix indentation and spacing issues for better code formatting
✨ feat(formModal/index.tsx): add support for textarea component and handle input value changes correctly
🔧 chore(formModal/index.tsx): fix indentation and spacing issues for better code
🐛 fix(formModal/index.tsx): fix initial value of chatKey to correctly retrieve key from tabsState
🐛 fix(formModal/index.tsx): fix handleOnCheckedChange to correctly set chatKey and chatValue
🐛 fix(formModal/index.tsx): fix onChange of Textarea to correctly update tabsState input_keys
✨ feat(formModal/index.tsx): add support for clearing input value when form is submitted
✨ feat(formModal/index.tsx): add support for clearing input value when form is closed
🐛 fix(process.py): handle missing inputs in process_graph_cached function
The function `build_langchain_object_with_caching` has been renamed to `build_sorted_vertices_with_caching` to provide a more descriptive name that accurately reflects its purpose. Additionally, the `process_graph_cached` function now handles cases where the `inputs` parameter is missing or empty by populating it with values from the `artifacts` dictionary. This ensures that all required inputs are properly set before running the graph.
Both caching mechanisms improve the performance of building the langchain object and sorted vertices, reducing redundant computations and improving overall efficiency.
The `build_langchain_object_with_caching` function now uses the `memoize_dict` decorator to cache the result of building the langchain object from the data graph. This improves performance by avoiding redundant computations when the same data graph is used multiple times.
The `stream_build` function now logs the exception that occurred during the flow building process using the `logger.exception` method. This improves error handling and provides more detailed information about the error in the logs.
The Edge class constructor now takes an additional parameter 'edge' which is a dictionary containing additional information about the edge. This information is used to set the source_handle, target_handle, and target_param attributes of the Edge class. This change allows for more flexibility and extensibility when working with edges in the graph.
🔧 refactor(base.py): add edge parameter to Edge class constructor to pass additional edge information
The unused imports have been removed to improve code cleanliness. The code in the _build_params method has been simplified by removing unnecessary conditions and loops. Default values are now added for string and prompt type parameters to ensure that they have a value even if not explicitly set.
🔧 fix(base.py): remove unused imports and simplify code in _build_params method
🐛 fix(chatComponent): import lodash library to use _.cloneDeep function
✨ feat(chatComponent): add TabsContext to access tabsState and update isBuilt state based on tabsState changes
🐛 fix(interface/initialize/loading.py): handle BaseOutputParser instances in instantiate_prompt
The `optional_inputs` list in the `Vertex` class is now extended with the `input_types` from the `template_dicts` dictionary. This ensures that the `optional_inputs` list contains all the input types that are not required. In the `instantiate_prompt` function, if the `variable` is an instance of `BaseOutputParser` and has a `get_format_instructions` method, the `format_kwargs` dictionary is updated with the result of calling `get_format_instructions()`. This allows handling `BaseOutputParser` instances correctly in the `instantiate_prompt` function.
This commit adds support for Custom Component in the Langflow interface. It introduces a new class `CustomComponent`, which takes in a `code` as a parameter and validates it. The `CustomComponent` class also provides a method to get the function specified in the code.
The commit also makes some modifications in `initialize/loading.py` file to handle the new `CustomComponent` class. It adds a new helper function `get_function_custom` which creates a function using `validate.create_function` and the `build` function name.
The code now checks if the "handle_keys" key is present in the params dictionary. If it is not present, it creates an empty list and adds the input_variable to it. This ensures that the "handle_keys" list is always present and the input_variable is correctly added to it.
The build_input_keys_response function now includes support for handle_keys in the response. This allows the function to populate the handle_keys field in the response with the values from the artifacts dictionary, if available.