langflow icon indicating copy to clipboard operation
langflow copied to clipboard

There is a problem with the Create data component

Open alex-ge123 opened this issue 1 year ago • 5 comments

Describe the bug There is a problem with the Create data component

Add a Create data component and fill in the key and value, click Run, no output data

Browser and Version

  • Browser [chrome,]
  • Version [v1.0.7]

To Reproduce 微信图片_20240710154806

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

alex-ge123 avatar Jul 10 '24 07:07 alex-ge123

Uploading 微信图片_20240710155303.png…

alex-ge123 avatar Jul 10 '24 07:07 alex-ge123

Uploading 微信图片_20240710155303.png…

alex-ge123 avatar Jul 10 '24 07:07 alex-ge123

The issue with the Create Data component not producing output data after filling in the key and value fields is likely due to the build method not properly handling the input fields. Specifically, the kwargs parameter is expected to contain dictionaries, but if the input fields are not correctly passed or formatted, the data dictionary will remain empty.

Here is the relevant part of the build method:

def build(
    self,
    number_of_fields: int = 0,
    text_key: str = "text",
    **kwargs,
) -> Data:
    data = {}
    for value_dict in kwargs.values():
        if isinstance(value_dict, dict):
            # Check if the value of the value_dict is a Data
            value_dict = {
                key: value.get_text() if isinstance(value, Data) else value for key, value in value_dict.items()
            }
            data.update(value_dict)
    return_data = Data(data=data, text_key=text_key)
    self.status = return_data
    return return_data

Ensure that the input fields are correctly passed as dictionaries to the build method [1].

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Jul 10 '24 08:07 dosubot[bot]

yes, I'm facing the same bug!

codenprogressive avatar Jul 10 '24 14:07 codenprogressive

Hi @alex-ge123, @codenprogressive, can you please upgrade Langflow to 1.0.14 and try again? Plmk if you encounter any issues.

I was able to successfully create and parse data: Screenshot 2024-07-31 at 9 00 08 PM Screenshot 2024-07-31 at 9 00 12 PM

jordanrfrazier avatar Aug 01 '24 04:08 jordanrfrazier