Commit graph

938 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
ec478a8a5e 🐛 fix(process.py): add comments to clarify the purpose of adding artifacts to inputs
 feat(process.py): refactor processing logic for VectorStore objects to use the search method instead of generating a result message
🐛 fix(parameterComponent/index.tsx): remove duplicate import of MAX_LENGTH_TO_SCROLL_TOOLTIP
🔧 chore(utils.ts): import HuggingFaceIcon from the correct file path
2023-07-11 09:03:29 -03:00
Gabriel Luiz Freitas Almeida
4a0324bc7f 🔥 chore(config.yaml): comment out DocArrayInMemorySearch vectorstore integration
ℹ️ The DocArrayInMemorySearch vectorstore integration is currently not supported due to compatibility issues with the required version of docarray. Commenting it out to prevent potential errors.
2023-07-11 09:03:28 -03:00
Gabriel Luiz Freitas Almeida
a90c9fbd34 🐛 fix(loading.py): replace spaces with underscores in tool names to improve consistency and avoid issues
🐛 fix(base.py): catch and log exceptions when fixing memory inputs to prevent crashes
🐛 fix(process.py): check if memory_key attribute exists before accessing it to prevent AttributeError
🐛 fix(memories.py): hide memory_key field for ConversationEntityMemory to improve user experience
2023-07-10 22:42:44 -03:00
Gabriel Luiz Freitas Almeida
c77674b171 🐛 fix(chains.py): hide the "verbose" field in the frontend node template to improve user experience 2023-07-10 21:32:43 -03:00
Gabriel Luiz Freitas Almeida
7b2db83033 🐛 fix(tools.py): add "BaseTool" as a base class for PythonFunctionToolNode to fix inheritance issue 2023-07-10 18:43:08 -03:00
Gabriel Luiz Freitas Almeida
cd9fc3a2e4 🐛 fix(loading.py): fix conditional statement for instantiating prompt objects based on node_type
 feat(loading.py): improve formatting of input variables for prompt objects
2023-07-10 17:50:33 -03:00
Gabriel Luiz Freitas Almeida
00c1734fb8 🐛 fix(chat.py): fix the issue where the params variable is not converted to a string before slicing it in the log message to avoid TypeError 2023-07-10 17:50:32 -03:00
Gabriel Luiz Freitas Almeida
2cb8452968 🐛 fix(types.py): refactor _built_object_repr method in PromptVertex to improve readability and handle edge cases 2023-07-10 17:50:31 -03:00
Gabriel Luiz Freitas Almeida
43e69f1f45 🐛 fix(types.py): fix variable name in format method to correctly reference the 'artifacts' variable 2023-07-10 16:29:39 -03:00
Gabriel Luiz Freitas Almeida
2c2ae5451c 🔒 chore(base.py): add validation for invalid input variable names in validate_prompt function
🐛 fix(base.py): raise ValueError if any of the input variables in template are named as invalid names to prevent potential issues
2023-07-10 15:13:40 -03:00
Gabriel Luiz Freitas Almeida
02fc2004e1 🐛 fix(textsplitters.py): change default value of Separator field from "." to "\\n" to correctly split text by newline characters 2023-07-10 13:54:46 -03:00
Gabriel Luiz Freitas Almeida
8f9bfd2a7c 🐛 fix(loading.py): fix issue with separators being escaped strings by decoding them using unicode-escape encoding 2023-07-10 13:50:45 -03:00
Gabriel Luiz Freitas Almeida
f56e31163a 🐛 fix(types.py): handle KeyError when formatting prompt with artifacts to prevent application crash
🔀 refactor(types.py): remove "handle_keys" from artifacts before formatting prompt to avoid format errors
2023-07-10 13:22:44 -03:00
Gabriel Luiz Freitas Almeida
df348b019d 🔧 chore(memories.py): hide "entity_store" field in MemoryFrontendNode class to improve code readability and remove unnecessary code 2023-07-10 12:55:11 -03:00
Gabriel Luiz Freitas Almeida
650275db8a 🔧 chore(base.py): add __repr__ method to Graph class for better debugging and representation 2023-07-10 08:05:18 -03:00
Gabriel Luiz Freitas Almeida
d8dee14ed5 🔨 refactor(base.py): refactor the _build method in the Vertex class for better readability and maintainability
🐛 fix(base.py): fix a bug where the built object is not updated correctly in the Vertex class
 feat(base.py): add validation to check if the built object is None in the Vertex class
