Spaces:
Running
Running
File size: 1,333 Bytes
afd56bc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | from typing import Dict, Any
from langchain_core.messages import AIMessage
from core.llm_router import get_llm
from schemas import AgentState
def document_gap_analyzer_node(state: AgentState) -> Dict[str, Any]:
"""
Analizuje za艂膮czniki i profil, by precyzyjnie wykaza膰 braki we frameworku dotacyjnym
Zwraca list臋 brak贸w, np. brak KPI, brak wska藕nik贸w ROI itp.
"""
llm = get_llm(task_type="standard")
# Simple simulation check
if state.profile and state.profile.financials:
prompt_context = f"Dane finansowe podane: {state.profile.financials}"
else:
prompt_context = "Brak danych finansowych w systemie."
prompt = f"""
Jeste艣 Document Gap Analyzerem. Sp贸jrz na zebrane dane o firmie i odpowiedz czego dok艂adnie brakuje,
aby wniosek dotacyjny zyska艂 wysokie szanse.
Zwr贸膰 odpowied藕 w li艣cie wypunktowanej. PISZ ZAWSZE I WY艁膭CZNIE W J臉ZYKU POLSKIM.
Kontekst:
{prompt_context}
"""
response = llm.invoke(prompt)
from core.utils import safe_extract_text
gap_result = safe_extract_text(response.content)
return {
"messages": [
AIMessage(
content=f"[GAP ANALYZER] Znalaz艂em nast臋puj膮ce braki:\n{gap_result}"
)
],
"current_agent": "supervisor",
}
|