Commit graph

2,514 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
6fa295b8a8 🐛 fix(memories.py): fix condition to add extra fields in MemoryFrontendNode class
 feat(memories.py): add show attribute to entity_store field in MemoryFrontendNode class
The condition to add extra fields in the MemoryFrontendNode class has been fixed to correctly check if any of the base classes are in a list of base message classes. Additionally, the show attribute has been added to the entity_store field in the MemoryFrontendNode class to control its visibility.
2023-06-29 18:37:52 -03:00
Gabriel Luiz Freitas Almeida
c834d91efd 🐛 fix(util.py): exclude "kwargs" and "args" parameters from the generated template dictionary
The "kwargs" and "args" parameters are now excluded from the generated template dictionary. This ensures that only the relevant parameters are included in the template, improving the accuracy and usefulness of the generated template.
2023-06-29 18:37:33 -03:00
Gabriel Luiz Freitas Almeida
f81a835001 🐛 fix(process.py): add error handling for unknown langchain_object types
When processing the data graph, if the langchain_object is of an unknown type, a ValueError is now raised. This provides better error handling and helps identify any unexpected langchain_object types that may be encountered during processing.
2023-06-29 18:19:22 -03:00
Gabriel Luiz Freitas Almeida
7eeacfbb31 🐛 fix(base.py): add support for creating MemoryFrontendNode from a method
 feat(base.py): add support for creating MemoryFrontendNode from a specific method in ZepChatMessageHistory class
The `MemoryCreator` class now supports creating `MemoryFrontendNode` from a specific method in the `ZepChatMessageHistory` class. This is achieved by adding the `from_method_nodes` dictionary with the method name as the key and the class name as the value. The `build_template_from_method` function is used to create the `MemoryFrontendNode` from the specified method. This enhancement allows for more flexibility in creating `MemoryFrontendNode` instances.
2023-06-29 17:39:46 -03:00
Gabriel Luiz Freitas Almeida
77cc23bf5f 🐛 fix(base.py): fix method name in build_template_from_method call for MultiQueryRetriever
 feat(base.py): add support for ZepRetriever in from_method_nodes dictionary
