omniscientframework / utils /summarizer.py
NexusInstruments's picture
Update utils/summarizer.py
894c2eb verified
raw
history blame contribute delete
336 Bytes
from backend import run_llm
def summarize_text(text: str, max_len: int = 500) -> str:
"""Summarize a block of text/logs with LLM backend"""
if not text.strip():
return "⚠️ No content to summarize."
prompt = f"Summarize the following text in plain English:\n\n{text[:2000]}"
return run_llm(prompt)[:max_len]