Spaces:
Sleeping
Sleeping
| # orchestrator/orchestrator.py | |
| from fastapi import FastAPI, Request | |
| from pydantic import BaseModel | |
| import requests | |
| app = FastAPI() | |
| class Query(BaseModel): | |
| query: str | |
| def ask(query: Query): | |
| # Step 1: Get market data | |
| market_data = requests.post("http://localhost:8001/market", json={"query": query}).json() | |
| # Step 2: Get earnings summary | |
| earnings = requests.post("http://localhost:8002/earnings", json={"query": query}).json() | |
| # Step 3: Compose final answer | |
| answer = f"Today, your Asia tech allocation is {market_data['allocation']}% of AUM. " \ | |
| f"{earnings['summary']}" | |
| return {"response": answer} | |