The build_template_from_method call for the MultiQueryRetriever in the get_signature method was using the incorrect method name "from_llm". It has been fixed to use the correct method name "from_method_nodes". Additionally, support for the ZepRetriever has been added to the from_method_nodes dictionary to allow for its usage in the RetrieverCreator class.
2023-06-29 17:39:36 -03:00
Gabriel Luiz Freitas Almeida
e24ad0513b 🔧 chore(memories.py): set 'url' field to be shown in the frontend
The 'url' field in the MemoryFrontendNode class is now set to be shown in the frontend. This change allows the 'url' field to be visible and accessible to users in the frontend interface.
2023-06-29 17:39:25 -03:00
Gabriel Luiz Freitas Almeida
26c42cac05 🔧 chore(util.py): exclude "self" parameter from template building
The "self" parameter is now excluded from the template building process. This change improves the accuracy of the generated template by removing unnecessary information.
2023-06-29 17:39:12 -03:00
Gabriel Luiz Freitas Almeida
9e44720ac8 🔧 chore(config.yaml): comment out unused integrations in memories and retrievers sections
The unused integrations in the memories and retrievers sections have been commented out to improve code readability and remove unnecessary clutter. These integrations are not currently being used in the application and can be safely ignored.
2023-06-29 17:38:58 -03:00
Gabriel Luiz Freitas Almeida
473bde940c 🐛 fix(loading.py): add error handling for missing 'cursor' attribute in instantiate_memory function
The instantiate_memory function now includes error handling for a specific AttributeError that occurs when the object does not have a 'cursor' attribute. If this error occurs, an AttributeError is raised with a specific error message indicating a failure to build a connection to the database. This change improves the error handling and provides more informative error messages for debugging purposes.
2023-06-29 15:17:23 -03:00
Gabriel Luiz Freitas Almeida
3ced33b678 🔧 chore(base.py): add method to remove unwanted base classes from the list of base classes
🐛 fix(base.py): call the method to remove unwanted base classes before converting the frontend node to a dict
The `process_base_classes` method is added to the `FrontendNode` class to remove unwanted base classes from the list of base classes. This method iterates over the base classes and filters out any classes that are present in the `CLASSES_TO_REMOVE` list. The method is then called before converting the frontend node to a dictionary representation in the `to_dict` method to ensure that the unwanted base classes are not included in the final output.
2023-06-29 13:07:04 -03:00
Gabriel Luiz Freitas Almeida
549a8dedc5 🔧 chore(llms.py): add method to add extra base classes to improve extensibility
The `add_extra_base_classes` method is added to the `LLMFrontendNode` class. This method checks if the "BaseLLM" class is already present in the `base_classes` list and appends it if not. This change allows for easier extensibility by providing a way to add additional base classes to the `LLMFrontendNode` class.
2023-06-29 11:18:19 -03:00
Gabriel Luiz Freitas Almeida
8cc0497120 🔀 refactor(base.py): add from_method_nodes dictionary to RetrieverCreator class
The `from_method_nodes` dictionary is added to the `RetrieverCreator` class in order to map the "MultiQueryRetriever" node to the "from_llm" method. This refactor improves the readability and maintainability of the code by explicitly defining the mapping between nodes and methods.
2023-06-29 11:18:11 -03:00
Gabriel Luiz Freitas Almeida
72b6681f5a 🔧 chore(loading.py): add support for instantiating retrievers in the initialization process
🚀 feat(loading.py): implement the ability to instantiate retrievers based on node type and class object
The `instantiate_based_on_type` function now includes a new condition to handle the instantiation of retrievers. The `instantiate_retriever` function is introduced to handle the specific logic for creating retrievers. This change allows for the dynamic creation of retrievers based on the provided node type and class object.
2023-06-29 11:17:59 -03:00
Gabriel Luiz Freitas Almeida
6b893237d0 🐛 fix(utils.py): add import_retriever function to import retriever module
 feat(utils.py): add support for importing retriever module based on retriever name
The `import_retriever` function is added to the `utils.py` module to allow importing the retriever module based on the retriever name. This function uses the `import_module` function from the `importlib` module to dynamically import the retriever module from the `langchain.retrievers` package. This enhances the modularity and extensibility of the codebase by providing a convenient way to import retrievers based on their names.
2023-06-29 11:17:30 -03:00
Gabriel Luiz Freitas Almeida
6ef5e56c5c feat(graph): add RetrieverVertex to the list of available vertex types
The RetrieverVertex class is added to the list of available vertex types in the langflow.graph.vertex.types module. This allows for the creation of vertices that represent retrievers in the graph.
2023-06-29 11:16:05 -03:00
Gabriel Luiz Freitas Almeida
f1de9a554d 🔀 refactor(constants.py): import vertex types from langflow.graph.vertex.types as types for improved readability and maintainability
The import statements for vertex types in the constants.py file have been refactored to import from langflow.graph.vertex.types as types. This change improves the readability and maintainability of the code by making it clear where the vertex types are coming from.
2023-06-29 11:15:51 -03:00
Gabriel Luiz Freitas Almeida
f1e2bbb69c 🐛 fix(chat.py): change BuildStatus.IN_PROGRESS to BuildStatus.STARTED for better clarity
🐛 fix(chat.py): fix incorrect key used to retrieve graph_data from flow_data_store
The BuildStatus.IN_PROGRESS constant is changed to BuildStatus.STARTED to provide a more accurate representation of the flow status. Additionally, the incorrect key "data" is replaced with "graph_data" when retrieving the graph data from the flow_data_store dictionary.
2023-06-29 10:54:27 -03:00
Gabriel Luiz Freitas Almeida
3faf5f5b96 🐛 fix(chatMessage): sanitize HTML content to prevent potential XSS attacks
 feat(chatMessage): improve rendering of multi-line messages
