CoolFace
Apppublic

sykang16/agentic-wealth-intelligence

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
04_MODULE_B_PROFILING.md82 linesDownload Raw Back to docs
1# Module B: Agent-Guided Investment Profiling2 3#### ๐Ÿ”ด Priority: HIGH4 5## Objective6Conversational investment profiling using slot-filling7 8## LangGraph Workflow9```10START โ†’ User Input11  โ†“12Extractor (fill slots)13  โ†“14Validator (check validity)15  โ†“16Completion Checker17  โ”œโ”€ Complete? โ†’ END (return profile)18  โ””โ”€ Incomplete? โ†’ Question Generator โ†’ Ask User โ†’ loop back19```20 21## Agent Architecture (LangGraph)22```python23# State definition24class ConversationState(TypedDict):25    messages: List[Message]26    profile: InvestmentProfile  # Partially filled27    missing_slots: List[str]28    current_question: str29```30 31## Pydantic Schema (Required Slots)32```python33class InvestmentProfile(BaseModel):34    # Risk Assessment35    risk_tolerance: Literal["conservative", "moderate", "aggressive"]36    loss_comfort: int = Field(ge=1, le=10)  # 1-10 scale37    38    # Time Horizon39    investment_period: Literal["short", "medium", "long"]  # <3yr, 3-10yr, >10yr40    liquidity_needs: str41    42    # Financial Situation43    income_stability: Literal["stable", "variable", "uncertain"]44    emergency_fund: bool45    debt_level: Literal["none", "low", "moderate", "high"]46    47    # Investment Experience48    experience_level: Literal["beginner", "intermediate", "advanced"]49    previous_investments: List[str]50    51    # Goals52    primary_goal: str53    target_return: Optional[float]54```55 56## Agent Nodes571. Extractor: Parse user response to fill slots582. Validator: Check if extracted data is valid593. Question Generator: Generate next question for missing slots604. Completion Checker: Determine if profile is complete61 62## Implementation Files63```64src/65โ”œโ”€โ”€ profiling/66โ”‚   โ”œโ”€โ”€ __init__.py67โ”‚   โ”œโ”€โ”€ agent.py              # LangGraph agent definition68โ”‚   โ”œโ”€โ”€ nodes/69โ”‚   โ”‚   โ”œโ”€โ”€ extractor.py70โ”‚   โ”‚   โ”œโ”€โ”€ validator.py71โ”‚   โ”‚   โ”œโ”€โ”€ question_gen.py72โ”‚   โ”‚   โ””โ”€โ”€ checker.py73โ”‚   โ”œโ”€โ”€ schemas.py            # InvestmentProfile model74โ”‚   โ””โ”€โ”€ prompts/75โ”‚       โ”œโ”€โ”€ extractor_prompt.py76โ”‚       โ””โ”€โ”€ question_prompts.py77```78 79 80 81 82