Commit graph

3,997 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
2fcbfa25a5 🎉 feat(utils.py): add new utility function get_settings_manager() to retrieve the settings manager from the service manager
🎉 feat(utils.py): add new utility function `get_session()` to retrieve a session from the database manager
2023-08-05 23:18:31 -03:00
Gabriel Luiz Freitas Almeida
d43236fb98 🔧 chore(__main__.py): import get_settings_manager function from langflow.services.utils module to improve code organization and readability
🔧 chore(__main__.py): remove unused import of settings module from langflow.settings package to clean up code
🔧 chore(__main__.py): update references to settings object to use settings_manager.settings for better encapsulation and modularity
2023-08-05 23:18:00 -03:00
Gabriel Luiz Freitas Almeida
f178e29ef4 🔧 fix(test_llms_template.py): update import statement to use get_settings_manager function from langflow.services.utils module
🔧 fix(test_prompts_template.py): update import statement to use get_settings_manager function from langflow.services.utils module
🔧 fix(test_vectorstore_template.py): update import statement to use get_settings_manager function from langflow.services.utils module
🔧 fix(test_llms_template.py): update assertion to use settings from settings_manager instead of settings module
🔧 fix(test_prompts_template.py): update assertion to use settings from settings_manager instead of settings module
🔧 fix(test_vectorstore_template.py): update assertion to use settings from settings_manager instead of settings module
2023-08-05 23:17:27 -03:00
Gabriel Luiz Freitas Almeida
3442521f64 🎉 feat(lazy_load.py): add LazyLoadDictBase class to provide lazy loading of a dictionary of all types
🐛 fix(lazy_load.py): implement _build_dict() and get_type_dict() methods to avoid NotImplementedError
2023-08-05 23:13:51 -03:00
Gabriel Luiz Freitas Almeida
7b2827f198 🐛 fix(conftest.py): fix client_fixture to properly yield the TestClient instance and clear dependency overrides after usage 2023-08-05 22:18:45 -03:00
Gabriel Luiz Freitas Almeida
8a2358dae0 🔧 fix(custom_component.py): fix import paths for session_getter and Flow models in custom_component.py file
🔧 fix(test_cache_manager.py): fix import path for CacheManager in test_cache_manager.py file
🔧 fix(test_custom_component.py): fix import path for Flow and FlowCreate models in test_custom_component.py file
🔧 fix(test_database.py): fix import path for Flow, FlowCreate, and FlowUpdate models in test_database.py file
🔧 fix(test_websocket.py): fix import path for WebSocketDisconnect in test_websocket.py file
2023-08-05 22:18:20 -03:00
Gabriel Luiz Freitas Almeida
0a8ca3b908 🔧 fix(chat.py): update import statements to reflect changes in module structure
🔧 fix(components.py): update import statements to reflect changes in module structure
🔧 fix(endpoints.py): update import statements to reflect changes in module structure
🔧 fix(flow_styles.py): update import statements to reflect changes in module structure
🔧 fix(flows.py): update import statements to reflect changes in module structure
🔧 fix(schemas.py): update import statements to reflect changes in module structure
🔧 fix(run.py): update import statements to reflect changes in module structure
🔧 fix(utils.py): update import statements to reflect changes in module structure
2023-08-05 22:17:41 -03:00
Gabriel Luiz Freitas Almeida
029e06c033 🔀 chore(alembic/env.py): update import statement for SQLModel to reflect new file location 2023-08-05 22:17:10 -03:00
Gabriel Luiz Freitas Almeida
c9ae251f85 🔧 chore(main.py): refactor imports and remove unused code for better organization and readability
 feat(main.py): add initialization functions for services and database on app startup to ensure proper setup and configuration
2023-08-05 22:16:41 -03:00
Gabriel Luiz Freitas Almeida
be8be07a62 🔥 refactor(__init__.py): deactivate cache manager for now to improve performance and simplify code 2023-08-05 22:16:14 -03:00
Gabriel Luiz Freitas Almeida
d51aa7ecb2 📦 chore(database): add database related files and models
📦 chore(database): add database manager and factory

📦 chore(database): add flow and flow style models
2023-08-05 22:14:22 -03:00
Gabriel Luiz Freitas Almeida
b451ad9bdd 📦 chore(settings): add new files for managing settings in the backend
📄 feat(settings/__init__.py): add __init__.py file to expose factory and manager modules