The `convert` variable is now imported before being used to convert ANSI to HTML. Additionally, the `DOMPurify` library is imported and used to sanitize the HTML content before rendering it, preventing potential XSS attacks. The rendering of multi-line messages has been improved by splitting the message by newline characters and rendering each line separately with a line break.
2023-06-29 10:02:28 -03:00
Gabriel Luiz Freitas Almeida
e1bf25a4ff 📦 chore(frontend): add dompurify package as a dependency
The dompurify package is added as a dependency to the frontend package.json file. This package is needed for sanitizing HTML to prevent cross-site scripting (XSS) attacks.
2023-06-29 09:59:31 -03:00
Gabriel Luiz Freitas Almeida
19828da830 🐛 fix(utils.ts): rename Search icon to FileSearch for better clarity and accuracy
The Search icon has been renamed to FileSearch to provide a more accurate representation of its purpose. This change improves clarity and ensures that the icon name aligns with its actual functionality.
2023-06-29 09:57:09 -03:00
Gabriel Luiz Freitas Almeida
894fd16e8e feat(retrievers): add base retriever class and frontend node class
🐛 fix(util.py): handle non-string types in format_dict function
The base retriever class is added to provide a common interface for all retrievers in the language chain. The frontend node class for retrievers is also added to handle the formatting of fields specific to retrievers.

In the util.py file, a fix is made to handle non-string types in the format_dict function. Previously, if the type of a field was not a string, an error would occur. This fix ensures that the type is converted to a string before further processing.
2023-06-29 09:56:59 -03:00
Gabriel Luiz Freitas Almeida
302efa103a feat(retrievers): add __init__.py file to retrievers directory
The __init__.py file is added to the retrievers directory to make it a Python package. This allows the directory to be recognized as a module and enables importing of modules and submodules within the retrievers directory.
2023-06-29 09:56:26 -03:00
Gabriel Luiz Freitas Almeida
28e770992b 🚀 feat(listing.py): add support for retrievers in the type dictionary
The type dictionary in the listing.py file now includes a "retrievers" key, which contains a list of retriever creators. This allows for the inclusion of retrievers as a supported type in the application.
2023-06-29 09:56:17 -03:00
Gabriel Luiz Freitas Almeida
f427e17166 🔀 refactor(endpoints.py): rename import of build_langchain_types_dict to langchain_types_dict for consistency
🔀 refactor(types.py): add langchain_types_dict as a separate variable to improve code readability and maintainability

The import statement in `endpoints.py` has been updated to import `langchain_types_dict` instead of `build_langchain_types_dict` for consistency with the variable name. This change improves code readability and maintainability.

