Spaces:
Sleeping
Sleeping
File size: 1,450 Bytes
3e964dd 8d4d0bb 45994d6 3e964dd 45994d6 3e964dd | 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 44 45 46 47 | from __future__ import annotations
import operator
from typing import Annotated, Literal, TypedDict
Intent = Literal["real_time", "news", "historical", "fundamental", "comparative", "screener"]
UserMode = Literal["insight", "trader"]
class FiNoraState(TypedDict):
# Input
query: str
ticker: str # display ticker (e.g. "TCS", "RELIANCE")
yf_ticker: str # Yahoo Finance ticker (e.g. "TCS.NS", "RELIANCE.NS")
company_name: str # full company name (e.g. "Infosys Limited")
currency: str # ISO currency code (e.g. "INR", "USD")
user_mode: UserMode # "insight" (default) or "trader"
session_id: str
conversation_history: list[dict]
# Routing
intents: list[Intent]
guardrail_flags: list[str]
guardrail_blocked: bool
# Retrieval outputs (parallel branches append — operator.add merges lists)
realtime_context: dict | None
news_chunks: Annotated[list[dict], operator.add]
filings_chunks: list[dict]
financials_chunks: Annotated[list[dict], operator.add]
historical_chunks: Annotated[list[dict], operator.add]
fundamental_data: dict | None
sector_context: dict | None # sector ETF performance + similar stocks
# Generation
fused_context: str
response: str
followup_questions: list[str]
citations: list[dict]
confidence_score: float
disclaimer_text: str
# Observability
trace_id: str
retrieval_scores: dict
|