📄 feat(settings/base.py): add base settings class with default values and validators

📄 feat(settings/factory.py): add factory class for creating and configuring a SettingsManager

📄 feat(settings/manager.py): add manager class for loading settings from YAML file and initializing SettingsManager

📦 chore(settings.py): add settings.py file to the backend/langflow/services/settings directory
 feat(settings.py): add support for loading settings from a YAML file and updating settings from keyword arguments
🔒 chore(settings.py): add validation and logging to the settings module for improved reliability and debugging
🔧 chore(settings.py): add utility functions for saving and loading settings from a YAML file
2023-08-05 22:13:48 -03:00
Gabriel Luiz Freitas Almeida
7b1f99b1e0 📝 chore(chat): add chat module files
📝 chore(chat): add ChatConfig class to handle chat configuration

📝 chore(chat): add ChatManagerFactory class to create and configure ChatManager

📝 chore(chat): add ChatManager class to handle chat functionality

📝 chore(chat): add ChatHistory class to manage chat history

📝 chore(chat): add process_graph function to process chat inputs and generate result and thought
2023-08-05 22:13:10 -03:00
Gabriel Luiz Freitas Almeida
d5ad152250 📦 chore(cache): add cache module with cache manager, factory, base cache, and in-memory cache implementations
 feat(utils.py): add cache utility functions for memoization and file saving
🐛 fix(utils.py): fix cache folder creation to use the correct cache directory
🔧 chore(utils.py): refactor code to improve readability and remove unused imports
2023-08-05 22:12:27 -03:00
Gabriel Luiz Freitas Almeida
63a9b01bbc feat(services): add support for service manager and service schema
- Added `__init__.py` file to the `services` directory to make it a package.
- Created `Service` class in `base.py` to serve as a base class for different services.
- Implemented `ServiceFactory` class in `factory.py` to create instances of services.
- Implemented `ServiceManager` class in `manager.py` to manage the creation and retrieval of services.
- Created `ServiceType` enum in `schema.py` to define the different types of services that can be registered with the service manager.
- Added `initialize_services` function in `manager.py` to initialize all the services needed.

The purpose of these changes is to provide a modular and extensible architecture for managing different services in the application. The `ServiceManager` allows for easy creation and retrieval of services, while the `ServiceType` enum provides a standardized way to refer to different types of services. The `Service` base class and `ServiceFactory` class provide a foundation for creating and managing specific services.
2023-08-05 22:10:24 -03:00
Gabriel Luiz Freitas Almeida
d566a86ed0 🔥 refactor(cache): remove unused cache files and classes
The following files and classes were removed:

- `src/backend/langflow/cache/__init__.py`: Removed unused import statements and `__all__` variable.
- `src/backend/langflow/cache/base.py`: Removed unused `BaseCache` class.
- `src/backend/langflow/cache/flow.py`: Removed unused `InMemoryCache` class.
- `src/backend/langflow/cache/manager.py`: Removed unused `Subject`, `AsyncSubject`, and `CacheManager` classes.

These files and classes were removed to clean up the codebase and remove unused functionality.

🔥 refactor(utils.py): remove unused code and dependencies in utils.py module
🔥 refactor(chat): remove unused chat module and its configuration class

🔥 refactor(chat/manager.py): remove unused imports and classes from chat manager module
🔥 refactor(chat/utils.py): remove unused imports and function from chat utils module
🔥 refactor(database/__init__.py): remove empty file

🔥 refactor(database): remove unused database files and models

