Commit graph

405 commits

Author SHA1 Message Date
Gabriel Almeida
ad9c2a270c 🔥 chore(config.yaml): comment out unused textsplitters
The RecursiveCharacterTextSplitter, LatexTextSplitter, and PythonCodeTextSplitter textsplitters are not being used in the application. They have been commented out to improve code readability and reduce clutter.
2023-05-30 11:58:30 -03:00
Gabriel Almeida
ea59375ba5 🔥 chore(template): delete unused files and imports
This commit removes unused files and imports from the template directory. The deleted files are base.py, fields.py, and nodes.py. The deleted imports are from langflow.template.constants. This improves the codebase by removing unnecessary code and reducing clutter.

 feat(frontend_node): add constants module
This commit adds a new module called constants to the frontend_node directory. The module contains constants used in the frontend_node module. The constants are FORCE_SHOW_FIELDS, DEFAULT_PROMPT, SYSTEM_PROMPT, and HUMAN_PROMPT. This improves the codebase by centralizing the constants in one module.

🐛 fix(frontend_node): use ast.literal_eval instead of eval
This commit fixes a security vulnerability by replacing the use of eval with ast.literal_eval in the UtilitiesFrontendNode class. The method converts a string representation of a list to an actual list. The use of eval is dangerous as it can execute arbitrary code. This improves the codebase by making it more secure.
2023-05-30 10:41:48 -03:00
Gabriel Almeida
46959acaa9 🔨 refactor(prompts.py): swap suffix and format_instructions fields
🔨 refactor(util.py): add format_instructions to the list of fields to format in format_dict function
The suffix and format_instructions fields in the ZeroShotPromptNode class were swapped to improve the readability of the code. The format_instructions field is now above the suffix field, which makes more sense as it is a required field. In the util.py file, the format_instructions field was added to the list of fields to format in the format_dict function. This ensures that the format_instructions field is properly formatted when the function is called.
2023-05-29 18:52:47 -03:00
Gabriel Luiz Freitas Almeida
8db30348d8
Merge branch 'dev' into feat/slack-directory-loader 2023-05-29 18:36:32 -03:00
GMS
2a07f6368f Add Cohere LLM 2023-05-29 20:40:17 +01:00
Gabriel Almeida
3614296fd8 🚀 feat(langflow): add support for extra fields in VectorStoreFrontendNode
 feat(template): add method to add fields to a template
