Commit graph

2,493 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
84718246e1 🔧 chore(config.yaml): add output_parsers section with StructuredOutputParser and ResponseSchema
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.
2023-06-29 12:57:31 -03:00
Gabriel Luiz Freitas Almeida
3167330cbc 🔧 fix(validate.py): add "BaseOutputParser" to the list of input_types in the template_field
🔧 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.
2023-06-29 12:57:16 -03:00
Gabriel Luiz Freitas Almeida
e87a475584 🔀 refactor(constants.py): import vertex types from langflow.graph.vertex.types instead of individual imports
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.
2023-06-29 12:57:04 -03:00
Gabriel Luiz Freitas Almeida
c6d8d62ffd 🚧 chore(types.py): add OutputParserVertex class to support output parsing functionality
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.
2023-06-29 12:56:50 -03:00
Gabriel Luiz Freitas Almeida
5e00debae4 🔧 fix(utils.py): add import statement for output_parsers module
🔧 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.
2023-06-29 12:56:36 -03:00
Gabriel Luiz Freitas Almeida
fa3bcdefee 📦 chore(output_parsers): add output parsers module and base classes
🚀 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.
2023-06-29 12:55:58 -03:00
Gabriel Luiz Freitas Almeida
e9a907babe 🔧 chore(utils.ts): add support for output_parsers node color and icon
🚀 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.
2023-06-29 12:55:26 -03:00
Gabriel Luiz Freitas Almeida
2876afa79a 🐛 fix(loading.py): fix formatting of input variables in instantiate_prompt function
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.
2023-06-29 11:44:51 -03:00
Lucas Oliveira
1be3de50c5 Changes to only make the Prompt Check run once 2023-06-29 11:30:00 -03:00
Lucas Oliveira
18b2226b12 Fixed bug where the node internals are not updated at the PromptTemplate 2023-06-29 11:25:48 -03:00
Lucas Oliveira
dadaaa895d 🔥 refactor(chatComponent/index.tsx): remove unnecessary console.log statements for 'open' and 'isBuilt' variables 2023-06-28 18:17:37 -03:00
Lucas Oliveira
657dfa1bb6 Merge branch 'form_io' of github.com:logspace-ai/langflow into form_io 2023-06-28 18:17:21 -03:00
Lucas Oliveira
7b2763a1af 🐛 fix(parameterComponent): set isPending to true for each tab in the parameter component state to fix a bug
🐛 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
2023-06-28 18:16:59 -03:00
Gabriel Luiz Freitas Almeida
a445b079e0 🔧 refactor(loading.py): simplify instantiation of prompt and format_kwargs assignment
💡 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.
2023-06-28 17:59:57 -03:00
Lucas Oliveira
3bd103dbc5 🔨 refactor(promptComponent): move postValidatePrompt import statement to the top of the file for better organization
🔥 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
2023-06-28 17:42:58 -03:00
Lucas Oliveira
a50e089401 Merge branch 'form_io' of github.com:logspace-ai/langflow into form_io 2023-06-28 17:31:14 -03:00
Lucas Oliveira
18acd7e257 🐛 fix(formModal/index.tsx): add missing setTabsState function to TabsContext to fix error
🐛 fix(formModal/index.tsx): update formKeysData.input_keys value when chatValue changes to reflect user input
2023-06-28 17:31:10 -03:00
Gabriel Luiz Freitas Almeida
bb377d4935 🐛 fix(utils.py): set input keys values from artifacts in build_input_keys_response function
 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.
2023-06-28 17:27:28 -03:00
Gabriel Luiz Freitas Almeida
d0da0bb1ca 🐛 fix(chat.py): add support for artifacts in stream_build function to pass prompt variables to build_input_keys_response
 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.
