omniscientframework / utils /summarizer.py
NexusInstruments's picture
Create summarizer.py
5f5b92b verified
raw
history blame
342 Bytes
from utils.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]