- Modifies the `CustomComponent` class to handle errors using `HTTPException` from FastAPI
- Removes the unused `HTTPExceptionWithTraceback` class
- Updates the error response format with `err.msg` and `traceback.format_exc()`
This commit adds a new class `HTTPExceptionWithTraceback` that extends `HTTPException` from the `fastapi` module. This new class includes a `traceback` attribute. Additionally, in the `extract_class_info` method of the `CustomComponent` class, a try-except block is added to catch any syntax errors raised by parsing the provided code. If a syntax error is encountered, an HTTPException is raised with the error message and traceback.
This commit adds support for dynamic fields in the template field creator class. The "dynamic" attribute has been added to the class definition and its default value is set to False.
This commit adds a dynamic field to the code field in the types module. The dynamic field is set to True, indicating that the field allows updates.
refactor: Remove dynamic field from FrontendNode class
In the FrontendNode class of the base module, the dynamic field has been removed. This change aligns with the removal of the dynamic field in the types module.
refactor: Remove dynamic field from CustomComponentNode class
The dynamic field has been removed from the CustomComponentNode class in the tools module. This aligns with the removal of the dynamic field in the FrontendNode class.
- The `build` method of `MyPythonClass` is modified to accept an `openai_api_key` parameter instead of using a hardcoded value.
- This change allows for dynamic usage of different API keys when constructing an instance of `ConversationChain`.
- The `my_conversation` method now takes `openai_api_key` as an argument and uses it to initialize the `llm` instance of `OpenAI`.
- The `build` method simply delegates the `openai_api_key` argument to the `my_conversation` method and returns the resulting `ConversationChain` instance.
- Updatethe `get_function_custom` function to use the `validate.extract_class_name` function to extract class name from the `code` parameter.
- Modify `instantiate_tool` function to update the `class_object` with the return value of `get_function_custom` and call the `build` method on the instantiated object with the remaining params.
- Add a new function `extract_class_name` in the `validate` module to extract class name from the `code` parameter.
- 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