Datasets:
File size: 1,191 Bytes
8d88d9b |
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 |
import { generateFromDefaultEndpoint } from "../generateFromDefaultEndpoint";
import { getReturnFromGenerator } from "$lib/utils/getReturnFromGenerator";
import { logger } from "../logger";
export async function generateSummaryOfReasoning(buffer: string): Promise<string> {
// debug 5s delay
await new Promise((resolve) => setTimeout(resolve, 3000));
const summary = await getReturnFromGenerator(
generateFromDefaultEndpoint({
messages: [
{
from: "user",
content: buffer.slice(-200),
},
],
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_new_tokens: 50,
},
})
)
.then((summary) => {
const parts = summary.split("...");
return parts[0] + "...";
})
.catch((e) => {
logger.error(e);
return "Reasoning...";
});
return summary;
}
|