import httpx, json
resp = httpx.post(
"https://app.lapathoniia.top/chat/stream",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"message": "What is Amazon Bedrock AgentCore?",
"model": "MamayLM-Gemma-3-27B-IT-v2.0",
"session_id": "search-1",
"user_id": "user-123",
"web_search": True,
"connectors": False,
"chat_history": [],
},
)
text, sources = [], []
for line in resp.iter_lines():
if line.startswith("data: "):
d = json.loads(line[6:])
if "text" in d: text.append(d["text"])
if "sources" in d: sources = d["sources"]
print("".join(text))
print("\nSources:", sources)