try { const res = await deps.completeSimple(
completionModel,
{
messages: [
{
role: "user",
content:
`You are an assistant that summarizes texts concisely while keeping the most important information. ` +
`Summarize the text to approximately ${targetLength} characters. Maintain the original tone and style. ` +
`Reply only with the summary, without additional explanations.\n\n` +
`<text_to_summarize>\n${text}\n</text_to_summarize>`,
timestamp: Date.now(),
},
],
},
{
apiKey,
maxTokens: Math.ceil(targetLength / 2),
temperature: 0.3,
signal: controller.signal,
},
); const summary = res.content
.filter(isTextContentBlock)
.map((block) => block.text.trim())
.filter(Boolean)
.join(" ")
.trim();
if (!summary) { thrownew Error("No summary returned");
}
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.23Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-09)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.