2023-06-28 17:27:18 -03:00
Gabriel Luiz Freitas Almeida
03349bf999 🐛 fix(vertex/base.py): add artifacts attribute to Vertex class to store additional data
🐛 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.
2023-06-28 17:26:57 -03:00
Lucas Oliveira
78ffad4c85 Merge branch 'form_io' of github.com:logspace-ai/langflow into form_io 2023-06-28 17:13:43 -03:00
Lucas Oliveira
9d556bc94c 🐛 fix(chatComponent): remove unused openForm state variable
🐛 fix(formModal): remove console.log statement
🐛 fix(formModal): fix formatMessage function to handle string inputs correctly
2023-06-28 17:13:32 -03:00
Gabriel Luiz Freitas Almeida
6afca21e5a 🐛 fix(utils.py): fix build_input_keys_response function to correctly filter out memory variables from input keys
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.
2023-06-28 17:13:06 -03:00
Gabriel Luiz Freitas Almeida
c9bb88933b 🔧 chore(chat.py): reset chat history when building a flow to ensure a clean state
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.
2023-06-28 16:51:02 -03:00
Gabriel Luiz Freitas Almeida
a0919cb649 🐛 fix(validate.py): set "input_variables" field to new list of variables if it exists
🐛 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.
2023-06-28 16:43:51 -03:00
Lucas Oliveira
16fc6bc4a2 🐛 fix(formModal/index.tsx): fix type of intermediate_steps property to be a string instead of "string" to prevent type error
🐛 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
2023-06-28 16:38:21 -03:00
Gabriel Luiz Freitas Almeida
695bc4c9bf 🐛 fix(manager.py): rename variables in ChatManager class to improve clarity and consistency
🐛 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.
2023-06-28 12:01:36 -03:00
Lucas Oliveira
5c22062f72 Merge branch 'form_io' of github.com:logspace-ai/langflow into form_io 2023-06-28 11:52:44 -03:00
Lucas Oliveira
c76b8766c0 🔨 refactor(chatComponent): remove unused import of ChatModal to improve code cleanliness
🔨 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
2023-06-28 11:51:21 -03:00
Gabriel Luiz Freitas Almeida
5a76d36cd4 🔧 chore(utils.py): refactor build_input_keys_response function to return an empty string for each input key
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.
2023-06-28 11:44:07 -03:00
Lucas Oliveira
0c18aab513 Merge branch 'form_io' of github.com:logspace-ai/langflow into form_io 2023-06-28 11:35:34 -03:00
Lucas Oliveira
789a4cb2f8 Fixed bug with template code area 2023-06-28 11:35:30 -03:00
Gabriel Luiz Freitas Almeida
40179ee011 🔧 chore(validate.py): add input_types to template_field in post_validate_prompt function
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.
2023-06-28 11:33:56 -03:00
Gabriel Luiz Freitas Almeida
0ecb531749 🔧 fix(base.py): add input_types property to TemplateFieldCreator class
🔧 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.
2023-06-28 11:33:42 -03:00
Lucas Oliveira
5d2901c7a6 🔧 fix(GenericNode/index.tsx): remove console.log statement for data object
🔥 chore(ProgressBarComponent/index.tsx): delete unused ProgressBarComponent component
🔧 fix(intComponent/index.tsx): remove commented out console.log statement for event object
2023-06-28 11:07:58 -03:00
Lucas Oliveira
9cb85a0c21 🔧 fix(tabsContext.tsx): remove console.log statements for cleaner code
🔧 fix(nodeToolbarComponent/index.tsx): remove console.log statement for cleaner code
🔧 fix(utils.ts): remove console.log statement for cleaner code
2023-06-28 11:07:49 -03:00
Lucas Oliveira
da5aa1e05b Merge branch 'form_io' of github.com:logspace-ai/langflow into form_io 2023-06-28 11:01:40 -03:00
Lucas Oliveira
3b1b42fe3e Changed styling on From Chat toggle 2023-06-28 11:01:37 -03:00
Gabriel Luiz Freitas Almeida
6cf9639128 feat: add template to input_keys_response 2023-06-28 10:58:55 -03:00
Gabriel Luiz Freitas Almeida
b8f150d1ac format 2023-06-28 08:47:42 -03:00
Lucas Oliveira
264cb8aa30 📝 chore(constants.tsx): update CHAT_FORM_DIALOG_SUBTITLE to provide a more accurate description of its purpose and usage 2023-06-28 00:54:03 -03:00
Lucas Oliveira
a6e5dcaadc Deleted chat modal and changed disposition of clearChat button 2023-06-28 00:44:48 -03:00
Lucas Oliveira
d59b648b75 🔥 refactor(formTrigger): remove unused FormTrigger component
🔥 refactor(chatComponent): remove import and usage of FormTrigger component

🔥 refactor(ui/badge): remove unused size variant in Badge component

🔥 refactor(formModal/chatInput): remove unused Eraser icon import and clearChat function

🔥 refactor(formModal/chatMessage): remove unused classNames import and remove dark mode classes

🔥 refactor(formModal): remove unused Eraser icon import and clearChat function
2023-06-28 00:38:21 -03:00
Gabriel Luiz Freitas Almeida
2e09d7026b 🔀 chore(api): rename message property to inputs in sendAllProps type
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.
2023-06-27 21:33:06 -03:00
Gabriel Luiz Freitas Almeida
c39e94d584 🔨 refactor(base.py): change message parameter to inputs parameter to improve semantics
The message parameter was not being used in the function, so it was changed to inputs to better reflect the purpose of the parameter.
2023-06-27 21:32:46 -03:00
Gabriel Luiz Freitas Almeida
5a9c1ae1b7 🔀 chore(schemas.py): add support for dict type in message field of ChatMessage schema
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.
2023-06-27 21:32:09 -03:00
Gabriel Luiz Freitas Almeida
a4101dac53 🔥 refactor(formModal): remove unused imports and variables
 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.
2023-06-27 21:31:47 -03:00
Lucas Oliveira
e1efeb6b33 Merge branch 'form_io' of github.com:logspace-ai/langflow into form_io 2023-06-27 20:58:11 -03:00
Lucas Oliveira
8c721b0b8e 🐛 fix(formModal): fix keysValue state initialization to prevent undefined error
 feat(formModal): add support for memory_keys in input variables accordion to display memory keys in chat form modal
2023-06-27 20:58:01 -03:00
Lucas Oliveira
355b846be4 🎨 style(constants.tsx): add CHAT_FORM_DIALOG_SUBTITLE constant to improve code readability
 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
2023-06-27 20:54:24 -03:00