Question: How to define the order of a CustomComponent input in list?
I have defined a "SimpleSequentialChain" like:
which takes multiple chains as input. My question is that can I let the input list of chains have explicitly defined order, just like if you set "is_list" as True as a string field? (like the example below)
🤖
Hey @crazybullet28! Good to see you back here at the langflow repository! 😎
Based on the information available in the langflow repository, it seems that the "is_list" attribute is used to indicate whether a field should be treated as a list. This is done in two classes: ModelSpecificFieldFormatter and ListTypeFormatter. However, there is no evidence in the provided context that the "is_list" attribute is used to order string fields.
In the ModelSpecificFieldFormatter class, if the field name is "model_name" and the name is in the MODEL_DICT, the is_list attribute is set to True. This means that the field will be treated as a list of options, which are the models associated with the name.
In the ListTypeFormatter class, if the field type contains "List" or "Sequence", the is_list attribute is set to True. This means that the field will be treated as a list, and the type of the list elements is extracted from the field type.
As for your question about the "SimpleSequentialChain" and the order of input chains, I wasn't able to find specific information about this in the langflow repository. It's possible that the order of input chains is determined by the order in which they are added to the "SimpleSequentialChain", but without more information or context, it's difficult to say for sure.
If you could provide more details about how you're using the "SimpleSequentialChain" and what you're trying to achieve, I might be able to give a more specific answer. For example, are you trying to control the order of execution of the chains, or are you trying to control the order in which they are displayed in the UI? Any additional information you can provide would be helpful.
You can find the relevant code in the field_formatters.py file in the langflow repository.
Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
Hey @crazybullet28
How are you?
Currently, they are sorted in alphabetical order but I just pushed a commit in the dev branch to deactivate that.
You still have to abide to Python's rules around required and optional parameters, though.