/** * CAPABILITY: summarize an uploaded file with the platform Summarize node. * * The input is the complete file attachment. The result uses the node's * PascalCase `content.Text` and `content.Citations` contract. * * Generic scenario: condense a community oral-history interview for an archive. */ import { flow, summarize, out, err, tmpl, js, types } from '@uipath/maestro-builder-sdk'; export default flow('oral-history-digest') .name('OralHistoryDigest') .version('1.0.0') .input({ interviewFile: types.file }) .output({ summary: types.string, citations: types.array }) .step('summarizeInterview', summarize({ attachment: out('start', 'interviewFile'), prompt: 'Summarize the places, people, dates, and traditions mentioned in this interview.', returnCitations: true, })) // The handler runs BECAUSE `summarizeInterview` failed, so its `content.*` // outputs have no value — return an empty list rather than reading them. .onError((handler) => handler.return({ summary: tmpl`could not summarize interview: ${err('summarizeInterview', 'detail')}`, citations: js`[]`, })) .return({ summary: out('summarizeInterview', 'content.Text'), citations: out('summarizeInterview', 'content.Citations'), }) .build();