Clean up monitoring TG Python adapter

This commit is contained in:
Grendgi
2026-06-04 16:10:13 +03:00
parent 76f1be8b2a
commit 7a01eebb5b
12 changed files with 85 additions and 1968 deletions

View File

@@ -310,26 +310,3 @@ def analyze(text: str | None) -> dict[str, Any]:
"tg_handles": extract_tg_handles(text),
"real_estate": extract_real_estate(text),
}
async def analyze_with_llm(
text: str | None,
vertical: str = "real_estate",
department_id: str | None = None,
section_slug: str | None = None,
) -> dict[str, Any]:
"""Regex extraction + local LLM lead classification, routed by vertical.
`department_id` + `section_slug` let the classifier pick a department and
section-specific system prompt with fallback to the department vertical
prompt. The LLM verdict goes under `lead` for RE and
under `hr_lead` for HR. Falls back to regex-only if the LLM is unavailable.
"""
base = analyze(text)
# Lazy import to avoid hard dep on httpx in environments where LLM is off.
from parser_bot.llm import classify
verdict = await classify(text, vertical, department_id, section_slug) # type: ignore[arg-type]
if verdict is not None:
base["hr_lead" if vertical == "hr" else "lead"] = verdict
return base