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.
The build_input_keys_response function now correctly filters out memory variables from the input keys response. Previously, it was using a list comprehension to filter the keys, but it should have been using a dictionary comprehension to preserve the key-value pairs. This fix ensures that only the keys that are not present in the langchain_object's memory variables are included in the input keys response.
The chat history is now reset when building a flow to ensure that the chat starts with a clean state. This helps prevent any potential issues or conflicts that may arise from previous chat interactions.
🐛 fix(loading.py): set input variable values if they are present in params
The "input_variables" field in the prompt's frontend_node template is now updated with the new list of variables, if it exists. This ensures that the input variables are correctly set when validating the prompt. In the loading module, the input variable values are now set if they are present in the params dictionary. This ensures that the prompt is correctly instantiated with the provided input variable values.
🐛 fix(formModal/index.tsx): format chatItem.message only if it is not from a bot to improve readability
🐛 fix(formModal/index.tsx): remove unnecessary console.log statement
🐛 fix(utils.py): rename variable in process_graph function to improve clarity and consistency
In the `ChatManager` class, the variable `chat_message` has been renamed to `chat_inputs` to better reflect its purpose of storing the input messages from the chat payload. This improves clarity and consistency within the class.
In the `process_graph` function in `utils.py`, the variable `chat_message` has been renamed to `chat_inputs` to better reflect its purpose of storing the input messages from the chat payload. This improves clarity and consistency within the function.
🔨 refactor(chatComponent): update code to correctly access template value from node data
🔨 refactor(chatInput): update button styling and positioning
🔨 refactor(chatInput): update Lock icon styling and positioning
🔨 refactor(chatInput): update Send icon styling and positioning
🔨 refactor(formModal): update setKeysValue function to correctly update the value at a specific index in the array
The build_input_keys_response function has been refactored to return an empty string for each input key in the langchain_object. This change ensures consistency in the response structure and provides a default value for each input key.
The input_types attribute is added to the template_field in the post_validate_prompt function. This change allows for specifying the input types that are accepted for the template field, providing more flexibility and control over the input data.
🔧 fix(index.ts): add input_types property to TemplateVariableType interface
The `input_types` property is added to the `TemplateFieldCreator` class in `base.py` and the `TemplateVariableType` interface in `index.ts`. This change allows for specifying the input types for template fields and template variables, respectively.
The message property in the sendAllProps type has been renamed to inputs to better reflect its purpose. This change improves the semantics of the code and makes it easier to understand the purpose of the property.
The message field of the ChatMessage schema now supports a dictionary type in addition to the previous string and None types. This change was made to allow for more complex messages to be sent and received in the chat.
✨ feat(formModal): add function to format message inputs into a string
This commit removes unused imports and variables from the file. A new function was added to format the message inputs into a string, which is used to display the message in the chat. This improves the readability of the code and makes it easier to understand how the message is being constructed.
✨ feat(formModal): add Input Variables section to Chat Form modal to allow users to input variables
🎨 style(formModal): adjust width of Chat Form modal and Input Variables section to improve UI
🎨 style(formModal): adjust layout of Input Variables section to improve UI
🎨 style(formModal): adjust layout of From Chat switch to improve UI
🐛 fix(formModal): replace Switch component with custom ToggleShadComponent to fix styling issue