langflow icon indicating copy to clipboard operation
langflow copied to clipboard

Feat: data-components-utilities

Open vasconceloscezar opened this issue 1 year ago • 0 comments

New helper Data components were added:

  • CSV to Data
  • JSON to Data
  • Data Conditional Router
  • Extract Key
  • Filter Data Values
  • Current Date

CSV to Data

The CSV to Data component converts a CSV string into a list of Data objects.

Inputs

  • CSV String: A valid CSV string to be converted.

Outputs

  • Data List: A list of Data objects, where each object represents a row from the CSV.

Usage

This component is useful when you need to import CSV data into your Langflow project. It can handle parsing errors and provides appropriate error messages if the CSV is invalid.

JSON to Data

The JSON to Data component converts a JSON string into either a single Data object or a list of Data objects.

Inputs

  • JSON String: A valid JSON string (object or array) to be converted.

Outputs

  • Data: Either a single Data object or a list of Data objects, depending on the input JSON structure.

Usage

Use this component when working with JSON data in your flows. It can handle both single JSON objects and arrays, making it versatile for various data structures.

Data Conditional Router

The Data Conditional Router component routes a Data object based on a condition applied to a specified key.

Inputs

  • Data Input: The Data object to process.
  • Key Name: The name of the key in the Data object to check.
  • Comparison Operator: The operator to apply for comparing values (e.g., equals, contains, starts with).
  • Compare Value: The value to compare against (not used for boolean validator).

Outputs

  • True Output: The Data object if the condition is met.
  • False Output: The Data object if the condition is not met.

Usage

This component is essential for creating conditional logic in your flows based on the content of Data objects.

Extract List Key

The Extract List Key component extracts a specific key containing a list from a Data object and returns a list of Data objects.

Inputs

  • Data: The Data object to extract the list key from.
  • Key to Extract: The key in the Data object that contains the list to extract.

Outputs

  • Extracted Data: A list of Data objects extracted from the specified key.

Usage

Use this component when you need to work with nested list data within your Data objects.

Filter Data Values

The Filter Data Values component filters a list of data items based on a specified key, filter value, and comparison operator.

Inputs

  • Input Data: The list of data items to filter.
  • Filter Key: The key to filter on (e.g., 'route').
  • Filter Value: The value to filter by (e.g., 'CMIP').
  • Comparison Operator: The operator to apply for comparing the values.

Outputs

  • Filtered Data: A list of Data objects that meet the filter criteria.

Usage

This component is useful for narrowing down large datasets based on specific criteria.

Current Date

The Current Date component is not provided in the given code snippets. It likely returns the current date and time, which can be useful in various data processing and logging scenarios.

image

image

image

vasconceloscezar avatar Sep 11 '24 20:09 vasconceloscezar