🔥 refactor(database): remove unused database files and models to improve code organization and reduce clutter
2023-08-05 22:03:56 -03:00
Gabriel Luiz Freitas Almeida
cd67aa212c 📦 chore(alembic): add migration script to create Flow table and FlowStyle table
🔧 refactor(base.py): refactor DatabaseManager class to handle database operations and migrations
🔧 refactor(base.py): refactor session_getter function to use DatabaseManager instance
🔧 refactor(base.py): refactor get_session function to use DatabaseManager instance
🔧 refactor(models/__init__.py): add Flow model to __all__ list
2023-08-05 18:33:17 -03:00
Gabriel Luiz Freitas Almeida
46f289b5d0 📝 chore(alembic.ini): add Alembic configuration file for database migrations
📝 chore(alembic/README): add README file for Alembic migrations
📝 chore(alembic/env.py): add Alembic environment configuration file
📝 chore(alembic/script.py.mako): add Alembic migration script template
📝 chore(main.py): refactor database initialization and migration logic to use DatabaseManager class
2023-08-05 18:20:37 -03:00
Gabriel Luiz Freitas Almeida
8d662ad9b4 🔧 chore(pyproject.toml): add alembic as a development dependency to manage database migrations
⬆️ feat(pyproject.toml): upgrade alembic to version 1.11.2 to ensure compatibility with other dependencies
2023-08-05 18:18:26 -03:00
Gabriel Luiz Freitas Almeida
9106b6d482 📦 chore(frontend): add .dockerignore file to exclude node_modules directory from Docker build context 2023-08-05 16:49:39 -03:00
Gabriel Luiz Freitas Almeida
4409e85ba5 Merge remote-tracking branch 'origin/main' into dev 2023-08-05 16:39:20 -03:00
Gabriel Luiz Freitas Almeida
e300a05d26 🐛 fix(dev.Dockerfile): update uvicorn command to use --factory flag and create_app function to improve modularity and maintainability
🐛 fix(docker-compose.debug.yml): update uvicorn command to use --factory flag and create_app function to match changes in dev.Dockerfile

🐛 fix(docker-compose.yml): update uvicorn command to use --factory flag and create_app function to match changes in dev.Dockerfile
2023-08-05 16:26:32 -03:00
Gabriel Luiz Freitas Almeida
ae6ee05f25 🔥 refactor(chat.py): remove unused code line that accessed vertex_type attribute of a vertex object 2023-08-04 17:11:56 -03:00
Gabriel Luiz Freitas Almeida
3583161064 🐛 fix(base.py): fix typo in "successfully" in the built object representation message
🐛 fix(custom_component.py): add support for custom representation of repr_value if it is a dictionary by using yaml.dump() function
2023-08-04 17:11:55 -03:00
Gabriel Luiz Freitas Almeida
16be5f573a 📝 docs(custom-component.mdx): update guidelines for loading custom components
🔧 fix(custom-component.mdx): correct the recommended way to load custom components by setting LANGFLOW_COMPONENTS_PATH environment variable instead of using --components-path argument

💡 docs(custom-component.mdx): provide an alternative method to specify the path to custom components using --components-path argument
2023-08-04 17:11:54 -03:00
Lucas Oliveira
a35445ec28 Fixed chat message size 2023-08-04 17:11:53 -03:00
Lucas Oliveira
6b844fca68 Fixed break words on all code 2023-08-04 17:11:52 -03:00
Gabriel Luiz Freitas Almeida
79d9d42e33 🐛 fix(types.py): fix syntax error in adding component to valid menu dictionary 2023-08-04 17:11:51 -03:00
Gabriel Luiz Freitas Almeida
3e8595cfc2 🔒 chore(poetry.lock): update cohere package version from 4.17.0 to 4.19.2
🔒 chore(poetry.lock): update debugpy package version from 1.6.8 to 1.6.7

🔀 chore: update dependencies

🔄 refactor: update debugpy package to version 1.6.7

🔒 chore(poetry.lock): update google-cloud-resource-manager to version 1.10.3
🔒 chore(poetry.lock): update jcloud to version 0.2.16
🔒 chore(poetry.lock): update more-itertools to version 10.1.0
2023-08-04 17:11:50 -03:00
Gabriel Luiz Freitas Almeida
a6dbc693cc 🐛 fix(chat.py): fix debug log message to include vertex type and output 2023-08-04 17:11:49 -03:00
Gabriel Luiz Freitas Almeida
a0585786d5 🐛 fix(custom_component.py): handle case when repr_value is a string in custom_repr method 2023-08-04 17:11:48 -03:00
Gabriel Luiz Freitas Almeida
7151d0f358 🐛 fix(types.py): fix syntax error in adding component_template to valid_menu
 feat(types.py): improve component name generation logic based on component_output_types and file name
