NexusInstruments commited on
Commit
5f5b92b
·
verified ·
1 Parent(s): c332c52

Create summarizer.py

Browse files
Files changed (1) hide show
  1. utils/summarizer.py +8 -0
utils/summarizer.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from utils.backend import run_llm
2
+
3
+ def summarize_text(text: str, max_len: int = 500) -> str:
4
+ """Summarize a block of text/logs with LLM backend"""
5
+ if not text.strip():
6
+ return "⚠️ No content to summarize."
7
+ prompt = f"Summarize the following text in plain English:\n\n{text[:2000]}"
8
+ return run_llm(prompt)[:max_len]