2023-07-09 18:09:53 -03:00
Gabriel Luiz Freitas Almeida
008a1c4079 🐛 fix(types.py): replace eval() with ast.literal_eval() to safely evaluate headers parameter as dictionary-like string
🐛 fix(process.py): rename input parameter to flow for clarity and to avoid shadowing built-in function
2023-07-09 18:02:12 -03:00
Gabriel Luiz Freitas Almeida
612c7a988c 🔥 refactor(callback.py): remove unused imports to improve code readability and maintainability 2023-07-09 11:14:06 -03:00
Gabriel Luiz Freitas Almeida
c0df1f7c3b 🐛 fix(callback.py): fix issue with splitting output into multiple ChatResponse instances
 feat(callback.py): split the output into multiple ChatResponse instances to emulate a stream of tokens
2023-07-09 11:00:25 -03:00
Gabriel Luiz Freitas Almeida
c959d7bdd5 📝 docs(constants.py): add missing documentation for INPUT_KEY_INFO and OUTPUT_KEY_INFO variables
🐛 fix(memories.py): set info field for input_key and output_key fields to provide additional information to users
2023-07-09 10:51:18 -03:00
Gabriel Luiz Freitas Almeida
99be9830ad 🐛 fix(manager.py): catch and log RuntimeError when closing websocket connection to prevent unexpected ASGI message error
🔒 chore(manager.py): improve error handling when closing websocket connection to prevent unexpected ASGI message error
2023-07-09 10:31:46 -03:00
Gabriel Luiz Freitas Almeida
2d4642fc36 🔧 fix(callback.py): add error handling when sending response to websocket to prevent potential errors
🔧 fix(callback.py): change intermediate_steps assignment to use formatted string for better readability and maintainability
 feat(callback.py): add observation_prefix parameter to on_tool_end method to allow customization of the observation prefix in the response message
 feat(callback.py): add logger to handle potential errors when sending response to websocket
2023-07-08 16:49:30 -03:00
Gabriel Luiz Freitas Almeida
800f4b0a94 🐛 fix(loading.py): handle case when loading file into dict fails and raise ValueError with "Invalid file" message
 feat(loading.py): improve code readability by using walrus operator to assign loaded file dict to params["dict_"] variable
2023-07-08 16:45:59 -03:00
Gabriel Luiz Freitas Almeida
3441bb4e5b 🐛 fix(utils.py): improve error handling and file type detection in load_file_into_dict function 2023-07-08 16:45:33 -03:00
Gabriel Luiz Freitas Almeida
bd9bd13f57 🐛 fix(loading.py): handle conversion of max_tokens from string to int if necessary 2023-07-08 15:40:05 -03:00
Gabriel Luiz Freitas Almeida
6aac7e8e80 🐛 fix(types.py): add a check for None before checking if the built object has a "format" attribute to prevent potential AttributeError 2023-07-08 14:57:22 -03:00
Gabriel Luiz Freitas Almeida
fbdde257e0 🔧 fix(types.py): fix indentation issue in the repr method of DocumentLoaderVertex and TextSplitterVertex classes
🔧 fix(types.py): calculate average document length in the repr method of DocumentLoaderVertex and TextSplitterVertex classes
2023-07-08 14:52:59 -03:00
Gabriel Luiz Freitas Almeida
7e712b1be8 🐛 fix(loading.py): convert "max_tokens" parameter from string to int if it is a string and can be converted to int
🐛 fix(loading.py): remove "max_tokens" parameter if it is not an integer
2023-07-08 13:59:46 -03:00
Gabriel Luiz Freitas Almeida
6c17949d21 🔧 fix(base.py): add exception handling when formatting intermediate steps to prevent crashes and log the exception 2023-07-08 11:43:01 -03:00
Gabriel Luiz Freitas Almeida
ba6cf77fe9 feat(base.py): add support for creating SQLDatabaseChain from LLM
📝 docs(base.py): update documentation for ChainCreator class
2023-07-08 11:42:36 -03:00
Gabriel Luiz Freitas Almeida
72b4a2d943 🔥 refactor(chat.py): remove unnecessary code for building the root node in the graph
The code for building the root node in the graph has been removed as it is no longer necessary. Previously, the root node was built separately due to certain nodes requiring parameters that were not connected to it. However, this approach has been reconsidered and the tools are now connected to the ZeroShotPrompt, eliminating the need for separate building of the root node.
2023-07-08 11:40:56 -03:00
Gabriel Luiz Freitas Almeida
92eb45dd42 🔧 chore(config.yaml): add documentation for SQLDatabase wrapper
🐛 fix(utils.py): fix import of wrapper_creator from langflow.interface.wrappers.base
🔧 chore(loading.py): add support for instantiating wrappers based on node type
🔧 chore(base.py): add support for creating SQLDatabase wrapper from URI
The config.yaml file was modified to add documentation for the SQLDatabase wrapper. In utils.py, the import of wrapper_creator from langflow.interface.wrappers.base was fixed. In loading.py, support was added for instantiating wrappers based on the node type. In base.py, support was added for creating the SQLDatabase wrapper from a URI. These changes were made to improve the functionality and maintainability of the codebase.
2023-07-07 19:06:19 -03:00
Gabriel Luiz Freitas Almeida
fc4dca8a6d 🔧 fix(customs.py): add MongoDBChatMessageHistory to CUSTOM_NODES dictionary
 feat(memories.py): add MongoDBChatMessageHistoryFrontendNode class to support MongoDB as a memory store
