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.
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.
The configurations for the ChatPromptTemplate, SystemMessagePromptTemplate, and HumanMessagePromptTemplate wrappers have been commented out as they are currently not being used. This helps to improve code readability and reduces unnecessary clutter in the configuration file.
The config.yaml file now includes an output_parsers section with the StructuredOutputParser and ResponseSchema as the specified parsers. This change was made to enhance the functionality of the backend by enabling the parsing of structured output and response schemas.
🔧 fix(settings.py): add "output_parsers" attribute to the Settings class
The "input_types" list in the template_field of the post_validate_prompt function in validate.py was missing the "BaseOutputParser" type. This fix adds it to the list to ensure proper validation.
The Settings class in settings.py was missing the "output_parsers" attribute. This fix adds the attribute to the class to ensure that the list of output parsers can be properly configured and accessed.
The import statements for vertex types in constants.py have been refactored to import all types from langflow.graph.vertex.types. This improves code readability and maintainability by reducing the number of import statements and consolidating them into a single import.
The OutputParserVertex class is added to the types.py file. This class extends the Vertex class and is used to represent a vertex in the graph that performs output parsing. It takes a data parameter of type Dict in its constructor and calls the super constructor with the data and a base_type of "output_parsers". This change is made to support the implementation of output parsing functionality in the graph.
🔧 fix(loading.py): add import statement for output_parser_creator
🔧 fix(listing.py): add import statement for output_parser_creator
🔧 fix(types.py): add import statement for output_parser_creator
The import statements for the `output_parsers` module were missing in the respective files. This fix adds the necessary import statements to ensure that the `output_parser_creator` is accessible and can be used in the code.
🚀 feat(output_parsers): add OutputParserCreator class to handle creation and loading of output parsers
🚀 feat(output_parsers): add OutputParserFrontendNode class to handle formatting of output parser fields
The commit adds the following changes:
- A new file `__init__.py` is added to the `output_parsers` module.
- A new file `base.py` is added to the `output_parsers` module.
- A new file `output_parsers.py` is added to the `frontend_node` module.
The `__init__.py` file initializes the `OutputParserCreator` class, which is responsible for creating and loading output parsers. It also defines a method to get the signature of an output parser.
The `base.py` file contains the base class `OutputParserCreator` which is a subclass of `LangChainTypeCreator`. It defines the type name as "output_parsers" and provides methods to get the frontend node class and the type to loader dictionary. It also defines a method to convert the output parsers to a list.
The `output_parsers.py` file contains the `OutputParserFrontendNode` class, which is a subclass of `FrontendNode`. It provides a method to format the field of an output parser.
These changes are done to add support for output parsers in the application. The `OutputParserCreator` class allows for dynamic creation and loading of output parsers, while the `OutputParserFrontendNode` class provides a way to format the fields of an output parser.
🚀 feat(utils.ts): add support for output_parsers node name and icon
The `nodeColors` object now includes a color for the `output_parsers` node type, allowing it to be visually distinguished. Similarly, the `nodeNames` object now includes a name for the `output_parsers` node type. Additionally, the `nodeIconsLucide` object now includes an icon for the `output_parsers` node type. These changes improve the consistency and completeness of the node types in the application.
The instantiate_prompt function now properly formats the input variables before passing them to the prompt object. If the input variable is a string, it is passed as is. If the input variable is a list of Document objects, it is formatted to contain the page_content and metadata as one string separated by a newline. This ensures that the prompt object receives the correct input format.
🐛 fix(chatComponent): remove console.log statements for 'open' and 'isBuilt' variables to clean up code
🐛 fix(formModal): remove unnecessary console.log statement for 'tabsState[id.current]' variable to clean up code
🐛 fix(PageComponent): set isPending to true for each tab in the Page component state to fix a bug
💡 chore(loading.py): improve code readability and maintainability by simplifying the instantiation of the prompt object and assignment of format_kwargs dictionary.
The code has been refactored to use a dictionary comprehension to create the format_kwargs dictionary. This simplifies the logic and improves code readability. The commented out code for the prompt.partial() method has been removed as it is no longer necessary.
🔥 chore(promptModal): remove unused promptModal component
🔨 refactor(promptComponent): use useEffect to make a POST request to validate the prompt value and update the nodeClass state if the API returns data
✨ feat(utils.py): add support for setting input keys values from artifacts in build_input_keys_response function
The build_input_keys_response function now takes an additional parameter, artifacts, which is a dictionary containing key-value pairs. The function sets the values of the input keys in the input_keys_response dictionary based on the corresponding keys in the artifacts dictionary. This allows for more flexibility in setting the input keys values dynamically based on the provided artifacts.
✨ feat(chat.py): update build_input_keys_response function to accept artifacts parameter to set input_keys values
The stream_build function now supports the artifacts parameter, which allows passing prompt variables to the build_input_keys_response function. This ensures that the input_keys values are correctly set based on the provided artifacts. The build_input_keys_response function has been updated to accept the artifacts parameter and use it to set the input_keys values. This improves the functionality of the chat module by allowing more flexibility in handling prompt variables.
🐛 fix(vertex/base.py): update instantiation logic to handle tuple result from loading.instantiate_class()
🐛 fix(loading.py): update return value of instantiate_prompt() to return a tuple of prompt and format_kwargs
The Vertex class now has a new attribute called artifacts, which is a dictionary used to store additional data related to the vertex. The instantiation logic in the Vertex class has been updated to handle the case where loading.instantiate_class() returns a tuple containing the built object and additional artifacts. The loading.instantiate_prompt() function now returns a tuple containing the prompt and format_kwargs. These changes fix issues related to storing and handling additional data in the vertex and loading modules.