Spaces:
Sleeping
Sleeping
File size: 1,218 Bytes
bf75aa7 7bf1507 27b2e17 7bf1507 6655689 7bf1507 6655689 73268d4 6655689 bf75aa7 3b53c7a 7bf1507 27b2e17 6655689 bf75aa7 6655689 bf75aa7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
import { generateFromDefaultEndpoint } from "../generateFromDefaultEndpoint";
import { getReturnFromGenerator } from "$lib/utils/getReturnFromGenerator";
export async function generateSummaryOfReasoning(
buffer: string,
modelId?: string,
opts?: { apiKey?: string }
): Promise<string> {
let summary: string | undefined;
// Tools removed: no tool-based summarization path
if (!summary) {
summary = await getReturnFromGenerator(
generateFromDefaultEndpoint({
messages: [
{
from: "user",
content: buffer.slice(-300),
},
],
preprompt: `You are tasked with summarizing the latest reasoning steps. Never describe results of the reasoning, only the process. Remain vague in your summary.
The text might be incomplete, try your best to summarize it in one very short sentence, starting with a gerund and ending with three points.
Example: "Thinking about life...", "Summarizing the results...", "Processing the input..."`,
generateSettings: {
max_tokens: 50,
},
modelId,
apiKey: opts?.apiKey,
})
);
}
if (!summary) {
return "Reasoning...";
}
const parts = summary.split("...");
return parts[0].slice(0, 100) + "...";
}
|