2023-08-04 17:11:47 -03:00
Gabriel Luiz Freitas Almeida
092035f880 🔧 chore(loading.py): add debug log to show instantiation of node_type and base_type 2023-08-04 17:11:46 -03:00
Gabriel Luiz Freitas Almeida
e4e01b8853 🐛 fix(utils.py): simplify import_custom_component function by directly importing the CustomComponent class 2023-08-04 17:11:45 -03:00
Gabriel Luiz Freitas Almeida
967c91d19c 🔧 fix(directory_reader.py): fix typo in variable name 'filtered' to improve code readability 2023-08-04 17:11:44 -03:00
Gabriel Luiz Freitas Almeida
5608b197f2 🔧 chore(component.py): add missing import for 'Any' type in typing module to fix type hinting
🚀 feat(component.py): add 'build' method to Component class to enforce implementation in subclasses
2023-08-04 17:11:43 -03:00
Gabriel Luiz Freitas Almeida
e36b72ecb2 🔨 refactor(types.py): add logging statements for debugging purposes in build_langchain_template_custom_component function
🔨 refactor(types.py): add logging statements for debugging purposes in build_and_validate_all_files function
🔨 refactor(types.py): add logging statements for debugging purposes in build_valid_menu function
🔨 refactor(types.py): add logging statements for debugging purposes in build_invalid_menu function
2023-08-04 17:11:42 -03:00
Gabriel Luiz Freitas Almeida
afe4816df6 🔧 fix(endpoints.py): add logging statements to improve debugging and monitoring
🔧 fix(endpoints.py): add logging statements to improve debugging and monitoring in the get_all() function
2023-08-04 17:11:41 -03:00
Gabriel Luiz Freitas Almeida
a6c7e951ba 🐛 fix(settings.py): fix issue with extending components_path list with duplicate paths
 feat(settings.py): add logging of components_path and updated settings values for debugging purposes
2023-08-04 17:11:40 -03:00
Gabriel Luiz Freitas Almeida
65850b9920 🐛 fix(types.py): update error message to include the output types of the component that failed to load for better debugging 2023-08-04 17:11:39 -03:00
Gabriel Luiz Freitas Almeida
31dba43e73 🔧 fix(settings.py): convert BASE_COMPONENTS_PATH to string to ensure compatibility with other parts of the codebase
🔧 fix(settings.py): update COMPONENTS_PATH to accept a list of strings instead of a list of Paths to improve flexibility and compatibility
🔧 fix(settings.py): update set_components_path method to handle LANGFLOW_COMPONENTS_PATH as a list of paths or a single path string
2023-08-04 17:11:38 -03:00
Gabriel Luiz Freitas Almeida
bfe86b45fc feat(components): add new custom component and chains package
- Added a new file `__init__.py` in the `components` directory to import the `CustomComponent` class from `langflow.interface.custom.custom_component`.
- Created a new package `chains` in the `components` directory.
2023-08-04 17:11:37 -03:00
Gabriel Luiz Freitas Almeida
2c6b88f4f9 🔨 refactor(custom_component.py): read build method 2023-08-04 17:11:36 -03:00
Gabriel Luiz Freitas Almeida
15d0327f62 🔧 chore(constants.py): import BaseOutputParser from langchain.schema to use it in LANGCHAIN_BASE_TYPES 2023-08-04 17:11:35 -03:00
Gabriel Luiz Freitas Almeida
956ba45e9b 🔀 chore(utils.py): rename cache variable to CACHE for consistency with other settings
🔀 chore(utils.py): rename `LANGFLOW_LANGCHAIN_CACHE` environment variable to `CACHE` for clarity and consistency
2023-08-04 17:11:34 -03:00
Gabriel Luiz Freitas Almeida
3495375f50 🔧 chore(settings.py): update debug log messages for setting default components path 2023-08-04 17:11:33 -03:00
Gabriel Luiz Freitas Almeida
929d51ea61 🐛 fix(prompt_runner.py): fix issue with accessing result content when invoking chain with an empty dict input 2023-08-04 17:11:32 -03:00
Gabriel Luiz Freitas Almeida
c5b0f6a7f1 🔥 refactor(component.py): remove unused build method from Component class
🔥 refactor(custom_component.py): remove unused build method from CustomComponent class
2023-08-04 17:11:31 -03:00
Gabriel Luiz Freitas Almeida
997c8aba0a 📝 docs(README.md): update CLI options section to remove --database-url option
The `--database-url` option has been removed from the CLI options. Instead, a local SQLite database will be used if no database URL is provided. This change simplifies the configuration process and aligns with the default behavior.
2023-08-04 17:11:31 -03:00
Gabriel Luiz Freitas Almeida
75ee8f0e2d feat(prompt_runner.py): add PromptRunner component to run a Chain with a given PromptTemplate 2023-08-04 17:11:30 -03:00