File size: 565 Bytes
3ac7897
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# orchestrator/orchestrator.py
from fastapi import FastAPI, Request
from pydantic import BaseModel
import requests

app = FastAPI()

class Query(BaseModel):
    query: str

@app.post("/ask")
def ask(query: Query):
    market_data = requests.post("http://localhost:8001/market", json={"query": query}).json()

    earnings = requests.post("http://localhost:8002/earnings", json={"query": query}).json()

    answer = f"Today, your Asia tech allocation is {market_data['allocation']}% of AUM. " \
             f"{earnings['summary']}"
    return {"response": answer}