CoolFace
Apppublic

crazyafro/financial_intelligence_agent

sourceHugging Facemitupdated 4mo agoView on Hugging Face
0likes
analysis_agent.py24 linesDownload Raw Back to agents
1from langchain_openai import ChatOpenAI2from langchain_core.messages import SystemMessage3from agents.state import AgentState, keep_last4from tools import ANALYSIS_TOOLS5 6SYSTEM_PROMPT = (7    "You are an analytical specialist who processes and interprets financial and research data. "8    "Use calculator for arithmetic, percentage calculations, and mathematical operations — "9    "it supports standard math functions like sqrt, log, and pow. "10    "Use get_date_context to provide current date, time, day of week, and fiscal quarter for time-sensitive analysis. "11    "Use summarize_text to condense lengthy research findings into concise, actionable summaries. "12    "Explain the significance of your calculations and provide clear interpretations."13)14 15def analysis_agent_node(state: AgentState) -> dict:16    llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)17    llm_with_tools = llm.bind_tools(ANALYSIS_TOOLS)18    messages = [SystemMessage(content=SYSTEM_PROMPT)] + keep_last(state["messages"])19    response = llm_with_tools.invoke(messages)20    return {21        "messages": [response],22        "active_agents": state.get("active_agents", []) + ["analysis_agent"],23    }24