File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 3939
4040% Looping process to gradually summarize the text chunk by chunk, reducing
4141% the chunk size with each iteration.
42+ numCalls = 0 ;
4243while numel(chunks )>1
4344 summarizedChunks = strings(size(chunks ));
45+ numCalls = numCalls + numel(chunks );
46+ % Add a limit to the number of calls, to ensure you are not making
47+ % more calls than what is expected. You can change this value to match
48+ % what is needed for your application.
49+ if numCalls > 20
50+ error(" Document is too long to be summarized." )
51+ end
4452
4553 for i = 1 : length(chunks )
46- summarizedChunks(i ) = generate(summarizer , " Summarize this content:" + newline + chunks(i ));
54+ summarizedChunks(i ) = generate(summarizer , " Summarize this content:" + newline + chunks(i ));
4755 end
4856
4957 % Merging the summarized chunks to serve as the base for the next iteration
You can’t perform that action at this time.
0 commit comments