add ollama bagcround run and cache
This commit is contained in:
@@ -46,3 +46,28 @@ def ollama_summary(
|
||||
with request.urlopen(req, timeout=selected_timeout) as response:
|
||||
data = json.loads(response.read().decode("utf-8"))
|
||||
return str(data.get("response", "")).strip()
|
||||
|
||||
|
||||
def ollama_dashboard_assessment(analysis: dict[str, object], model: str | None = None, timeout: int | None = None) -> str:
|
||||
compact = {
|
||||
"summary": analysis.get("summary", {}),
|
||||
"anomaly_summary": analysis.get("anomaly_summary", {}),
|
||||
"top_anomalies": analysis.get("anomalies", [])[:5],
|
||||
"top_recommendations": analysis.get("recommendations", [])[:5],
|
||||
"block_candidates": analysis.get("block_candidates", [])[:5],
|
||||
"policy_findings": analysis.get("policy_findings", [])[:5],
|
||||
}
|
||||
return ollama_summary(
|
||||
[],
|
||||
[],
|
||||
model,
|
||||
analysis={
|
||||
"task": (
|
||||
"Write a concise dashboard analyst note for a FortiGate admin. "
|
||||
"Explain likely cause, whether this looks malicious or noisy, and the next action. "
|
||||
"Mention policyid=0 as implicit deny/drop, not an editable policy."
|
||||
),
|
||||
"data": compact,
|
||||
},
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user