Langflow is a powerful tool for building and deploying AI-powered agents and workflows. http://www.langflow.org
Find a file
anovazzi1 007c38afed
feat: add new node Input type for data in table format (#2635)
* feat: add Table component and related functionality

This commit adds the Table component and related functionality to the codebase. The Table component is used to display tabular data and includes features such as pagination, row deletion, row duplication, and adding new rows. The TableOptions component is also added to provide options for resetting the grid and adding new rows. Additionally, the necessary types and interfaces are updated to support the Table component. This feature enhances the user experience by allowing them to interact with tabular data in a more intuitive way.

* feat: add Edit Data trigger to TableNodeComponent

* [autofix.ci] apply automated fixes

* feat: add TableSchema class for defining table structure

* feat: add TableMixin class for table-related functionality

* feat: add TableInput class for table-related functionality

* feat: add TableInput to io module

* feat: update Column model in table schema

This commit updates the `Column` model in the table schema to include the `display_name` and `name` fields instead of `header` and `field`. It also adds validation for the `formatter` field to accept either a `FormatterType` enum value or a string. This change improves the clarity and flexibility of the table schema.

* feat: add displayEmptyAlert prop to TableComponent

This commit adds the `displayEmptyAlert` prop to the `TableComponent` in order to control whether an alert is displayed when the table has no data. By default, the alert will be shown, but it can be disabled by setting `displayEmptyAlert` to `false`. This feature enhances the flexibility of the table component by allowing users to customize the behavior when there are no rows in the table.

* This commit improves the TableAutoCellRender component by adding support for a custom formatter. The formatter can be specified as a prop and allows for rendering the cell value in different formats, such as JSON. This enhancement enhances the flexibility and customization options of the TableAutoCellRender component.

* feat: add FormatColumns function to utils.ts

This commit adds the `FormatColumns` function to `utils.ts` file. The function takes an array of `ColumnField` objects and returns an array of `ColDef` objects. It maps each `ColumnField` to a `ColDef` with properties like `headerName`, `field`, `sortable`, and `filter`. If a `ColumnField` has a `formatter` property, it sets the `cellDataType` or `cellRendererParams` accordingly. This function enhances the flexibility and customization options for formatting columns in the table.

* feat: enhance TableNodeComponent with FormatColumns function

This commit enhances the TableNodeComponent by utilizing the FormatColumns function from utils.ts. The FormatColumns function takes an array of ColumnField objects and returns an array of ColDef objects, allowing for flexible and customizable column formatting in the table. By integrating this function, the TableNodeComponent now has improved column handling capabilities.

* chore: Update TableNodeComponent and TableComponent

This commit updates the TableNodeComponent and TableComponent to improve column handling and customization options. The TableNodeComponent now utilizes the FormatColumns function from utils.ts, allowing for flexible and customizable column formatting in the table. The TableComponent now has a new prop, displayEmptyAlert, which controls whether an alert is displayed when the table has no data. These enhancements enhance the flexibility and customization options of the table components.

* [autofix.ci] apply automated fixes

* feat: Update TableNodeComponent and TableComponent

This commit updates the TableNodeComponent and TableComponent to improve column handling and customization options. It utilizes the FormatColumns function from utils.ts for flexible and customizable column formatting in the table. The TableComponent now has a new prop, displayEmptyAlert, to control the display of an alert when the table has no data. These enhancements enhance the flexibility and customization options of the table components.

* feat: initialize table field values as DataFrame

* feat: Enhance TableNodeComponent with duplicateRow function

This commit enhances the TableNodeComponent by adding the duplicateRow function. This function allows users to duplicate selected rows in the table. When called, it clones the selected nodes and adds the duplicated rows to the table. This feature enhances the flexibility and customization options of the TableNodeComponent.

* [autofix.ci] apply automated fixes

* feat: Remove "text" from basic_types in FormatColumns function

This commit removes the "text" value from the basic_types set in the FormatColumns function in utils.ts. The basic_types set is used to determine the column type for formatting in the table. By removing "text", we ensure that only "date" and "number" types are considered as basic types. This change improves the accuracy and consistency of column formatting in the table.

* fix: alingment bug on AgGrid cell

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes

* Styled the Open Table button on TableNodeComponent

* Fixed type of ref on tableComponent

* Creaed a TableModal component, that receives the props that are passed to the Table, as well as a title, and creates a modal

* Used the TableModal on the TableNodeComponent

* Fixed looks of TableModal

* Added description set on tableModal

* Add description field to TableNodeComponent

* Fixed text of description if info is not provided

* Added TableComponent in tableNodeCellRenderer

* Added styling based on editNode

* Added Auto Size to table modal

* refactor: update TableOptions component styling and behavior

- Update TableOptions component to dynamically apply text color based on selection
- Remove unnecessary console.log statement
- Improve hover behavior for the Trash2 icon

* chore: Remove unnecessary imports and initialize empty columns array in TableNodeComponent

* feat: Add default values for sortable and filterable in Column model

The code changes in `table.py` modify the `Column` model in the `langflow.schema` module. The `sortable` and `filterable` attributes of the `Column` model now have default values of `True`. This change ensures that new instances of the `Column` model will have these attributes set to `True` by default.

Based on the recent user commits and repository commits, the commit message follows the established convention of using a prefix to indicate the type of change (`feat` for a new feature) and provides a clear and concise description of the changes made.

* feat(utils.ts): add check for empty columns array in FormatColumns function to prevent errors

* feat: Add validation for TableInput value in inputs.py

The code changes in `inputs.py` add a validation function for the `value` attribute of the `TableInput` class. The function checks if the value is a list of dictionaries and raises a `ValueError` if it is not. This ensures that the `TableInput` instances have a valid value that is a list of dictionaries.

Based on the recent user commits and repository commits, the commit message follows the established convention of using a prefix to indicate the type of change (`feat` for a new feature) and provides a clear and concise description of the changes made.

* [autofix.ci] apply automated fixes

* feat: extend editable field to json field

* [autofix.ci] apply automated fixes

* feat: Add validation for TableInput value in inputs.py

* feat(validate.py): add exception handling to catch and re-raise ValidationError with a more informative error message

* chore: Refactor error message in build_custom_component_template function

* fix(validate.py): improve error message formatting in create_class function

Refactor the error message formatting in the `create_class` function in `validate.py` to improve readability and clarity. Instead of using a list comprehension to extract the error messages, the code now uses a nested list comprehension to split the error messages and extract the relevant information. This change ensures that the error message is properly formatted and provides more informative details about the validation errors.

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Lucas Oliveira <lucas.edu.oli@hotmail.com>

* feat: Update TableMixin to support TableSchema or list of Columns

The TableMixin class in input_mixin.py has been updated to support either a TableSchema object or a list of Columns for the table_schema attribute. This change allows for more flexibility in defining the table schema for input validation.

* feat: Update TableNodeComponent to generate backend columns from value

Refactor the TableNodeComponent to generate backend columns from the value when the columns prop is not provided. This change ensures that the component can handle dynamic column generation based on the value, improving flexibility and usability.

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Lucas Oliveira <lucas.edu.oli@hotmail.com>

* Refactor extractColumnsFromRows function to return only ColDef objects

The extractColumnsFromRows function in utils.ts has been refactored to return only ColDef objects instead of a combination of ColDef and ColGroupDef objects. This change simplifies the function's return type and improves consistency in the codebase.

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Lucas Oliveira <lucas.edu.oli@hotmail.com>

* [autofix.ci] apply automated fixes

* refactor: Generate backend columns from value in TableNodeComponent

Refactor the TableNodeComponent to generate backend columns from the value when the columns prop is not provided. This change ensures that the component can handle dynamic column generation based on the value, improving flexibility and usability.

* feat: Update TableNodeComponent to handle number and date properly

* fix bug that delete all rows on modal close

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Lucas Oliveira <lucas.edu.oli@hotmail.com>
2024-07-24 06:20:58 -07:00
.devcontainer Update Python base image to version 3.10 in devcontainer.json 2024-04-17 11:21:05 -03:00
.github test: add new tests based on new basic examples + vector store tests (#2879) 2024-07-22 21:30:30 +00:00
.vscode feat: add opentelemetry utility functions and unit tests (#2570) 2024-07-10 15:01:38 -04:00
deploy fix: fix docker compose and add instructions (#2654) 2024-07-12 09:27:13 -07:00
docker fix: frontend image should forward /health_check to backend (#2887) 2024-07-23 15:08:43 +02:00
docker_example chore: simplify docker (#2526) 2024-07-04 11:14:52 -03:00
docs docs: Fixing integrations-langwatch.md (#2783) 2024-07-18 19:28:30 +00:00
scripts Bump braces from 3.0.2 to 3.0.3 in /scripts/aws 2024-07-01 13:53:39 -03:00
src feat: add new node Input type for data in table format (#2635) 2024-07-24 06:20:58 -07:00
.env.example fixing ThreadingInMemoryCache usage (#2604) 2024-07-10 04:52:37 -07:00
.eslintrc.json 🔧 (.pre-commit-config.yaml): Add eslint@9.1.1 as a dependency and enable autofix for pretty-format-json hook 2024-05-02 19:27:40 -03:00
.gitattributes refactor: Update .gitattributes to remove working-tree-encoding for .mdx and .json files 2024-06-10 14:30:27 -03:00
.gitignore fixing ThreadingInMemoryCache usage (#2604) 2024-07-10 04:52:37 -07:00
.pre-commit-config.yaml Update linting workflows for frontend and Python code (#2171) 2024-06-14 06:27:48 -07:00
CODE_OF_CONDUCT.md run codespell 2024-06-04 09:26:13 -03:00
CONTRIBUTING.md chore: improve contributors guidelines (#2784) 2024-07-18 12:31:58 -07:00
eslint.config.js 🔧 (.pre-commit-config.yaml): Add eslint@9.1.1 as a dependency and enable autofix for pretty-format-json hook 2024-05-02 19:27:40 -03:00
LICENSE Update organization name and URLs in configuration files 2024-04-18 11:58:19 -03:00
Makefile chore: update dependencies and add lock step in py_autofix.yml (#2875) 2024-07-22 11:19:10 -07:00
poetry.lock chore: bump langflow and langflow-base to 1.0.12 and 0.88 (#2874) 2024-07-22 17:33:57 +00:00
pyproject.toml chore: bump langflow and langflow-base to 1.0.12 and 0.88 (#2874) 2024-07-22 17:33:57 +00:00
README.ja.md docs: add Japanese README (#2760) 2024-07-18 15:05:16 -03:00
README.md docs: add Japanese README (#2760) 2024-07-18 15:05:16 -03:00
README.PT.md docs: add Japanese README (#2760) 2024-07-18 15:05:16 -03:00
README.zh_CN.md docs: add Japanese README (#2760) 2024-07-18 15:05:16 -03:00
render.yaml update blueprint render 2024-07-01 13:53:55 -03:00

Langflow 1.0 is OUT! 🎉

Read all about it here!

Langflow

A visual framework for building multi-agent and RAG applications

Open-source, Python-powered, fully customizable, LLM and vector store agnostic

Docs - Join our Discord - Follow us on X - Live demo

README in English README in Portuguese README in Simplified Chinese README in Japanese

Your GIF

📝 Content

📦 Get Started

You can install Langflow with pip:

# Make sure you have >=Python 3.10 installed on your system.
python -m pip install langflow -U

Or

If you would like to install from your cloned repo, you can build and install Langflow's frontend and backend with:

make install_frontend && make build_frontend && make install_backend

Then, run Langflow with:

python -m langflow run

🎨 Create Flows

Creating flows with Langflow is easy. Simply drag components from the sidebar onto the workspace and connect them to start building your application.

Explore by editing prompt parameters, grouping components into a single high-level component, and building your own Custom Components.

Once youre done, you can export your flow as a JSON file.

Load the flow with:

from langflow.load import run_flow_from_json

results = run_flow_from_json("path/to/flow.json", input_value="Hello, World!")

Deploy

DataStax Langflow

DataStax Langflow is a hosted version of Langflow integrated with AstraDB. Be up and running in minutes with no installation or setup required. Sign up for free.

Deploy Langflow on Hugging Face Spaces

You can also preview Langflow in HuggingFace Spaces. Clone the space using this link to create your own Langflow workspace in minutes.

Deploy Langflow on Google Cloud Platform

Follow our step-by-step guide to deploy Langflow on Google Cloud Platform (GCP) using Google Cloud Shell. The guide is available in the Langflow in Google Cloud Platform document.

Alternatively, click the "Open in Cloud Shell" button below to launch Google Cloud Shell, clone the Langflow repository, and start an interactive tutorial that will guide you through the process of setting up the necessary resources and deploying Langflow on your GCP project.

Open in Cloud Shell

Deploy on Railway

Use this template to deploy Langflow 1.0 on Railway:

Deploy on Railway

Deploy on Render

Deploy to Render

Deploy on Kubernetes

Follow our step-by-step guide to deploy Langflow on Kubernetes.

🖥️ Command Line Interface (CLI)

Langflow provides a command-line interface (CLI) for easy management and configuration.

Usage

You can run the Langflow using the following command:

langflow run [OPTIONS]

Each option is detailed below:

  • --help: Displays all available options.
  • --host: Defines the host to bind the server to. Can be set using the LANGFLOW_HOST environment variable. The default is 127.0.0.1.
  • --workers: Sets the number of worker processes. Can be set using the LANGFLOW_WORKERS environment variable. The default is 1.
  • --timeout: Sets the worker timeout in seconds. The default is 60.
  • --port: Sets the port to listen on. Can be set using the LANGFLOW_PORT environment variable. The default is 7860.
  • --env-file: Specifies the path to the .env file containing environment variables. The default is .env.
  • --log-level: Defines the logging level. Can be set using the LANGFLOW_LOG_LEVEL environment variable. The default is critical.
  • --components-path: Specifies the path to the directory containing custom components. Can be set using the LANGFLOW_COMPONENTS_PATH environment variable. The default is langflow/components.
  • --log-file: Specifies the path to the log file. Can be set using the LANGFLOW_LOG_FILE environment variable. The default is logs/langflow.log.
  • --cache: Selects the type of cache to use. Options are InMemoryCache and SQLiteCache. Can be set using the LANGFLOW_LANGCHAIN_CACHE environment variable. The default is SQLiteCache.
  • --dev/--no-dev: Toggles the development mode. The default is no-dev.
  • --path: Specifies the path to the frontend directory containing build files. This option is for development purposes only. Can be set using the LANGFLOW_FRONTEND_PATH environment variable.
  • --open-browser/--no-open-browser: Toggles the option to open the browser after starting the server. Can be set using the LANGFLOW_OPEN_BROWSER environment variable. The default is open-browser.
  • --remove-api-keys/--no-remove-api-keys: Toggles the option to remove API keys from the projects saved in the database. Can be set using the LANGFLOW_REMOVE_API_KEYS environment variable. The default is no-remove-api-keys.
  • --install-completion [bash|zsh|fish|powershell|pwsh]: Installs completion for the specified shell.
  • --show-completion [bash|zsh|fish|powershell|pwsh]: Shows completion for the specified shell, allowing you to copy it or customize the installation.
  • --backend-only: This parameter, with a default value of False, allows running only the backend server without the frontend. It can also be set using the LANGFLOW_BACKEND_ONLY environment variable.
  • --store: This parameter, with a default value of True, enables the store features, use --no-store to deactivate it. It can be configured using the LANGFLOW_STORE environment variable.

These parameters are important for users who need to customize the behavior of Langflow, especially in development or specialized deployment scenarios.

Environment Variables

You can configure many of the CLI options using environment variables. These can be exported in your operating system or added to a .env file and loaded using the --env-file option.

A sample .env file named .env.example is included with the project. Copy this file to a new file named .env and replace the example values with your actual settings. If you're setting values in both your OS and the .env file, the .env settings will take precedence.

👋 Contribute

We welcome contributions from developers of all levels to our open-source project on GitHub. If you'd like to contribute, please check our contributing guidelines and help make Langflow more accessible.


Star History Chart

🌟 Contributors

langflow contributors

📄 License

Langflow is released under the MIT License. See the LICENSE file for details.