CoolFace
Apppublic

sykang16/agentic-wealth-intelligence

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
09_API_REFERENCE.md194 linesDownload Raw Back to docs
1# API Reference2 3Base URL: `http://localhost:8000`4 5## Health Check6 7```8GET /health9```10 11Response:12```json13{"status": "ok"}14```15 16---17 18## Chat (Orchestrator)19 20Unified endpoint that automatically routes messages to the appropriate module.21 22```23POST /api/v1/chat24```25 26**Request:**27```json28{29  "message": "What's my net worth?",30  "user_id": "user_001"31}32```33 34**Response:**35```json36{37  "response": "Your net worth is $327,250...",38  "intent": "portfolio_query",39  "module_source": "Portfolio",40  "success": true,41  "error": null42}43```44 45**Intent values:** `portfolio_query`, `profiling`, `recommendation`, `general`46 47**curl example:**48```bash49curl -X POST http://localhost:8000/api/v1/chat \50  -H "Content-Type: application/json" \51  -d '{"message": "What is my net worth?", "user_id": "user_001"}'52```53 54---55 56## Portfolio57 58### Get Portfolio Summary59 60```61GET /api/v1/portfolio/{user_id}62```63 64**Response:**65```json66{67  "user_id": "user_001",68  "name": "John Doe",69  "metrics": {70    "net_worth": 327250,71    "total_assets": 627250,72    "total_liabilities": 300000,73    "liquidity_ratio": 0.103674  },75  "allocation": {"cash": 10.36, "stocks": 5.59},76  "top_holdings": [77    {"symbol": "AAPL", "name": "Apple Inc.", "value": 8750.0, "gain_loss_pct": 16.67}78  ]79}80```81 82**Error:** `404` if user not found.83 84### Query Portfolio85 86```87POST /api/v1/portfolio/{user_id}/query88```89 90**Request:**91```json92{"query": "Show my asset allocation"}93```94 95**Response:**96```json97{98  "answer": "Here is your asset allocation...",99  "query_type": "asset_allocation",100  "success": true,101  "error": null,102  "data": {}103}104```105 106---107 108## Profiling109 110### Start Profiling Session111 112```113POST /api/v1/profiling/{user_id}/start114```115 116**Request (optional):**117```json118{"user_name": "John"}119```120 121**Response:**122```json123{124  "assistant_message": "Welcome! Let's build your investment profile...",125  "completion_percentage": 0.0,126  "is_complete": false,127  "filled_slots": {},128  "missing_required": ["Risk Tolerance", "Investment Horizon", ...]129}130```131 132### Respond to Profiling Question133 134```135POST /api/v1/profiling/{user_id}/respond136```137 138**Request:**139```json140{"message": "I have a moderate risk tolerance"}141```142 143**Response:** Same schema as start, with updated completion.144 145**Error:** `404` if no active session. Call `/start` first.146 147---148 149## Recommendations150 151### Generate Recommendations152 153```154POST /api/v1/recommendations/generate155```156 157**Request:**158```json159{160  "user_id": "user_001",161  "query": "How should I diversify?",162  "max_recommendations": 5,163  "include_live_data": false164}165```166 167**Response:**168```json169{170  "user_id": "user_001",171  "query": "How should I diversify?",172  "recommendations": [...],173  "summary": "Generated 3 recommendations...",174  "data_sources_used": ["portfolio", "rag"],175  "profile_completeness": 0.75,176  "warnings": ["..."],177  "success": true,178  "error": null179}180```181 182---183 184## Error Codes185 186| Code | Meaning |187|------|---------|188| `200` | Success |189| `404` | Resource not found (user, session) |190| `422` | Validation error (missing/invalid fields) |191| `500` | Internal server error |192 193Validation errors return detailed Pydantic error messages in the response body.194