The CUSTOM_NODES dictionary in customs.py has been updated to include the "MongoDBChatMessageHistory" memory. This allows the application to use MongoDB as a memory store for chat message history. The MongoDBChatMessageHistoryFrontendNode class has been added to memories.py, providing the necessary functionality and configuration options for interacting with MongoDB as a memory store.
2023-07-07 18:25:54 -03:00
Gabriel Luiz Freitas Almeida
fcac473a61 🔀 chore(config.yaml): reorganize the order of sections in the config file
The order of sections in the config.yaml file has been adjusted for better readability and organization. The "prompts" section has been moved to the top, followed by the "memories" section, and then the "textsplitters" section. This change improves the structure and consistency of the config file.
2023-07-07 17:22:44 -03:00
Gabriel Luiz Freitas Almeida
6f9520d620 🐛 fix(base.py): add type hint for 'template' attribute in FrontendNodeRequest class
🐛 fix(utils.py): add input validation for 'chat_inputs.message' to prevent errors when no message is provided
🐛 fix(loading.py): add type hint for 'format_kwargs' variable in instantiate_prompt function
🐛 fix(base.py): add type hint for 'inputs' parameter in get_result_and_steps function
The changes in `base.py` and `utils.py` are bug fixes that address potential issues in the code. The type hint for the 'template' attribute in the `FrontendNodeRequest` class is added to improve code clarity and maintainability. The input validation for 'chat_inputs.message' in the `process_graph` function ensures that an error is raised when no message is provided, preventing potential issues down the line. In `loading.py`, the type hint for the 'format_kwargs' variable in the `instantiate_prompt` function improves type safety. Lastly, in `base.py`, the type hint for the 'inputs' parameter in the `get_result_and_steps` function ensures proper type checking.
2023-07-07 15:54:15 -03:00
Gabriel Luiz Freitas Almeida
4e078d7de5 🐛 fix(agents.py): change field type name from 'type_name' to 'field_type' for consistency
The 'type_name' attribute for the 'Tools' field in the 'ZeroShotAgent' class has been changed to 'field_type' to improve consistency with the naming conventions used in the codebase.
2023-07-07 15:53:48 -03:00
Gabriel Luiz Freitas Almeida
da0cf30057 🐛 fix(loading.py): fix condition to remove empty input_key and output_key parameters
The condition to remove empty input_key and output_key parameters has been fixed to correctly handle cases where the parameters are empty strings. This ensures that the parameters are only removed if they are either empty strings or not present in the params dictionary.
2023-07-07 15:38:36 -03:00
Lucas Oliveira
be7d9c93fe Formatting changes 2023-07-07 12:05:01 -03:00
Cristhian Zanforlin Lousa
fbc9eb6d1b merge fix 2023-07-07 11:46:13 -03:00
Gabriel Luiz Freitas Almeida
6675592737 🔧 refactor(base.py): remove unnecessary condition in get_signature method
The condition `name in settings.<type>` is removed from the `get_signature` method in the `base.py` files of the `agents`, `chains`, `memories`, and `prompts` modules. This condition was unnecessary as it was already checked in the `get_custom_nodes` function. Removing this condition simplifies the code and improves readability.
2023-07-06 17:35:25 -03:00
Gabriel Luiz Freitas Almeida
116c600d95 🐛 fix(base.py): add check for name in settings to prevent accessing non-existent keys
The code now checks if the name is present in the settings before accessing the corresponding keys in the get_custom_nodes function. This prevents accessing non-existent keys and avoids potential errors.
2023-07-06 17:27:55 -03:00
Gabriel Luiz Freitas Almeida
44943d225a 🔥 refactor(customs.py): comment out unused ZeroShotPrompt in CUSTOM_NODES dictionary
The ZeroShotPrompt node in the CUSTOM_NODES dictionary is currently not being used and commented out for clarity and to improve code readability.
2023-07-06 17:21:03 -03:00
Gabriel Luiz Freitas Almeida
8cba8514c4 🐛 fix(agents.py): change type annotation of name parameter in format_field method to Optional[str] for better clarity
The type annotation of the name parameter in the format_field method has been changed to Optional[str] to indicate that it can be either a string or None. This change improves the clarity of the code and makes it easier to understand the expected input for the method.
2023-07-06 17:19:01 -03:00
Gabriel Luiz Freitas Almeida
afa1c17379 🔗 docs(config.yaml): update documentation links for PromptTemplate and CharacterTextSplitter
The documentation links for PromptTemplate and CharacterTextSplitter have been updated to the correct URLs. This ensures that users can access the relevant documentation for these components.
2023-07-06 17:11:26 -03:00
Gabriel Luiz Freitas Almeida
ee2278c37e 🚀 feat(base.py): add pydantic BaseModel as a base class for FieldFormatter to enable data validation and serialization
The FieldFormatter class now inherits from pydantic.BaseModel in addition to ABC (Abstract Base Class). This change allows FieldFormatter instances to benefit from the data validation and serialization capabilities provided by pydantic, improving the reliability and maintainability of the code.
2023-07-06 17:11:05 -03:00
Gabriel Luiz Freitas Almeida
86bbdb0c30 🐛 fix(tools.py): add "BaseTool" to the base_classes list to inherit from the correct parent class
The "base_classes" list in the ToolNode class has been updated to include "BaseTool" in addition to "Tool". This ensures that the ToolNode class correctly inherits from the BaseTool class, which is the intended parent class for this node.
2023-07-06 17:10:26 -03:00
Gabriel Luiz Freitas Almeida
e36027b679 🔀 chore(base.py): add "BaseTool" to the base_classes list in get_signature method
The "BaseTool" class is added to the base_classes list in the get_signature method. This change ensures that the "BaseTool" class is considered as one of the base classes when creating a tool's signature.
2023-07-06 17:10:06 -03:00
Gabriel Luiz Freitas Almeida
9094876ed3 feat(agents/base.py): add support for creating frontend nodes for agents
🔧 fix(agents/base.py): import missing AgentFrontendNode class from langflow.template.frontend_node.agents
🔧 fix(initialize/loading.py): pass node_type to instantiate_agent function to handle creation of frontend nodes for agents
🔧 fix(template/frontend_node/agents.py): add format_field method to AgentFrontendNode class to customize field behavior
The missing import statement for the AgentFrontendNode class from langflow.template.frontend_node.agents has been added to the base.py file. Support for creating frontend nodes for agents has been added to the AgentCreator class in the base.py file. The instantiate_agent function in the loading.py file now receives the node_type parameter to handle the creation of frontend nodes for agents. The AgentFrontendNode class in the agents.py file now includes a format_field method to customize the behavior of certain fields.
2023-07-06 17:09:18 -03:00
Gabriel Luiz Freitas Almeida
9f80af8f83 🐛 fix(types.py): fix missing return statement in PromptVertex's _built_object_repr method
The _built_object_repr method in the PromptVertex class was missing a return statement, causing it to not return any value. This fix adds the missing return statement to ensure the method returns the correct value.
2023-07-06 17:08:54 -03:00
Gabriel Luiz Freitas Almeida
b32e4ca8b9 🐛 fix(util.py): improve type formatting in format_dict function
The format_dict function now properly handles different variations of list types by removing unnecessary characters from the type string. This improves the consistency and accuracy of the type formatting in the function.
2023-07-06 17:08:28 -03:00