In `types.py`, a new variable `langchain_types_dict` has been added as a separate variable to store the result of `build_langchain_types_dict()`. This change improves code readability and makes it easier to understand the purpose of the variable.
2023-06-29 09:55:59 -03:00
Gabriel Luiz Freitas Almeida
8a28fdf497 📝 docs(config.yaml): add documentation link for MultiQueryRetriever
🔧 chore(settings.py): add retrievers attribute to Settings class
The config.yaml file now includes a documentation link for the MultiQueryRetriever in the retrievers section. This link provides additional information on how to use the MultiQueryRetriever. In the settings.py file, the Settings class now includes a retrievers attribute to store retriever-related settings. This allows for easier management and configuration of retrievers in the application.
2023-06-29 09:54:38 -03:00
Gabriel Luiz Freitas Almeida
c9f8a27983 🔀 chore(NodeModal): update import and variable name for nodeIconsLucide to improve code readability
💄 style(NodeModal): remove unused import and variable to clean up code
The import and variable name for `nodeIconsLucide` has been updated to improve code readability. The unused import and variable `nodeIcons` and `toNormalCase` have been removed to clean up the code.
2023-06-29 09:34:19 -03:00
Gabriel Luiz Freitas Almeida
197f1f9e71 🔥 refactor(utils.ts): remove unused imports and icons to improve code cleanliness and reduce bundle size
🎨 style(utils.ts): reorganize nodeColors and nodeNames objects to improve readability and maintainability
The changes in this commit remove unused imports and icons from the `utils.ts` file, which helps improve code cleanliness and reduces the bundle size. Additionally, the `nodeColors` and `nodeNames` objects have been reorganized to improve readability and maintainability.
2023-06-29 09:34:01 -03:00
Gabriel Luiz Freitas Almeida
8ed5287ac4 🔧 chore(base.py): refactor field formatting logic into a separate class
💡 refactor(base.py): The field formatting logic in the FrontendNode class has been refactored into a separate class called FieldFormatters. This improves code organization and separation of concerns, making it easier to maintain and extend the field formatting functionality in the future.
2023-06-29 09:01:28 -03:00
Gabriel Luiz Freitas Almeida
3845a60bcf 🚀 feat(memories.py): add default value for connection_string field in PostgresChatMessageHistoryFrontendNode
The trailing whitespace has been removed for consistency and readability. The unused import of `DEFAULT_CONNECTION_STRING` from `langchain.memory.chat_message_histories.postgres` has been removed. The `PostgresChatMessageHistoryFrontendNode` now has a default value for the `connection_string` field, which is set to `DEFAULT_CONNECTION_STRING`. This ensures that the field has a default value when creating instances of the class.
🔧 chore(memories.py): remove trailing whitespace and unused import
2023-06-29 08:52:45 -03:00
Gabriel Luiz Freitas Almeida
5924aa4442 📦 chore(field_formatters.py): add field formatters for template frontend_node
🔧 refactor(field_formatters.py): refactor field formatters for template frontend_node
The commit adds a new file `field_formatters.py` to the `frontend_node/formatter` directory in the `langflow/template` backend. This file contains multiple field formatters for the template frontend_node. The formatters handle various formatting tasks such as formatting field names, setting field options, handling special fields, and formatting field types. The commit aims to improve the code organization and maintainability by separating the field formatting logic into dedicated formatters.
2023-06-29 08:52:26 -03:00
Gabriel Luiz Freitas Almeida
75f0a80ded 🎉 feat(formatter): add base FieldFormatter class for formatting template fields
The base.py file is a new addition to the project. It introduces the FieldFormatter class, which is an abstract base class (ABC) for formatting template fields. This class provides a format() method that takes a TemplateField object as input and is meant to be implemented by subclasses. This addition allows for the creation of custom field formatters in the project.
2023-06-29 08:52:21 -03:00
Gabriel Luiz Freitas Almeida
d272a682be 🔧 chore(chains.py): update field properties for "RetrievalQA" memory field
The "RetrievalQA" memory field in the template frontend node is updated to have the "show" and "required" properties set to False. This change is made to hide the memory field and make it optional. Additionally, the "advanced" property is set to False for all fields, and the "password" property is set to False for fields containing the word "key" in their name.
2023-06-29 08:26:23 -03:00
Gabriel Luiz Freitas Almeida
df0b316040 🔀 chore(pyproject.toml): update dependencies versions
⬆️ feat(pyproject.toml): update beautifulsoup4 to version 4.12.2
⬆️ feat(pyproject.toml): update langchain to version 0.0.219
⬆️ feat(pyproject.toml): update pandas to version 2.0.0
⬆️ feat(pyproject.toml): update huggingface-hub to version 0.15.0
⬆️ feat(pyproject.toml): update unstructured to version 0.7.0
⬆️ feat(pyproject.toml): update pypdf to version 3.11.0
⬆️ feat(pyproject.toml): update langchain-serve to version >0.0.47
⬆️ feat(pyproject.toml): update qdrant-client to version 1.3.0
⬆️ feat(pyproject.toml): update ctransformers to version 0.2.10
⬆️ feat(pyproject.toml): update cohere to version 4.11.0
⬆️ feat(pyproject.toml): update anthropic to version 0.3.0
⬆️ feat(pyproject.toml): update types-pyyaml to version 6.0.12.8

