I’ve created an agent to summarize different types of documents and generate a word document output. When the agent is run, the user will only need to upload any document type and it will be processed specifically based on the document type rule I’ve defined in the “Generate Text” block
For 2 document types, I need to process/summarize them as one therefore I enabled the “User input block” to accept multiple file uploads. In the “Generate Text” block, I have also specified a the rule that if these 2 document types are uploaded at the same time, then summarize them as one. However, when I run the agent, it still only processes the first document uploaded and not the second one. Appreciate any assistance on this. Thanks!
I’m not 100% sure, but I think you could try having the user pack their documents into a .zip file and then upload that into the file upload.
I can actually upload multiple documents from the input page. the challenge i’m facing is to ensure 2 document types are processed as one when both documents are uploaded at the same time.
@mylomindstudio when you upload more than 2+ documents, they are stored in a JSON variable (take a look at your debugger) with the following structure: [0: file 1 extracted text, 1: file 2 extracted text]
. See User Input Block | MindStudio Docs
You can provide a summary of the files in a few ways:
- Prompt AI to summarize the contents of the entire variable - try multiple prompts that specify completeness + try more premium models with longer context windows as some models get lazy and don’t focus on the back half of text.
- Summarize each file individually and then create a summary of the summaries - loop through each uploaded file and summarize it. Then have AI generate a summary of summaries. This is probably the best way to do it.
To do #2, pass the JSON variable into a Run Workflow block (this will loop through the files). Then create a separate workflow that has a Start → Generate Text (Summarize) → End block.
Let me know your thoughts!
1 Like