The VectorStoreFrontendNode now supports adding extra fields to its template. The add_extra_fields method is called after the node is loaded and adds the weaviate_url field to the template if the node is of type Weaviate. The Template class now has a method to add fields to a template. This method is used by the VectorStoreFrontendNode to add the weaviate_url field to its template.
2023-05-29 15:49:01 -03:00
Gustavo Schaedler
b9773668b4
Merge branch 'dev' into ctransformers 2023-05-29 17:16:24 +01:00
Gustavo Schaedler
b33a9d2b62
Revert "Add Cohere LLM" 2023-05-29 15:11:09 +01:00
Gustavo Schaedler
a859481513
Add Cohere LLM (#388) 2023-05-29 15:09:30 +01:00
Gabriel Almeida
9bac61b563 🚀 feat(config.yaml): add new text splitters and toolkits
Added new text splitters to the configuration file: RecursiveCharacterTextSplitter, LatexTextSplitter, and PythonCodeTextSplitter. These text splitters will be used to split text into smaller chunks for processing. Also, added new toolkits to the configuration file: OpenAPIToolkit and JsonToolkit. These toolkits will be used to process the text chunks generated by the text splitters.
2023-05-29 07:30:58 -03:00
Gabriel Luiz Freitas Almeida
bb8d0d90d4
feat: notion directory loader (#382) 2023-05-28 20:04:04 -03:00
Gabriel Almeida
edfc103999 🚀 feat(config.yaml): add CohereEmbeddings to the list of supported embeddings
The CohereEmbeddings is added to the list of supported embeddings in the config.yaml file. This allows the application to use the CohereEmbeddings for language processing tasks.
2023-05-28 17:53:49 -03:00
Gabriel Almeida
4409066e81 🔼 chore(pyproject.toml): update langchain dependency from 0.0.176 to 0.0.183
 feat(pyproject.toml): add cohere dependency to enable new features
🔧 chore(config.yaml): add Cohere to the list of supported LLMS
The langchain dependency was updated to version 0.0.183 to take advantage of the latest features and bug fixes. The cohere dependency was added to enable new features. Cohere is now added to the list of supported LLMS in the config.yaml file.
2023-05-28 17:28:42 -03:00
Gabriel Almeida
5f25bb0d58 🐛 fix(utils.py): fix try_setting_streaming_options function to correctly set streaming attribute
The try_setting_streaming_options function now correctly sets the streaming attribute of the llm object to True if it is an instance of BaseLanguageModel and has the streaming attribute. This fixes a bug where the streaming attribute was not being set correctly.
2023-05-28 17:25:27 -03:00
Gabriel Almeida
c2027898de 🐛 fix(config.yaml): add CTransformers to the list of supported llms
🐛 fix(utils.py): fix setting of streaming option for llm
🎨 style(llms.py): add model_file and model_type fields to the list of non-advanced fields
The first change adds CTransformers to the list of supported llms in the config.yaml file. The second change fixes a bug in the try_setting_streaming_options function in utils.py where the streaming option was not being set correctly. The third change is a style change that adds the model_file and model_type fields to the list of non-advanced fields in the LLMFrontendNode class in llms.py.
2023-05-28 17:14:49 -03:00
Gabriel Almeida
023df99ecc 🔨 refactor(embeddings.py): move openai fields formatting to a separate method
 test(embeddings_template.py): add tests for openai fields formatting
The openai fields formatting is now done in a separate method, which improves the readability and maintainability of the code. Tests were added to ensure that the formatting is done correctly.
2023-05-28 16:18:33 -03:00
Gabriel Ferreira Rosalino
b16b9d687b feat: SlackDirectoryLoader 2023-05-28 02:10:31 -03:00
Gabriel Ferreira Rosalino
209e31da26 feat: adds NotionDirectoryLoader 2023-05-28 02:05:32 -03:00
Gabriel Almeida
fa9a3a210b 🐛 fix(base.py): change condition to check if content is empty instead of None
The previous condition was checking if the content was None, but it should check if it is empty. This change fixes the error message to be more accurate.
2023-05-27 23:39:05 -03:00
Gabriel Almeida
a758f48b88 🐛 fix(chains.py): set prompt field as required when value is None
The prompt field was previously set as not required when no value was provided, but this is not the intended behavior. The prompt field should always be required, even if the default prompt is used. This commit fixes the issue by setting the required attribute to True when the value is None.
2023-05-27 18:16:36 -03:00
Gabriel Almeida
6f8b434f68 🔧 chore(llms.py): add format_openai_field method to format OpenAI field display names
The `format_openai_field` method formats the display name of fields that contain the string "openai" in their name. It capitalizes the first letter of "OpenAI", replaces underscores with spaces, and replaces "Api" with "API". This improves the readability and consistency of the display names of OpenAI fields.
2023-05-27 17:58:00 -03:00
Gabriel Almeida
3436a713c2 🚀 feat(pyproject.toml): add jina and sentence-transformers dependencies
🚀 feat(config.yaml): add HuggingFaceEmbeddings to embeddings
The Jina and sentence-transformers dependencies were added to the project to improve the functionality of the application. The HuggingFaceEmbeddings was added to the embeddings in the config.yaml file to improve the quality of the embeddings used in the application.

Issue #375, #372
2023-05-27 17:19:09 -03:00
Gabriel Almeida
41670bc43f 🐛 fix(chat_manager.py): change filter parameter name to filter_messages for clarity
The filter parameter name was ambiguous and could be interpreted in different ways. Renaming it to filter_messages makes it clear that it is used to filter chat messages.
2023-05-27 16:58:11 -03:00
Gabriel Almeida
e0364833a9 🔥 refactor(chat_manager.py): rename filter parameter to filter_messages for clarity
🔥 refactor(custom.py): remove unused import of SQL_FORMAT_INSTRUCTIONS
🔥 refactor(custom_lists.py): remove unused import of SQLDatabase and utility_type_to_cls_dict
🔥 refactor(utilities/base.py): remove unused import of utility_type_to_cls_dict
🔥 refactor(utils/util.py): remove unused function build_template_from_parameters
The changes made are mostly removing unused imports and renaming a parameter for clarity. The import of SQL_FORMAT_INSTRUCTIONS was removed as it was not being used. The function build_template_from_parameters was removed as it was not being used.
2023-05-27 16:53:57 -03:00
Gabriel Almeida
a5b966f42e Formatting 2023-05-27 16:33:49 -03:00
Gabriel Almeida
cc785af652 🐛 fix(base.py): import UtilitiesFrontendNode from the correct module
 feat(base.py): add support for SQLDatabase utility and filter utilities according to settings.utilities
🎨 style(frontend_node/base.py): add display_name to fields
🎨 style(frontend_node/utilities.py): format field values and types
The import statement for UtilitiesFrontendNode was incorrect, causing an import error. The import statement was corrected to import from the correct module.

Support for SQLDatabase utility was added to the type_to_loader_dict dictionary. The dictionary is now filtered according to the settings.utilities list.

The display_name attribute was added to fields in the FrontendNode class to improve the readability of the frontend.

The format_field method in the UtilitiesFrontendNode class was updated to format field values and types. The method now converts field.field_type to a list if it is a Literal type and formats field.value if it is a dictionary.
2023-05-27 16:32:56 -03:00
Gabriel Almeida
7da8c0ef92 chore: refactor of template, frontend_node and field
This will improve the readability of the code and maintainability.
2023-05-27 15:56:46 -03:00
Gabriel Almeida
35dce224d7 📝 docs(nodes.py): update SQLAgentNode description to reflect its new implementation
The description of the SQLAgentNode has been updated to reflect its new implementation, which now constructs a SQL agent from an LLM and tools instead of a Vector Store Router. This change was made to improve the accuracy of the description and to better reflect the functionality of the node.
2023-05-27 14:24:19 -03:00
Gabriel Ferreira Rosalino
aac6e3f2e9
Merge branch 'logspace-ai:dev' into gabfr-patch-1 2023-05-27 14:15:16 -03:00
Gabriel Ferreira Rosalino
f44e2f97f7
fix: SQLAgent
The queryCheckerTool now needs an extra arg with the LLM instance: https://github.com/hwchase17/langchain/blob/master/langchain/tools/sql_database/tool.py#L108

I added it so the SQLAgent can work normally now
2023-05-27 14:12:18 -03:00
Gabriel Luiz Freitas Almeida
09aa796af0
Changes to accomodate new vector stores (#366) 2023-05-27 14:10:54 -03:00
Gabriel Luiz Freitas Almeida
c224608601
🔨 refactor(base.py): refactor FrontendNode.format_field() method to improve readability and maintainability (#363) 2023-05-27 14:10:38 -03:00
Gabriel Almeida
de0a581031 🔥 refactor(nodes.py): remove unused import of deepcopy
🔥 refactor(custom_lists.py): remove unused import of vectorstores
The import of deepcopy in nodes.py and vectorstores in custom_lists.py are not used in the codebase and can be safely removed to improve code readability and maintainability.
2023-05-27 12:14:50 -03:00
Gabriel Almeida
9cb52994ad 🔧 chore(langflow): add Weaviate to vectorstores and add TODO comment to fix Weaviate integration
Weaviate has been added to the list of vectorstores in the config.yaml file. A TODO comment has been added to the nodes.py file to fix the integration with Weaviate. Weaviate requires the weaviate_url to be passed as it is not part of the class or from_texts method. The add_extra_fields method needs to be fixed to include the weaviate_url parameter.
2023-05-27 11:03:06 -03:00
Gabriel Almeida
297c518c3b Merge remote-tracking branch 'origin/dev' into new_vec_stores 2023-05-27 09:43:13 -03:00
Gabriel Almeida
b42b4e5868 Merge remote-tracking branch 'origin/main' into dev 2023-05-27 09:38:52 -03:00
Gabriel Almeida
56da636915 🔨 refactor(nodes.py): extract common field attributes to variables and set them accordingly
This commit extracts common field attributes to variables and sets them accordingly. The basic_fields and advanced_fields variables are used to set the show and advanced attributes of the fields. The API Key field is now displayed as "API Key" and its value is hidden. The location field now has a default value of ":memory:" and its placeholder is also set to ":memory:". The password attribute of the key fields is set to False.

Issue Implement Qdrant #361
2023-05-26 23:09:56 -03:00
Gabriel Luiz Freitas Almeida
12c23408e0
Merge branch 'dev' into 335-implement-docarray-vectorstore 2023-05-26 22:50:16 -03:00
Gabriel Almeida
e10a21f824 🐛 fix(langflow): add type ignore to node variable in LangChainTypeCreator
🐛 fix(langflow): remove unused imports in base.py files
The variable node in LangChainTypeCreator was causing a type error, so a type ignore was added to fix the issue. Additionally, unused imports were removed from both base.py files.
2023-05-26 22:34:53 -03:00
Gabriel Almeida
bd9d90786a 🔥 chore(base.py): remove unused process_field method from TemplateFieldCreator
The process_field method in the TemplateFieldCreator class is not used anywhere in the codebase and is therefore removed to improve code readability and maintainability.
2023-05-26 22:29:52 -03:00
Gabriel Almeida
342c2eaec7 🔨 refactor(base.py): refactor FrontendNode.format_field() method to improve readability and maintainability
This commit refactors the FrontendNode.format_field() method to improve its readability and maintainability. The method now uses helper methods to handle specific field types and values, and to determine whether a field should be shown, be a password field, or be multiline. The method also uses a dictionary to handle special fields and their respective handlers.
2023-05-26 22:20:08 -03:00
Gabriel Almeida
04579a25a2 🚀 chore(config.yaml): update config.yaml file with new documentloaders, memories, prompts, textsplitters, toolkits, utilities, and vectorstores
 feat(config.yaml): add Qdrant vectorstore and RequestsWrapper to the config.yaml file
The config.yaml file has been updated with new documentloaders, memories, prompts, textsplitters, toolkits, utilities, and vectorstores. The Qdrant vectorstore has been added to the vectorstores section. The RequestsWrapper has been added to the wrappers section.
2023-05-26 18:23:15 -03:00
Gabriel Almeida
3029fe029f 🐛 fix(chat_manager.py): fix is_first_message logic to correctly identify first message
🐛 fix(nodes.py): remove deepcopying of certain objects to improve performance
🐛 fix(loading.py): add error handling for empty documents in instantiate_textsplitter
The is_first_message logic in chat_manager.py was not correctly identifying the first message. The fix in this commit changes the comparison to <= 1 instead of == 0. In nodes.py, deepcopying of certain objects was removed to improve performance. This was done because deepcopying was not necessary for these objects. In loading.py, error handling was added to handle empty documents in instantiate_textsplitter. This was done to prevent errors when the source provided did not load correctly or was empty.
2023-05-25 10:10:56 -03:00
Gabriel Almeida
d89e4bc985 🐛 fix(__main__.py): pass dev flag to update_settings function
 feat(__main__.py): add serve_on_jcloud function to deploy Langflow server on Jina AI Cloud
🐛 fix(config.yaml): remove duplicate entries and fix indentation
The update_settings function now accepts a dev flag to enable running the app in development mode. The serve_on_jcloud function has been added to deploy the Langflow server on Jina AI Cloud. The config.yaml file has been cleaned up by removing duplicate entries and fixing indentation.
2023-05-25 09:03:28 -03:00
Gabriel Almeida
a66adff004 🔥 refactor(custom_lists.py): remove unused vectorstores_type_to_cls_dict variable
🔨 refactor(vector_store/base.py): refactor VectorstoreCreator to use import_class from langflow.interface.importing.utils
The `vectorstores_type_to_cls_dict` variable was not being used, so it was removed. The `VectorstoreCreator` class was refactored to use the `import_class` function from `langflow.interface.importing.utils` instead of importing it directly. This improves the code's readability and maintainability.
2023-05-24 09:27:00 -03:00
Gabriel Almeida
e597a6e20a 🔀 chore(config): add DocArrayHnswSearch and DocArrayInMemorySearch to vectorstores
🐛 fix(base.py): correctly handle nested lists in Node.build() method
 feat(vector_store): add VectorStoreFrontendNode to handle vector store templates
🐛 fix(util.py): add build_template_from_method to correctly build templates from class methods
The configuration file now includes two new vector stores, DocArrayHnswSearch and DocArrayInMemorySearch. The Node.build() method now correctly handles nested lists. A new VectorStoreFrontendNode has been added to handle vector store templates. The build_template_from_method function has been added to correctly build templates from class methods.

Issue #335
2023-05-23 16:51:29 -03:00
Gabriel Almeida
ddf75d7eb9 🔥 refactor(run.py): remove NotEnoughElementsException import and exception handling
Chroma implemented a fix for this so this exception won't be thrown anymore.
2023-05-23 12:02:55 -03:00
anovazzi1
e3656f7998 update display_name of llm to LLM 2023-05-22 23:41:07 -03:00
Gabriel Almeida
aeba16fa8a 🔥 chore(lcserve.py): remove unused import statements
The import statements for pathlib.Path and fastapi.staticfiles.StaticFiles were not used in the code and were therefore removed to improve code readability and maintainability.
2023-05-22 07:46:40 -03:00
Deepankar Mahapatro
18aaede030 chore: lint fix 2023-05-18 16:55:40 +05:30