Open zhuqingchao opened 1 month ago
sys.files is an array, and its output variable is also an array. It cannot be placed directly in the LLM prompt word. You can add LLM to the iteration by connecting an iterator to the document extractor.
The error you're encountering, "Run failed: sequence item 2: expected str instance, list found," suggests that the code is trying to concatenate or process a list as if it were a string. This typically happens when a function expects a string but receives a list instead.
In the context of prompt_template_parser.py
, it seems like the issue arises when handling inputs that are arrays of files, which are then expected to be strings. To resolve this, you have a couple of options:
Convert the List to a String: If the list of files should be treated as a single string, you can join the list elements into a string. For example, you can use ','.join(your_list)
to concatenate the list items into a single string separated by commas.
Adjust the Code to Handle Lists: If the logic should handle lists differently, you might need to modify the code to process each item in the list individually, rather than expecting a single string.
Without specific details on the intended behavior, it's hard to recommend the exact change. However, if the input is supposed to be a single string, converting the list to a string as shown above might be the simplest solution. If the input should remain a list, you may need to adjust the logic to handle each element appropriately.
To continue talking to Dosu, mention @dosu.
sys.files is an array, and its output variable is also an array. It cannot be placed directly in the LLM prompt word. You can add LLM to the iteration by connecting an iterator to the document extractor. got it. so array[string] should not be choosed in the graph editor. maybe need to fix this
It seems you open a new https://github.com/langgenius/dify/issues/10004 here, this can be closed right?
It seems you open a new #10004 here, this can be closed right? @crazywoola I think #10004 is another bug. The current bug refers to the ability to select an array[string] generated by the doc extractor array[file] in the prompt of the LLM node. Another issue is that when the start node changes from a single file to multiple files, the output of the doc extractor is still a string instead of an array[string].
Hi, @zhuqingchao. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.
Issue Summary:
sys.files
being an array, which should not be directly used in the LLM prompt.Next Steps:
Thank you for your understanding and contribution!
Self Checks
Dify version
0.10.2
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
DSL: multi_file_error.txt I found that prompt_template_parser.py line 36. when the inputs contains array[file] -> array[string] 。 then it failed at line 40. I don't know if I should type match the array directly to a string here, or convert it elsewhere.
✔️ Expected Behavior
propmt template generate success.
❌ Actual Behavior
failed with error