The dependencies in the pyproject.toml file have been updated to their latest versions. These updates include various bug fixes, performance improvements, and new features. It is important to keep the dependencies up to date to ensure compatibility and take advantage of the latest enhancements and fixes provided by the library maintainers.
2023-06-29 06:49:24 -03:00
Gabriel Luiz Freitas Almeida
15bafe882d
feat: adding Postgres memory for message persistent (#559) 2023-06-29 06:42:44 -03:00
Gabriel Luiz Freitas Almeida
b61a0a624e
Merge branch 'release' into dev 2023-06-29 06:28:14 -03:00
zhenjianpeng
78831f1051 remove memory support and make it a proposal 2023-06-29 11:54:28 +08:00
zhenjianpeng
303c0ff5d2 something wrong about pyproject.toml 2023-06-29 11:31:50 +08:00
zhenjianpeng
ed2d4c549e commit poetry lock 2023-06-29 11:24:12 +08:00
zhenjianpeng
281e6062f4 remove psycopg-c 2023-06-29 11:15:09 +08:00
zhenjianpeng
177b50695d adding dependencies for langchain pg support 2023-06-29 10:44:08 +08:00
zhenjianpeng
83b7ee337f Merge branch 'dev' of https://github.com/PepperYan/langflow into dev 2023-06-29 10:38:50 +08:00
zhenjianpeng
d1fbbd5fff fix bug about extra fields 2023-06-29 10:38:45 +08:00
hibad
c58632ed21
Merge branch 'logspace-ai:dev' into dev 2023-06-29 10:27:18 +08:00
zhenjianpeng
df43dbc6bc add custom nodes for signature, fix some problem 2023-06-29 10:26:27 +08:00
Gabriel Luiz Freitas Almeida
b276cc9dd6
🚀 feat(llms.py): add method to format ctransformers field in LLMFrontendNode (#519) 2023-06-28 22:58:41 -03:00
Gabriel Luiz Freitas Almeida
ce34ac4825 🐛 fix(test_websocket.py): fix the endpoint URL in the test_init_build test
The endpoint URL in the test_init_build test has been fixed to "api/v1/build/init/test" to match the correct URL pattern. This ensures that the test is accurately testing the intended functionality.
2023-06-28 22:50:55 -03:00
Gabriel Luiz Freitas Almeida
85b7ff1d31 🔧 chore(chat.py): update init_build endpoint to include flow_id as a path parameter
The unnecessary imports have been removed from the chat.py file to improve code cleanliness and readability. The init_build endpoint in the chat.py file has been updated to include the flow_id as a path parameter instead of extracting it from the graph_data dictionary. This change allows for a more explicit and consistent API design.
🔧 chore(chat.py): remove unnecessary imports and reformat code for better readability
2023-06-28 22:45:37 -03:00
Gabriel Luiz Freitas Almeida
48d40bfdd3 feat(chat.py): add status field to flow_data_store to track build status of flows
The import statement for the BuildStatus enum in the schemas module has been updated to ensure the correct import. Additionally, a new "status" field has been added to the flow_data_store dictionary to track the build status of flows. The status is set to BuildStatus.IN_PROGRESS when a flow is being built, BuildStatus.SUCCESS when the build is successful, and BuildStatus.FAILURE when there is an error during the build process. This allows for better tracking and management of flow builds.
🐛 fix(chat.py): change import statement for BuildStatus in schemas module
2023-06-28 22:29:56 -03:00
Gabriel Luiz Freitas Almeida
5da374b713 feat(schemas.py): add BuildStatus enum to represent the status of a build
The BuildStatus enum is added to represent the different statuses that a build can have: SUCCESS, FAILURE, and IN_PROGRESS. This enum will be used to provide a more structured and consistent way of handling build statuses in the application.
2023-06-28 22:29:46 -03:00
Gabriel Luiz Freitas Almeida
1bad93c02c Merge branch 'release' into add_params_to_llms 2023-06-28 22:29:37 -03:00